fix: install deps if node_modules not found
This commit is contained in:
parent
56b85823ca
commit
c07c86e4fc
1 changed files with 20 additions and 7 deletions
|
|
@ -499,14 +499,27 @@ function run_build_command_for_apps(apps) {
|
||||||
|
|
||||||
let root_app_path = path.resolve(get_app_path(app), "..");
|
let root_app_path = path.resolve(get_app_path(app), "..");
|
||||||
let package_json = path.resolve(root_app_path, "package.json");
|
let package_json = path.resolve(root_app_path, "package.json");
|
||||||
if (fs.existsSync(package_json)) {
|
let node_modules = path.resolve(root_app_path, "node_modules");
|
||||||
let { scripts } = require(package_json);
|
|
||||||
if (scripts && scripts.build) {
|
if (!fs.existsSync(package_json)) {
|
||||||
log("\nRunning build command for", chalk.bold(app));
|
continue;
|
||||||
process.chdir(root_app_path);
|
|
||||||
execSync("yarn build", { encoding: "utf8", stdio: "inherit" });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let { scripts } = require(package_json);
|
||||||
|
if (!scripts?.build) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
process.chdir(root_app_path);
|
||||||
|
if (!fs.existsSync(node_modules)) {
|
||||||
|
log(
|
||||||
|
`\nInstalling dependencies for ${chalk.bold(app)} (because node_modules not found)`
|
||||||
|
);
|
||||||
|
execSync("yarn install", { encoding: "utf8", stdio: "inherit" });
|
||||||
|
}
|
||||||
|
|
||||||
|
log("\nRunning build command for", chalk.bold(app));
|
||||||
|
execSync("yarn build", { encoding: "utf8", stdio: "inherit" });
|
||||||
}
|
}
|
||||||
|
|
||||||
process.chdir(cwd);
|
process.chdir(cwd);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue