Skip to content

Commit c53e5e8

Browse files
committed
feat: support force option when building node pckgs
1 parent a8293dc commit c53e5e8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/scripts/src/commands/build.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ export const runBuild = async (options: Options_Cli) => {
2626
: (options.packages as string[]);
2727

2828
if (pckgs.includes(PCKG.NODE)) {
29-
await buildNodePckgs(vmInfo, options.skipEnv);
29+
await buildNodePckgs(vmInfo, options);
3030
}
3131
if (pckgs.includes(PCKG.WEB)) {
3232
await buildWeb(vmInfo);
3333
}
3434
};
3535

36-
const buildNodePckgs = async (vmInfo: Info_VM, skipEnv?: boolean) => {
36+
const buildNodePckgs = async (vmInfo: Info_VM, options: Options_Cli) => {
3737
removeOldBuildFor(PCKG.NODE);
3838
createNodeDirs();
39-
await copyNodeConfigsToBuild(vmInfo, skipEnv);
39+
await copyNodeConfigsToBuild(vmInfo, options.skipEnv, options.force);
4040

4141
log.info("Compiling node packages ...");
4242
shell.exec(
@@ -82,7 +82,11 @@ const buildWeb = async (vmInfo: Info_VM) => {
8282
process.exit(0);
8383
};
8484

85-
const copyNodeConfigsToBuild = async (vmInfo: Info_VM, skipEnv?: boolean) => {
85+
const copyNodeConfigsToBuild = async (
86+
vmInfo: Info_VM,
87+
skipEnv?: boolean,
88+
force?: boolean
89+
) => {
8690
const envName = vmInfo.destination === "production" ? ".prod.env" : ".env";
8791

8892
const envPath = `${COMPASS_ROOT_DEV}/packages/backend/${envName}`;
@@ -96,7 +100,9 @@ const copyNodeConfigsToBuild = async (vmInfo: Info_VM, skipEnv?: boolean) => {
96100
log.warning(`Env file does not exist: ${envPath}`);
97101

98102
const keepGoing =
99-
skipEnv === true ? true : await _confirm("Continue anyway?");
103+
skipEnv === true || force === true
104+
? true
105+
: await _confirm("Continue anyway?");
100106

101107
if (!keepGoing) {
102108
log.error("Exiting due to missing env file");

0 commit comments

Comments
 (0)