working ticket now with global vite builer
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
const modulesDir = path.resolve('Modules');
|
||||
|
||||
for (const moduleName of fs.readdirSync(modulesDir)) {
|
||||
|
||||
const modulePath = path.join(modulesDir, moduleName);
|
||||
|
||||
if (!fs.statSync(modulePath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const packageJson = path.join(modulePath, 'package.json');
|
||||
const viteConfig = path.join(modulePath, 'vite.config.js');
|
||||
|
||||
if (!fs.existsSync(packageJson) || !fs.existsSync(viteConfig)) {
|
||||
console.log(`Skipping ${moduleName}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`Building ${moduleName}`);
|
||||
|
||||
try {
|
||||
execSync(
|
||||
'npm run build',
|
||||
{
|
||||
cwd: modulePath,
|
||||
stdio: 'inherit',
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(`Failed building ${moduleName}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user