Skip to content

Commit

Permalink
cleanup(angular): add warning to schematic usage of generators (#15815)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 authored Mar 22, 2023
1 parent 4dbe6a5 commit 44478fb
Show file tree
Hide file tree
Showing 27 changed files with 85 additions and 26 deletions.
3 changes: 2 additions & 1 deletion packages/angular/src/generators/add-linting/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { addLintingGenerator } from './add-linting';

export default convertNxGenerator(addLintingGenerator);
export default warnForSchematicUsage(convertNxGenerator(addLintingGenerator));
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import application from './application';

export const applicationSchematic = convertNxGenerator(application);
export const applicationSchematic = warnForSchematicUsage(
convertNxGenerator(application)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentCypressSpecGenerator } from './component-cypress-spec';

export default convertNxGenerator(componentCypressSpecGenerator);
export default warnForSchematicUsage(
convertNxGenerator(componentCypressSpecGenerator)
);
5 changes: 4 additions & 1 deletion packages/angular/src/generators/component-story/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentStoryGenerator } from './component-story';

export default convertNxGenerator(componentStoryGenerator);
export default warnForSchematicUsage(
convertNxGenerator(componentStoryGenerator)
);
5 changes: 4 additions & 1 deletion packages/angular/src/generators/component-test/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentTestGenerator } from './component-test';

export default convertNxGenerator(componentTestGenerator);
export default warnForSchematicUsage(
convertNxGenerator(componentTestGenerator)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import componentGenerator from './component';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nrwl/devkit';

export default convertNxGenerator(componentGenerator);
export default warnForSchematicUsage(convertNxGenerator(componentGenerator));
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import convertToWithMF from './convert-to-with-mf';

export default convertNxGenerator(convertToWithMF);
export default warnForSchematicUsage(convertNxGenerator(convertToWithMF));
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
logger,
Tree,
} from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { ConvertTSLintToESLintSchema, ProjectConverter } from '@nrwl/linter';
import type { Linter } from 'eslint';
import { addLintingGenerator } from '../add-linting/add-linting';
Expand Down Expand Up @@ -137,7 +138,9 @@ export async function conversionGenerator(
};
}

export const conversionSchematic = convertNxGenerator(conversionGenerator);
export const conversionSchematic = warnForSchematicUsage(
convertNxGenerator(conversionGenerator)
);

/**
* In the case of Angular lint rules, we need to apply them to correct override depending upon whether
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { cypressComponentConfiguration } from './cypress-component-configuration';

export default convertNxGenerator(cypressComponentConfiguration);
export default warnForSchematicUsage(
convertNxGenerator(cypressComponentConfiguration)
);
3 changes: 2 additions & 1 deletion packages/angular/src/generators/host/host.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import host from './host';

export default convertNxGenerator(host);
export default warnForSchematicUsage(convertNxGenerator(host));
5 changes: 4 additions & 1 deletion packages/angular/src/generators/init/init.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { angularInitGenerator } from './init';

export const initSchematic = convertNxGenerator(angularInitGenerator);
export const initSchematic = warnForSchematicUsage(
convertNxGenerator(angularInitGenerator)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { librarySecondaryEntryPointGenerator } from './library-secondary-entry-point';

export default convertNxGenerator(librarySecondaryEntryPointGenerator);
export default warnForSchematicUsage(
convertNxGenerator(librarySecondaryEntryPointGenerator)
);
5 changes: 4 additions & 1 deletion packages/angular/src/generators/library/library.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import library from './library';

export const librarySchematic = convertNxGenerator(library);
export const librarySchematic = warnForSchematicUsage(
convertNxGenerator(library)
);
5 changes: 4 additions & 1 deletion packages/angular/src/generators/move/move.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator, formatFiles, Tree } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { moveGenerator } from '@nrwl/workspace/generators';
import { updateModuleName } from './lib/update-module-name';
import { updateNgPackage } from './lib/update-ng-package';
Expand All @@ -24,4 +25,6 @@ export async function angularMoveGenerator(
}
}

export const angularMoveSchematic = convertNxGenerator(angularMoveGenerator);
export const angularMoveSchematic = warnForSchematicUsage(
convertNxGenerator(angularMoveGenerator)
);
3 changes: 2 additions & 1 deletion packages/angular/src/generators/ngrx/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { ngrxGenerator } from './ngrx';

export default convertNxGenerator(ngrxGenerator);
export default warnForSchematicUsage(convertNxGenerator(ngrxGenerator));
3 changes: 2 additions & 1 deletion packages/angular/src/generators/remote/remote.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import remote from './remote';

export default convertNxGenerator(remote);
export default warnForSchematicUsage(convertNxGenerator(remote));
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import scamGenerator from './scam-directive';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nrwl/devkit';

export default convertNxGenerator(scamGenerator);
export default warnForSchematicUsage(convertNxGenerator(scamGenerator));
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import scamPipeGenerator from './scam-pipe';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nrwl/devkit';

export default convertNxGenerator(scamPipeGenerator);
export default warnForSchematicUsage(convertNxGenerator(scamPipeGenerator));
3 changes: 2 additions & 1 deletion packages/angular/src/generators/scam-to-standalone/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { scamToStandalone } from './scam-to-standalone';

export default convertNxGenerator(scamToStandalone);
export default warnForSchematicUsage(convertNxGenerator(scamToStandalone));
3 changes: 2 additions & 1 deletion packages/angular/src/generators/scam/scam.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import scamGenerator from './scam';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nrwl/devkit';

export default convertNxGenerator(scamGenerator);
export default warnForSchematicUsage(convertNxGenerator(scamGenerator));
3 changes: 2 additions & 1 deletion packages/angular/src/generators/setup-mf/setup-mf.compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupMf } from './setup-mf';

export default convertNxGenerator(setupMf);
export default warnForSchematicUsage(convertNxGenerator(setupMf));
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupSsr } from './setup-ssr';

export default convertNxGenerator(setupSsr);
export default warnForSchematicUsage(convertNxGenerator(setupSsr));
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupTailwindGenerator } from './setup-tailwind';

export default convertNxGenerator(setupTailwindGenerator);
export default warnForSchematicUsage(
convertNxGenerator(setupTailwindGenerator)
);
5 changes: 4 additions & 1 deletion packages/angular/src/generators/stories/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { angularStoriesGenerator } from './stories';

export default convertNxGenerator(angularStoriesGenerator);
export default warnForSchematicUsage(
convertNxGenerator(angularStoriesGenerator)
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { storybookConfigurationGenerator } from './storybook-configuration';

export default convertNxGenerator(storybookConfigurationGenerator);
export default warnForSchematicUsage(
convertNxGenerator(storybookConfigurationGenerator)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function warnForSchematicUsage<T>(convertedGenerator: T): T {
console.warn(
'Running generators as schematics is deprecated and will be removed in v17.'
);

return convertedGenerator;
}
3 changes: 2 additions & 1 deletion packages/angular/src/generators/web-worker/compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { convertNxGenerator } from '@nrwl/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { webWorkerGenerator } from './web-worker';

export default convertNxGenerator(webWorkerGenerator);
export default warnForSchematicUsage(convertNxGenerator(webWorkerGenerator));

0 comments on commit 44478fb

Please sign in to comment.