Skip to content

Commit

Permalink
feat(wb): make optimizeForDockerBuild remove unused root props and fi…
Browse files Browse the repository at this point in the history
…x '-m docker'
  • Loading branch information
exKAZUu committed Oct 8, 2023
1 parent d8bcee4 commit b41cd8b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/shared-lib-node/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function loadEnvironmentVariables(argv: Options, cwd: string, orgCwd?: st
}
envPaths = envPaths.map((envPath) => path.relative(cwd, envPath));
if (argv.verbose) {
console.info(`WB_ENV: ${process.env.WB_ENV}, NODE_ENV: ${process.env.NODE_ENV}`);
console.info('Loading env files:', envPaths);
}

Expand Down
8 changes: 8 additions & 0 deletions packages/wb/src/commands/optimizeForDockerBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const optimizeForDockerBuildCommand: CommandModule<unknown, InferredOptio

optimizeScripts(packageJson);

optimizeRootProps(packageJson);

if (argv.dryRun) continue;

const distDirPath = argv.outside
Expand Down Expand Up @@ -114,3 +116,9 @@ function optimizeScripts(packageJson: PackageJson): void {
}
}
}

function optimizeRootProps(packageJson: PackageJson): void {
delete packageJson.private;
delete packageJson.publishConfig;
delete packageJson.prettier;
}
2 changes: 1 addition & 1 deletion packages/wb/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const startCommand: CommandModule<unknown, InferredOptionTypes<typeof bui
break;
}
case 'docker': {
const prefix = configureEnvironmentVariables(argv, deps, 'docker');
const prefix = configureEnvironmentVariables(argv, deps, 'staging');
await runWithSpawn(`${prefix}${scripts.startDocker(argv)}`, argv);
break;
}
Expand Down

0 comments on commit b41cd8b

Please sign in to comment.