diff --git a/packages/nx/src/builders/build/builder.ts b/packages/nx/src/builders/build/builder.ts index cbfb19834..463960b48 100644 --- a/packages/nx/src/builders/build/builder.ts +++ b/packages/nx/src/builders/build/builder.ts @@ -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(' ')); diff --git a/packages/nx/src/builders/build/schema.d.ts b/packages/nx/src/builders/build/schema.d.ts index fbe18ce3c..18d843645 100644 --- a/packages/nx/src/builders/build/schema.d.ts +++ b/packages/nx/src/builders/build/schema.d.ts @@ -13,6 +13,7 @@ export interface BuildBuilderSchema extends JsonObject { production?: boolean; platform?: 'ios' | 'android'; copyTo?: string; + force?: boolean; /** For running `ns prepare ` */ prepare:? boolean; diff --git a/packages/nx/src/builders/build/schema.json b/packages/nx/src/builders/build/schema.json index 43d254294..dc4e46b5e 100644 --- a/packages/nx/src/builders/build/schema.json +++ b/packages/nx/src/builders/build/schema.json @@ -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": []