Skip to content

Commit b779759

Browse files
committed
fix: enforce some options as singular only
1 parent 44d277d commit b779759

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/nx/src/executors/build/executor.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
162162
}
163163
}
164164

165+
// some options should never be duplicated
166+
const enforceSingularOptions = ['provision', 'device', 'copy-to'];
167+
const parseOptionName = (flag: string) => {
168+
// strip just the option name from extra arguments
169+
// --provision='match AppStore my.bundle.com' > provision
170+
return flag.split('=')[0].replace('--', '');
171+
};
165172
// additional cli flags
166173
// console.log('projectTargetCmdIndex:', projectTargetCmdIndex)
167174
const additionalArgs = [];
@@ -173,7 +180,8 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
173180
// manually added flags to the execution command
174181
const extraFlags = process.argv.slice(projectTargetCmdIndex + 1, process.argv.length);
175182
for (const flag of extraFlags) {
176-
if (!nsOptions.includes(flag) && !additionalArgs.includes(flag)) {
183+
const optionName = parseOptionName(flag);
184+
if (!nsOptions.includes(flag) && !additionalArgs.includes(flag) && !enforceSingularOptions.includes(optionName)) {
177185
additionalArgs.push(flag);
178186
}
179187
}
@@ -186,7 +194,6 @@ export default async function runExecutor(options: BuildBuilderSchema, context:
186194
console.log(' ');
187195
console.log([`ns`, ...nsOptions, ...additionalArgs].join(' '));
188196
console.log(' ');
189-
// console.log('command:', [`ns`, ...nsOptions].join(' '));
190197
const child = childProcess.spawn(/^win/.test(process.platform) ? 'ns.cmd' : 'ns', [...nsOptions, ...additionalArgs], {
191198
cwd: projectCwd,
192199
stdio: 'inherit',

0 commit comments

Comments
 (0)