Skip to content

Commit

Permalink
fix: allow --force to be optional (#33)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rob4226 and NathanWalker authored Aug 25, 2021
1 parent 9c58bed commit 33a0e61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/nx/src/builders/build/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ export function runBuilder(options: BuildBuilderSchema, context: ExecutorContext
nsOptions.push('--env.replace');
nsOptions.push(fileReplacements.join(','));
}
// 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
nsOptions.push('--force');
// 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
if (options?.force !== false) {
nsOptions.push('--force');
}
}
// console.log('command:', [`ns`, ...nsOptions, ...additionalCliFlagArgs].join(' '));
// console.log('command:', [`ns`, ...nsOptions].join(' '));
Expand Down
1 change: 1 addition & 0 deletions packages/nx/src/builders/build/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface BuildBuilderSchema extends JsonObject {
production?: boolean;
platform?: 'ios' | 'android';
copyTo?: string;
force?: boolean;
/** For running `ns prepare <platform>` */
prepare:? boolean;

Expand Down
5 changes: 5 additions & 0 deletions packages/nx/src/builders/build/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
"type": "boolean",
"default": false,
"description": "Do a full project clean"
},
"force": {
"type": "boolean",
"default": true,
"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."
}
},
"required": []
Expand Down

0 comments on commit 33a0e61

Please sign in to comment.