Skip to content

Commit 33a0e61

Browse files
fix: allow --force to be optional (#33)
Still adds --force by default but adds a 'force' option that when set to false, disables adding the --force flag. Co-authored-by: Nathan Walker <[email protected]>
1 parent 9c58bed commit 33a0e61

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/nx/src/builders/build/builder.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ export function runBuilder(options: BuildBuilderSchema, context: ExecutorContext
164164
nsOptions.push('--env.replace');
165165
nsOptions.push(fileReplacements.join(','));
166166
}
167-
// always add --force for now since within Nx we use @nativescript/webpack at root only and the {N} cli shows a blocking error if not within the app
168-
nsOptions.push('--force');
167+
// always add --force (unless explicity set to false) for now since within Nx we use @nativescript/webpack at root only and the {N} cli shows a blocking error if not within the app
168+
if (options?.force !== false) {
169+
nsOptions.push('--force');
170+
}
169171
}
170172
// console.log('command:', [`ns`, ...nsOptions, ...additionalCliFlagArgs].join(' '));
171173
// console.log('command:', [`ns`, ...nsOptions].join(' '));

packages/nx/src/builders/build/schema.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface BuildBuilderSchema extends JsonObject {
1313
production?: boolean;
1414
platform?: 'ios' | 'android';
1515
copyTo?: string;
16+
force?: boolean;
1617
/** For running `ns prepare <platform>` */
1718
prepare:? boolean;
1819

packages/nx/src/builders/build/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
"type": "boolean",
9292
"default": false,
9393
"description": "Do a full project clean"
94+
},
95+
"force": {
96+
"type": "boolean",
97+
"default": true,
98+
"description": "If true, skips the application compatibility checks and forces npm i to ensure all dependencies are installed. Otherwise, the command will check the application compatibility with the current CLI version and could fail requiring ns migrate."
9499
}
95100
},
96101
"required": []

0 commit comments

Comments
 (0)