Skip to content

fix(@angular/cli): remove deprecation warning of no prefixed schema options #23536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions packages/angular/cli/src/command-builder/command-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,12 @@ export abstract class CommandModule<T extends {} = {}> implements CommandModuleI
...(this.context.args.options.help ? { default: defaultVal } : {}),
};

// TODO(alanagius4): remove in a major version.
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
let dashedName = strings.dasherize(name);

// Handle options which have been defined in the schema with `no` prefix.
if (type === 'boolean' && dashedName.startsWith('no-')) {
dashedName = dashedName.slice(3);
booleanOptionsWithNoPrefix.add(dashedName);

// eslint-disable-next-line no-console
console.warn(
`Warning: '${name}' option has been declared with a 'no' prefix in the schema.` +
'Please file an issue with the author of this package.',
);
}

if (positional === undefined) {
Expand All @@ -258,8 +252,7 @@ export abstract class CommandModule<T extends {} = {}> implements CommandModuleI
}
}

// TODO(alanagius4): remove in a major version.
// the below is an interim workaround to handle options which have been defined in the schema with `no` prefix.
// Handle options which have been defined in the schema with `no` prefix.
if (booleanOptionsWithNoPrefix.size) {
localYargs.middleware((options: Arguments) => {
for (const key of booleanOptionsWithNoPrefix) {
Expand Down
6 changes: 0 additions & 6 deletions tests/legacy-cli/e2e/tests/misc/negated-boolean-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ export default async function () {
['generate', './schematic-boolean-option-negated:test', '--watch'],
/noWatch: false/,
);

await execAndWaitForOutputToMatch(
'ng',
['generate', './schematic-boolean-option-negated:test'],
/'noWatch' option has been declared with a 'no' prefix in the schema/,
);
}