Skip to content

Commit

Permalink
fix: propagate extra arguments in build:multi script
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi authored and jometzner committed Aug 31, 2021
1 parent 725cfb8 commit 5ece62e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
19 changes: 10 additions & 9 deletions scripts/build-multi-pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ const configurations = (process.env.npm_config_active_themes || process.env.npm_

const builds = [];

if (process.argv.length === 2 || process.argv[2] === 'client')
const processArgs = process.argv.slice(2);
const extraArgs = processArgs.filter(a => a !== 'client' && a !== 'server').join(' ');

if (processArgs.includes('client') || !processArgs.includes('server'))
builds.push(
...configurations.map(
({ theme }) =>
`build client --configuration=${theme},production -- --output-path=dist/${theme}/browser --progress=false`
...configurations.map(({ theme }) =>
`build client --configuration=${theme},production -- --output-path=dist/${theme}/browser --progress=false ${extraArgs}`.trim()
)
);

if (process.argv.length === 2 || process.argv[2] === 'server')
if (processArgs.includes('server') || !processArgs.includes('client'))
builds.push(
...configurations.map(
({ theme }) =>
`build server --configuration=${theme},production -- --output-path=dist/${theme}/server --progress=false`
...configurations.map(({ theme }) =>
`build server --configuration=${theme},production -- --output-path=dist/${theme}/server --progress=false ${extraArgs}`.trim()
)
);

Expand All @@ -32,7 +33,7 @@ if (parallel) {

const result = cp.spawnSync(
path.join('node_modules', '.bin', 'npm-run-all' + (process.platform === 'win32' ? '.cmd' : '')),
[...parallel, ...builds],
['--silent', ...parallel, ...builds],
{
stdio: 'inherit',
}
Expand Down
8 changes: 4 additions & 4 deletions scripts/build-pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ if (configuration) {
configString = '-c ' + configuration;
}

const client = process.argv[2] !== 'server';
const server = process.argv[2] !== 'client';
const partial = (!client && server) || (client && !server);
const remainingArgs = process.argv.slice(partial ? 3 : 2);
const processArgs = process.argv.slice(2);
const client = processArgs.includes('client') || !processArgs.includes('server');
const server = processArgs.includes('server') || !processArgs.includes('client');
const remainingArgs = processArgs.filter(a => a !== 'client' && a !== 'server');

if (client) {
execSync(`npm run ng -- build ${configString} ${remainingArgs.join(' ')}`, {
Expand Down

0 comments on commit 5ece62e

Please sign in to comment.