settings updates, fixed
This commit is contained in:
+3
-3
@@ -3,9 +3,9 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"prebuild": "node scripts/install-module-dependencies.mjs",
|
||||||
"dev": "vite",
|
"build": "vite build --config ./vite.config.js",
|
||||||
"build:backend": "vite build --config ./vite.config.js"
|
"dev": "vite --config ./vite.config.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@laravel/passkeys": "^0.2.0",
|
"@laravel/passkeys": "^0.2.0",
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import {
|
||||||
|
existsSync,
|
||||||
|
readdirSync,
|
||||||
|
realpathSync,
|
||||||
|
statSync,
|
||||||
|
} from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
|
||||||
|
const modulesPath = join(process.cwd(), 'Modules');
|
||||||
|
|
||||||
|
if (!existsSync(modulesPath)) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const installed = new Set();
|
||||||
|
|
||||||
|
for (const moduleName of readdirSync(modulesPath)) {
|
||||||
|
const modulePath = join(modulesPath, moduleName);
|
||||||
|
|
||||||
|
if (!statSync(modulePath).isDirectory()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageJson = join(modulePath, 'package.json');
|
||||||
|
const packageLock = join(modulePath, 'package-lock.json');
|
||||||
|
|
||||||
|
if (!existsSync(packageJson) || !existsSync(packageLock)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const physicalModulePath = realpathSync(modulePath);
|
||||||
|
|
||||||
|
if (installed.has(physicalModulePath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
installed.add(physicalModulePath);
|
||||||
|
|
||||||
|
console.log(`[Modules] Installing npm dependencies for ${moduleName}...`);
|
||||||
|
|
||||||
|
const result = spawnSync(
|
||||||
|
'npm',
|
||||||
|
['ci', '--no-audit', '--no-fund'],
|
||||||
|
{
|
||||||
|
cwd: modulePath,
|
||||||
|
stdio: 'inherit',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.status !== 0) {
|
||||||
|
process.exit(result.status ?? 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-28
@@ -2,24 +2,11 @@ import { defineConfig } from 'vite';
|
|||||||
import laravel from 'laravel-vite-plugin';
|
import laravel from 'laravel-vite-plugin';
|
||||||
import { bunny } from 'laravel-vite-plugin/fonts';
|
import { bunny } from 'laravel-vite-plugin/fonts';
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
import { existsSync, readdirSync } from 'node:fs';
|
import { existsSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
||||||
import { join, relative } from 'node:path';
|
import { join, relative } from 'node:path';
|
||||||
|
|
||||||
const projectRoot = process.cwd();
|
const projectRoot = process.cwd();
|
||||||
|
|
||||||
/**
|
|
||||||
* Discover module CSS/JS entry points.
|
|
||||||
*
|
|
||||||
* Supported module layouts:
|
|
||||||
*
|
|
||||||
* Modules/Foo/Resources/assets/css/app.css
|
|
||||||
* Modules/Foo/Resources/assets/js/app.js
|
|
||||||
*
|
|
||||||
* and the lower-case equivalent:
|
|
||||||
*
|
|
||||||
* Modules/Foo/resources/assets/css/app.css
|
|
||||||
* Modules/Foo/resources/assets/js/app.js
|
|
||||||
*/
|
|
||||||
function discoverModuleInputs() {
|
function discoverModuleInputs() {
|
||||||
const modulesPath = join(projectRoot, 'Modules');
|
const modulesPath = join(projectRoot, 'Modules');
|
||||||
|
|
||||||
@@ -28,19 +15,30 @@ function discoverModuleInputs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const inputs = [];
|
const inputs = [];
|
||||||
|
const physicalFiles = new Set();
|
||||||
|
|
||||||
for (const moduleName of readdirSync(modulesPath)) {
|
for (const moduleName of readdirSync(modulesPath)) {
|
||||||
const modulePath = join(modulesPath, moduleName);
|
const modulePath = join(modulesPath, moduleName);
|
||||||
|
|
||||||
const candidates = [
|
if (!statSync(modulePath).isDirectory()) {
|
||||||
join(modulePath, 'Resources/assets/css/app.css'),
|
continue;
|
||||||
join(modulePath, 'Resources/assets/js/app.js'),
|
}
|
||||||
join(modulePath, 'resources/assets/css/app.css'),
|
|
||||||
join(modulePath, 'resources/assets/js/app.js'),
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const candidate of candidates) {
|
for (const resourcesDirectory of ['Resources', 'resources']) {
|
||||||
if (existsSync(candidate)) {
|
for (const entry of ['assets/css/app.css', 'assets/js/app.js']) {
|
||||||
|
const candidate = join(modulePath, resourcesDirectory, entry);
|
||||||
|
|
||||||
|
if (!existsSync(candidate)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const physicalPath = realpathSync(candidate);
|
||||||
|
|
||||||
|
if (physicalFiles.has(physicalPath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
physicalFiles.add(physicalPath);
|
||||||
inputs.push(relative(projectRoot, candidate));
|
inputs.push(relative(projectRoot, candidate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,14 +53,12 @@ console.log('[Vite] Backend theme inputs:');
|
|||||||
console.log(' resources/themes/backend/assets/css/app.css');
|
console.log(' resources/themes/backend/assets/css/app.css');
|
||||||
console.log(' resources/themes/backend/assets/js/passkeys.js');
|
console.log(' resources/themes/backend/assets/js/passkeys.js');
|
||||||
|
|
||||||
if (moduleInputs.length > 0) {
|
if (moduleInputs.length) {
|
||||||
console.log('[Vite] Module inputs:');
|
console.log('[Vite] Module inputs:');
|
||||||
|
|
||||||
for (const input of moduleInputs) {
|
for (const input of moduleInputs) {
|
||||||
console.log(` ${input}`);
|
console.log(` ${input}`);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log('[Vite] No module asset entry points discovered.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -77,18 +73,17 @@ export default defineConfig({
|
|||||||
refresh: [
|
refresh: [
|
||||||
'resources/themes/backend/views/**/*.blade.php',
|
'resources/themes/backend/views/**/*.blade.php',
|
||||||
'resources/themes/backend/assets/**/*',
|
'resources/themes/backend/assets/**/*',
|
||||||
|
|
||||||
'Modules/*/Resources/views/**/*.blade.php',
|
'Modules/*/Resources/views/**/*.blade.php',
|
||||||
'Modules/*/Resources/assets/**/*',
|
'Modules/*/Resources/assets/**/*',
|
||||||
'Modules/*/resources/views/**/*.blade.php',
|
'Modules/*/resources/views/**/*.blade.php',
|
||||||
'Modules/*/resources/assets/**/*',
|
'Modules/*/resources/assets/**/*',
|
||||||
|
|
||||||
'Modules/**/*.php',
|
'Modules/**/*.php',
|
||||||
],
|
],
|
||||||
|
|
||||||
fonts: [
|
fonts: [
|
||||||
bunny('Instrument Sans', {
|
bunny('Instrument Sans', {
|
||||||
weights: [400, 500, 600],
|
weights: [400, 500, 600],
|
||||||
|
optimizedFallbacks: false,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@@ -98,7 +93,6 @@ export default defineConfig({
|
|||||||
|
|
||||||
server: {
|
server: {
|
||||||
cors: true,
|
cors: true,
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
ignored: [
|
ignored: [
|
||||||
'**/storage/framework/views/**',
|
'**/storage/framework/views/**',
|
||||||
|
|||||||
Reference in New Issue
Block a user