diff --git a/deploy.php b/deploy.php index 41f5660..87226ea 100644 --- a/deploy.php +++ b/deploy.php @@ -23,6 +23,7 @@ host('main') ->set('remote_user', 'mag') ->set('branch', 'main') ->set('deploy_path', '/var/www/helpdesk_dev'); + host('develop') ->set('hostname', 'helpdesk.mlba.dev') ->set('remote_user', 'mag') @@ -33,23 +34,23 @@ task('build', function (): void { run('export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && nvm use {{node_version}} && cd {{release_path}} && npm ci --no-audit --no-fund'); run('export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && nvm use {{node_version}} && cd {{release_path}} && npm run build'); }); -task('seo:sitemap', function (): void { - run('cd {{release_path}} && php artisan thredary:sitemap'); -}); task('queue:restart', function (): void { run('cd {{release_path}} && php artisan queue:restart'); }); + task('deploy:write_revision_file', function (): void { run('cd {{release_path}} && echo "{{branch}}" > BRANCH'); run('cd {{release_path}} && date -u +"%Y-%m-%dT%H:%M:%SZ" > DEPLOYED_AT'); }); + task('artisan:clear', function (): void { run('cd {{release_path}} && php artisan view:clear'); run('cd {{release_path}} && php artisan optimize:clear'); run('cd {{release_path}} && php artisan config:clear'); run('cd {{release_path}} && php artisan route:clear'); }); + task('services:restart', function (): void { run('sudo -n nginx -t'); run('sudo -n systemctl reload nginx'); @@ -59,8 +60,6 @@ task('services:restart', function (): void { after('deploy:update_code', 'deploy:write_revision_file'); after('deploy:vendors', 'build'); after('deploy:symlink', 'artisan:clear'); -#after('deploy:symlink', 'seo:sitemap'); -#after('seo:sitemap', 'queue:restart'); after('deploy:symlink', 'queue:restart'); after('deploy:failed', 'deploy:unlock'); after('deploy:symlink', 'services:restart'); diff --git a/package.json b/package.json index fdf1605..b11517c 100644 --- a/package.json +++ b/package.json @@ -3,18 +3,21 @@ "private": true, "type": "module", "scripts": { - "prebuild": "node scripts/install-module-dependencies.mjs", "build": "vite build --config ./vite.config.js", "dev": "vite --config ./vite.config.js" }, "dependencies": { + "@fortawesome/fontawesome-free": "^7.0.0", "@laravel/passkeys": "^0.2.0", "@tailwindcss/vite": "^4.1.11", + "axios": "^1.13.2", "concurrently": "^10.0.3", + "flatpickr": "^4.6.13", + "jquery": "3.7.1", "laravel-vite-plugin": "^3.1", + "select2": "^4.1.0", "tailwindcss": "^4.0.7", - "vite": "^8.0.0", - "@fortawesome/fontawesome-free": "^7.0.0" + "vite": "^8.0.0" }, "optionalDependencies": { "@laravel/multiplex": "^0.4.1", diff --git a/vite.config.js b/vite.config.js index 7c63cef..4bafea7 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,11 +2,21 @@ import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; import { bunny } from 'laravel-vite-plugin/fonts'; import tailwindcss from '@tailwindcss/vite'; -import { existsSync, readdirSync, realpathSync, statSync } from 'node:fs'; +import { existsSync, readdirSync, statSync } from 'node:fs'; import { join, relative } from 'node:path'; const projectRoot = process.cwd(); +/** + * Compile assets from every Laravel module using the canonical module layout: + * + * Modules//Resources/assets/css/app.css + * Modules//Resources/assets/js/app.js + * + * Only the canonical `Resources` directory is scanned. This avoids duplicate + * entries on case-insensitive macOS filesystems where `Resources` and + * `resources` resolve to the same files. + */ function discoverModuleInputs() { const modulesPath = join(projectRoot, 'Modules'); @@ -15,7 +25,6 @@ function discoverModuleInputs() { } const inputs = []; - const physicalFiles = new Set(); for (const moduleName of readdirSync(modulesPath)) { const modulePath = join(modulesPath, moduleName); @@ -24,21 +33,13 @@ function discoverModuleInputs() { continue; } - for (const resourcesDirectory of ['Resources', 'resources']) { - for (const entry of ['assets/css/app.css', 'assets/js/app.js']) { - const candidate = join(modulePath, resourcesDirectory, entry); + for (const entry of [ + 'Resources/assets/css/app.css', + 'Resources/assets/js/app.js', + ]) { + const candidate = join(modulePath, entry); - if (!existsSync(candidate)) { - continue; - } - - const physicalPath = realpathSync(candidate); - - if (physicalFiles.has(physicalPath)) { - continue; - } - - physicalFiles.add(physicalPath); + if (existsSync(candidate)) { inputs.push(relative(projectRoot, candidate)); } } @@ -53,7 +54,7 @@ console.log('[Vite] Backend theme inputs:'); console.log(' resources/themes/backend/assets/css/app.css'); console.log(' resources/themes/backend/assets/js/passkeys.js'); -if (moduleInputs.length) { +if (moduleInputs.length > 0) { console.log('[Vite] Module inputs:'); for (const input of moduleInputs) { @@ -75,8 +76,6 @@ export default defineConfig({ 'resources/themes/backend/assets/**/*', 'Modules/*/Resources/views/**/*.blade.php', 'Modules/*/Resources/assets/**/*', - 'Modules/*/resources/views/**/*.blade.php', - 'Modules/*/resources/assets/**/*', 'Modules/**/*.php', ], @@ -93,6 +92,7 @@ export default defineConfig({ server: { cors: true, + watch: { ignored: [ '**/storage/framework/views/**',