Skip to content

Commit

Permalink
feat: support force option when building node pckgs
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-dane committed Dec 29, 2024
1 parent a8293dc commit c53e5e8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/scripts/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ export const runBuild = async (options: Options_Cli) => {
: (options.packages as string[]);

if (pckgs.includes(PCKG.NODE)) {
await buildNodePckgs(vmInfo, options.skipEnv);
await buildNodePckgs(vmInfo, options);
}
if (pckgs.includes(PCKG.WEB)) {
await buildWeb(vmInfo);
}
};

const buildNodePckgs = async (vmInfo: Info_VM, skipEnv?: boolean) => {
const buildNodePckgs = async (vmInfo: Info_VM, options: Options_Cli) => {
removeOldBuildFor(PCKG.NODE);
createNodeDirs();
await copyNodeConfigsToBuild(vmInfo, skipEnv);
await copyNodeConfigsToBuild(vmInfo, options.skipEnv, options.force);

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

const copyNodeConfigsToBuild = async (vmInfo: Info_VM, skipEnv?: boolean) => {
const copyNodeConfigsToBuild = async (
vmInfo: Info_VM,
skipEnv?: boolean,
force?: boolean
) => {
const envName = vmInfo.destination === "production" ? ".prod.env" : ".env";

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

const keepGoing =
skipEnv === true ? true : await _confirm("Continue anyway?");
skipEnv === true || force === true
? true
: await _confirm("Continue anyway?");

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

0 comments on commit c53e5e8

Please sign in to comment.