feat(misc): remove deprecated Angular CLI usage of schematics and builders (#19557)

This commit is contained in:
Colum Ferry 2023-10-13 17:14:16 +01:00 committed by GitHub
parent 5a6adb717c
commit 80fde79374
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
252 changed files with 76 additions and 1975 deletions

View File

@ -9,5 +9,4 @@
### Functions ### Functions
- [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting) - [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting)
- [overrideCollectionResolutionForTesting](../../devkit/documents/ngcli_adapter/overrideCollectionResolutionForTesting)
- [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic) - [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic)

View File

@ -1,32 +0,0 @@
# Function: overrideCollectionResolutionForTesting
**overrideCollectionResolutionForTesting**(`collections`): `void`
By default, Angular Devkit schematic collections will be resolved using the Node resolution.
This doesn't work if you are testing schematics that refer to other schematics in the
same repo.
This function can can be used to override the resolution behaviour.
Example:
```typescript
overrideCollectionResolutionForTesting({
'@nx/workspace': path.join(
__dirname,
'../../../../workspace/generators.json'
),
'@nx/angular': path.join(__dirname, '../../../../angular/generators.json'),
'@nx/linter': path.join(__dirname, '../../../../linter/generators.json'),
});
```
#### Parameters
| Name | Type |
| :------------ | :------- |
| `collections` | `Object` |
#### Returns
`void`

View File

@ -9,5 +9,4 @@
### Functions ### Functions
- [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting) - [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting)
- [overrideCollectionResolutionForTesting](../../devkit/documents/ngcli_adapter/overrideCollectionResolutionForTesting)
- [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic) - [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic)

View File

@ -68,6 +68,8 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
// TODO: solve issues with pnpm and remove this fallback // TODO: solve issues with pnpm and remove this fallback
packageManager = packageManager === 'pnpm' ? 'yarn' : packageManager; packageManager = packageManager === 'pnpm' ? 'yarn' : packageManager;
project = runNgNew(packageManager); project = runNgNew(packageManager);
packageInstall('nx', null, 'latest');
packageInstall('@nx/angular', null, 'latest');
}); });
afterEach(() => { afterEach(() => {
@ -105,7 +107,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
expect(packageJson.devDependencies['@nx/workspace']).not.toBeDefined(); expect(packageJson.devDependencies['@nx/workspace']).not.toBeDefined();
// run ng add // run ng add
runNgAdd('@nx/angular', '--npm-scope projscope --default-base main'); runCLI('g @nx/angular:ng-add --npm-scope projscope --default-base main');
// check that prettier config exits and that files have been moved // check that prettier config exits and that files have been moved
checkFilesExist( checkFilesExist(
@ -262,7 +264,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
it('should handle a workspace with cypress v9', () => { it('should handle a workspace with cypress v9', () => {
addCypress9(); addCypress9();
runNgAdd('@nx/angular', '--npm-scope projscope --skip-install'); runCLI('g @nx/angular:ng-add --npm-scope projscope --skip-install');
const e2eProject = `${project}-e2e`; const e2eProject = `${project}-e2e`;
//check e2e project files //check e2e project files
@ -329,7 +331,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
it('should handle a workspace with cypress v10', () => { it('should handle a workspace with cypress v10', () => {
addCypress10(); addCypress10();
runNgAdd('@nx/angular', '--npm-scope projscope --skip-install'); runCLI('g @nx/angular:ng-add --npm-scope projscope --skip-install');
const e2eProject = `${project}-e2e`; const e2eProject = `${project}-e2e`;
//check e2e project files //check e2e project files
@ -399,7 +401,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
it.skip('should handle a workspace with ESLint', () => { it.skip('should handle a workspace with ESLint', () => {
addEsLint(); addEsLint();
runNgAdd('@nx/angular', '--npm-scope projscope'); runCLI('g @nx/angular:ng-add --npm-scope projscope');
checkFilesExist(`apps/${project}/.eslintrc.json`, `.eslintrc.json`); checkFilesExist(`apps/${project}/.eslintrc.json`, `.eslintrc.json`);
@ -436,7 +438,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
runCommand(`ng g @schematics/angular:application ${app1} --no-interactive`); runCommand(`ng g @schematics/angular:application ${app1} --no-interactive`);
runCommand(`ng g @schematics/angular:library ${lib1} --no-interactive`); runCommand(`ng g @schematics/angular:library ${lib1} --no-interactive`);
runNgAdd('@nx/angular', '--npm-scope projscope'); runCLI('g @nx/angular:ng-add --npm-scope projscope');
// check angular.json does not exist // check angular.json does not exist
checkFilesDoNotExist('angular.json'); checkFilesDoNotExist('angular.json');

View File

@ -22,21 +22,6 @@
} }
}, },
"builders": { "builders": {
"delegate-build": {
"implementation": "./src/executors/delegate-build/compat",
"schema": "./src/executors/delegate-build/schema.json",
"description": "Delegates the build to a different target while supporting incremental builds."
},
"ng-packagr-lite": {
"implementation": "./src/executors/ng-packagr-lite/compat",
"schema": "./src/executors/ng-packagr-lite/schema.json",
"description": "Builds a library with support for incremental builds.\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nrwl/angular:package` executor but with some key differences:\n- It doesn't run `ngcc` automatically (`ngcc` needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`)\n- It only produces ESM2020 bundles\n- It doesn't generate package exports in the `package.json`"
},
"package": {
"implementation": "./src/executors/package/compat",
"schema": "./src/executors/package/schema.json",
"description": "Builds and packages an Angular library to be distributed as an NPM package. It supports incremental builds."
},
"webpack-browser": { "webpack-browser": {
"implementation": "./src/builders/webpack-browser/webpack-browser.impl", "implementation": "./src/builders/webpack-browser/webpack-browser.impl",
"schema": "./src/builders/webpack-browser/schema.json", "schema": "./src/builders/webpack-browser/schema.json",
@ -61,11 +46,6 @@
"implementation": "./src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl", "implementation": "./src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl",
"schema": "./src/builders/module-federation-dev-ssr/schema.json", "schema": "./src/builders/module-federation-dev-ssr/schema.json",
"description": "The module-federation-dev-ssr executor is reserved exclusively for use with host Module Federation applications that use SSR. It allows the user to specify which remote applications should be served with the host." "description": "The module-federation-dev-ssr executor is reserved exclusively for use with host Module Federation applications that use SSR. It allows the user to specify which remote applications should be served with the host."
},
"browser-esbuild": {
"implementation": "./src/executors/browser-esbuild/compat",
"schema": "./src/executors/browser-esbuild/schema.json",
"description": "Builds your application with esbuild and adds support for incremental builds."
} }
} }
} }

View File

@ -2,160 +2,6 @@
"name": "Nx Angular", "name": "Nx Angular",
"version": "0.1", "version": "0.1",
"extends": ["@schematics/angular", "@nx/workspace"], "extends": ["@schematics/angular", "@nx/workspace"],
"schematics": {
"add-linting": {
"factory": "./src/generators/add-linting/compat",
"schema": "./src/generators/add-linting/schema.json",
"description": "Adds linting configuration to an Angular project.",
"hidden": true
},
"application": {
"factory": "./src/generators/application/application.compat#applicationSchematic",
"schema": "./src/generators/application/schema.json",
"aliases": ["app"],
"x-type": "application",
"description": "Creates an Angular application."
},
"component": {
"factory": "./src/generators/component/component.compat",
"schema": "./src/generators/component/schema.json",
"aliases": ["c"],
"description": "Generate an Angular Component."
},
"component-cypress-spec": {
"factory": "./src/generators/component-cypress-spec/compat",
"schema": "./src/generators/component-cypress-spec/schema.json",
"description": "Creates a Cypress spec for a UI component that has a story.",
"hidden": true
},
"component-story": {
"factory": "./src/generators/component-story/compat",
"schema": "./src/generators/component-story/schema.json",
"description": "Creates a `stories.ts` file for a component.",
"hidden": true
},
"component-test": {
"factory": "./src/generators/component-test/compat",
"schema": "./src/generators/component-test/schema.json",
"description": "Creates a cypress component test file for a component."
},
"init": {
"factory": "./src/generators/init/init.compat#initSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initializes the `@nrwl/angular` plugin.",
"hidden": true
},
"library": {
"factory": "./src/generators/library/library.compat#librarySchematic",
"schema": "./src/generators/library/schema.json",
"aliases": ["lib"],
"x-type": "library",
"description": "Creates an Angular library."
},
"library-secondary-entry-point": {
"factory": "./src/generators/library-secondary-entry-point/compat",
"schema": "./src/generators/library-secondary-entry-point/schema.json",
"aliases": ["secondary-entry-point", "entry-point"],
"description": "Creates a secondary entry point for an Angular publishable library."
},
"remote": {
"factory": "./src/generators/remote/remote.compat",
"schema": "./src/generators/remote/schema.json",
"x-type": "application",
"description": "Generate a Remote Angular Module Federation Application."
},
"move": {
"factory": "./src/generators/move/compat",
"schema": "./src/generators/move/schema.json",
"aliases": ["mv"],
"description": "Moves an Angular application or library to another folder within the workspace and updates the project configuration.",
"x-deprecated": "Use the `@nx/workspace:move` generator instead. This generator will be removed in Nx v18."
},
"convert-to-with-mf": {
"factory": "./src/generators/convert-to-with-mf/convert-to-with-mf.compat",
"schema": "./src/generators/convert-to-with-mf/schema.json",
"description": "Converts an old micro frontend configuration to use the new `withModuleFederation` helper. It will run successfully if the following conditions are met: \n - Is either a host or remote application \n - Shared npm package configurations have not been modified \n - Name used to identify the Micro Frontend application matches the project name \n\n{% callout type=\"warning\" title=\"Overrides\" %}This generator will overwrite your webpack config. If you have additional custom configuration in your config file, it will be lost!{% /callout %}"
},
"federate-module": {
"factory": "./src/generators/federate-module/federate-module.compat",
"schema": "./src/generators/federate-module/schema.json",
"x-type": "application",
"description": "Create a federated module, which is exposed by a remote and can be subsequently loaded by a host."
},
"host": {
"factory": "./src/generators/host/host.compat",
"schema": "./src/generators/host/schema.json",
"x-type": "application",
"description": "Generate a Host Angular Module Federation Application."
},
"ng-add": {
"factory": "./src/generators/ng-add/compat",
"schema": "./src/generators/ng-add/schema.json",
"description": "Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace.",
"hidden": true
},
"ngrx": {
"factory": "./src/generators/ngrx/compat",
"schema": "./src/generators/ngrx/schema.json",
"description": "Adds NgRx support to an application or library.",
"x-deprecated": "This generator is deprecated and will be removed in a future version of Nx. Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead."
},
"scam-to-standalone": {
"factory": "./src/generators/scam-to-standalone/compat",
"schema": "./src/generators/scam-to-standalone/schema.json",
"description": "Convert an existing Single Component Angular Module (SCAM) to a Standalone Component."
},
"scam": {
"factory": "./src/generators/scam/scam.compat",
"schema": "./src/generators/scam/schema.json",
"description": "Generate a component with an accompanying Single Component Angular Module (SCAM)."
},
"scam-directive": {
"factory": "./src/generators/scam-directive/scam-directive.compat",
"schema": "./src/generators/scam-directive/schema.json",
"description": "Generate a directive with an accompanying Single Component Angular Module (SCAM)."
},
"scam-pipe": {
"factory": "./src/generators/scam-pipe/scam-pipe.compat",
"schema": "./src/generators/scam-pipe/schema.json",
"description": "Generate a pipe with an accompanying Single Component Angular Module (SCAM)."
},
"setup-mf": {
"factory": "./src/generators/setup-mf/setup-mf.compat",
"schema": "./src/generators/setup-mf/schema.json",
"description": "Generate a Module Federation configuration for a given Angular application."
},
"setup-ssr": {
"factory": "./src/generators/setup-ssr/setup-ssr.compat",
"schema": "./src/generators/setup-ssr/schema.json",
"description": "Generate Angular Universal (SSR) setup for an Angular application."
},
"setup-tailwind": {
"factory": "./src/generators/setup-tailwind/setup-tailwind.compat",
"schema": "./src/generators/setup-tailwind/schema.json",
"description": "Configures Tailwind CSS for an application or a buildable/publishable library."
},
"stories": {
"factory": "./src/generators/stories/compat",
"schema": "./src/generators/stories/schema.json",
"description": "Creates stories/specs for all components declared in a project."
},
"storybook-configuration": {
"factory": "./src/generators/storybook-configuration/compat",
"schema": "./src/generators/storybook-configuration/schema.json",
"description": "Adds Storybook configuration to a project."
},
"cypress-component-configuration": {
"factory": "./src/generators/cypress-component-configuration/compat",
"schema": "./src/generators/cypress-component-configuration/schema.json",
"description": "Setup Cypress component testing for a project."
},
"web-worker": {
"factory": "./src/generators/web-worker/compat",
"schema": "./src/generators/web-worker/schema.json",
"description": "Creates a Web Worker."
}
},
"generators": { "generators": {
"add-linting": { "add-linting": {
"factory": "./src/generators/add-linting/add-linting", "factory": "./src/generators/add-linting/add-linting",

View File

@ -39,8 +39,8 @@
"url": "https://github.com/nrwl/nx/issues" "url": "https://github.com/nrwl/nx/issues"
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"builders": "./executors.json", "executors": "./executors.json",
"schematics": "./generators.json", "generators": "./generators.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import nxBrowserEsBuild from './browser-esbuild.impl';
export default convertNxExecutor(nxBrowserEsBuild);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { delegateBuildExecutor } from './delegate-build.impl';
export default convertNxExecutor(delegateBuildExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { ngPackagrLiteExecutor } from './ng-packagr-lite.impl';
export default convertNxExecutor(ngPackagrLiteExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { packageExecutor } from './package.impl';
export default convertNxExecutor(packageExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { addLintingGenerator } from './add-linting';
export default warnForSchematicUsage(convertNxGenerator(addLintingGenerator));

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import application from './application';
export const applicationSchematic = warnForSchematicUsage(
convertNxGenerator(application)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentCypressSpecGenerator } from './component-cypress-spec';
export default warnForSchematicUsage(
convertNxGenerator(componentCypressSpecGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentStoryGenerator } from './component-story';
export default warnForSchematicUsage(
convertNxGenerator(componentStoryGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentTestGenerator } from './component-test';
export default warnForSchematicUsage(
convertNxGenerator(componentTestGenerator)
);

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { componentGenerator } from './component';
export default warnForSchematicUsage(convertNxGenerator(componentGenerator));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import convertToWithMF from './convert-to-with-mf';
export default warnForSchematicUsage(convertNxGenerator(convertToWithMF));

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { cypressComponentConfiguration } from './cypress-component-configuration';
export default warnForSchematicUsage(
convertNxGenerator(cypressComponentConfiguration)
);

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import federateModule from './federate-module';
export default warnForSchematicUsage(convertNxGenerator(federateModule));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import host from './host';
export default warnForSchematicUsage(convertNxGenerator(host));

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { angularInitGenerator } from './init';
export const initSchematic = warnForSchematicUsage(
convertNxGenerator(angularInitGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { librarySecondaryEntryPointGenerator } from './library-secondary-entry-point';
export default warnForSchematicUsage(
convertNxGenerator(librarySecondaryEntryPointGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import library from './library';
export const librarySchematic = warnForSchematicUsage(
convertNxGenerator(library)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { angularMoveGenerator } from './move';
export const angularMoveSchematic = warnForSchematicUsage(
convertNxGenerator(angularMoveGenerator)
);

View File

@ -1,4 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { ngAddGenerator } from './ng-add';
export default convertNxGenerator(ngAddGenerator, true);

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { ngrxGenerator } from './ngrx';
export default warnForSchematicUsage(convertNxGenerator(ngrxGenerator));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import remote from './remote';
export default warnForSchematicUsage(convertNxGenerator(remote));

View File

@ -1,5 +0,0 @@
import scamGenerator from './scam-directive';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nx/devkit';
export default warnForSchematicUsage(convertNxGenerator(scamGenerator));

View File

@ -1,5 +0,0 @@
import scamPipeGenerator from './scam-pipe';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nx/devkit';
export default warnForSchematicUsage(convertNxGenerator(scamPipeGenerator));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { scamToStandalone } from './scam-to-standalone';
export default warnForSchematicUsage(convertNxGenerator(scamToStandalone));

View File

@ -1,5 +0,0 @@
import scamGenerator from './scam';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { convertNxGenerator } from '@nx/devkit';
export default warnForSchematicUsage(convertNxGenerator(scamGenerator));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupMf } from './setup-mf';
export default warnForSchematicUsage(convertNxGenerator(setupMf));

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupSsr } from './setup-ssr';
export default warnForSchematicUsage(convertNxGenerator(setupSsr));

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { setupTailwindGenerator } from './setup-tailwind';
export default warnForSchematicUsage(
convertNxGenerator(setupTailwindGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { angularStoriesGenerator } from './stories';
export default warnForSchematicUsage(
convertNxGenerator(angularStoriesGenerator)
);

View File

@ -1,7 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { storybookConfigurationGenerator } from './storybook-configuration';
export default warnForSchematicUsage(
convertNxGenerator(storybookConfigurationGenerator)
);

View File

@ -1,15 +1,15 @@
import { joinPathFragments, Tree, writeJson } from '@nx/devkit'; import { joinPathFragments, Tree, writeJson } from '@nx/devkit';
import {
overrideCollectionResolutionForTesting,
wrapAngularDevkitSchematic,
} from '@nx/devkit/ngcli-adapter';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import { import {
findStorybookAndBuildTargetsAndCompiler, findStorybookAndBuildTargetsAndCompiler,
isTheFileAStory, isTheFileAStory,
} from './utilities'; } from '@nx/storybook/src/utils/utilities';
import { nxVersion, storybookVersion } from './versions'; import { nxVersion, storybookVersion } from '@nx/storybook/src/utils/versions';
import * as targetVariations from './test-configs/different-target-variations.json'; import * as targetVariations from '@nx/storybook/src/utils/test-configs/different-target-variations.json';
import libraryGenerator from '../library/library';
import componentGenerator from '../component/component';
import storybookConfigurationGenerator from '../storybook-configuration/storybook-configuration';
import { Linter } from '@nx/linter';
// nested code imports graph from the repo, which might have innacurate graph version // nested code imports graph from the repo, which might have innacurate graph version
jest.mock('nx/src/project-graph/project-graph', () => ({ jest.mock('nx/src/project-graph/project-graph', () => ({
@ -19,38 +19,18 @@ jest.mock('nx/src/project-graph/project-graph', () => ({
.mockImplementation(async () => ({ nodes: {}, dependencies: {} })), .mockImplementation(async () => ({ nodes: {}, dependencies: {} })),
})); }));
const componentSchematic = wrapAngularDevkitSchematic(
'@schematics/angular',
'component'
);
const runAngularLibrarySchematic = wrapAngularDevkitSchematic(
'@schematics/angular',
'library'
);
const runAngularStorybookSchematic = wrapAngularDevkitSchematic(
'@nx/angular',
'storybook-configuration'
);
describe('testing utilities', () => { describe('testing utilities', () => {
describe('Test functions that need workspace tree', () => { describe('Test functions that need workspace tree', () => {
let appTree: Tree; let appTree: Tree;
beforeEach(async () => { beforeEach(async () => {
overrideCollectionResolutionForTesting({
'@nx/storybook': joinPathFragments(
__dirname,
'../../../../generators.json'
),
});
appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
await runAngularLibrarySchematic(appTree, { await libraryGenerator(appTree, {
name: 'test-ui-lib', name: 'test-ui-lib',
}); });
await componentSchematic(appTree, { await componentGenerator(appTree, {
name: 'button', name: 'button',
project: 'test-ui-lib', project: 'test-ui-lib',
}); });
@ -64,10 +44,12 @@ describe('testing utilities', () => {
}); });
writeJson(appTree, 'test-ui-lib/tsconfig.json', {}); writeJson(appTree, 'test-ui-lib/tsconfig.json', {});
await runAngularStorybookSchematic(appTree, { await storybookConfigurationGenerator(appTree, {
name: 'test-ui-lib', name: 'test-ui-lib',
configureCypress: true, configureCypress: true,
configureStaticServe: false, configureStaticServe: false,
linter: Linter.EsLint,
generateStories: false,
}); });
appTree.write( appTree.write(

View File

@ -1,7 +0,0 @@
export function warnForSchematicUsage<T>(convertedGenerator: T): T {
console.warn(
'Running generators as schematics is deprecated and will be removed in v17. Prefer `callRule(convertNxGenerator(generator)(options), tree, context)` where "generator" is the name of the generator you wish to use.'
);
return convertedGenerator;
}

View File

@ -1,5 +0,0 @@
import { convertNxGenerator } from '@nx/devkit';
import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage';
import { webWorkerGenerator } from './web-worker';
export default warnForSchematicUsage(convertNxGenerator(webWorkerGenerator));

View File

@ -1,11 +1,4 @@
{ {
"builders": {
"cypress": {
"implementation": "./src/executors/cypress/compat",
"schema": "./src/executors/cypress/schema.json",
"description": "Run Cypress E2E tests."
}
},
"executors": { "executors": {
"cypress": { "cypress": {
"implementation": "./src/executors/cypress/cypress.impl", "implementation": "./src/executors/cypress/cypress.impl",

View File

@ -1,37 +1,6 @@
{ {
"name": "Nx Cypress", "name": "Nx Cypress",
"version": "0.1", "version": "0.1",
"schematics": {
"init": {
"factory": "./src/generators/init/init#cypressInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the `@nrwl/cypress` plugin.",
"aliases": ["ng-add"],
"hidden": true
},
"cypress-project": {
"factory": "./src/generators/cypress-project/cypress-project#cypressProjectSchematic",
"schema": "./src/generators/cypress-project/schema.json",
"description": "Add a Cypress E2E Project."
},
"configuration": {
"aliases": ["cypress-e2e-configuration", "e2e", "e2e-config"],
"factory": "./src/generators/configuration/configuration#compat",
"schema": "./src/generators/configuration/schema.json",
"description": "Add a Cypress E2E Configuration to an existing project."
},
"component-configuration": {
"aliases": ["cypress-component-configuration"],
"factory": "./src/generators/component-configuration/component-configuration#compat",
"schema": "./src/generators/component-configuration/schema.json",
"description": "Set up Cypress Component Test for a project"
},
"migrate-to-cypress-11": {
"factory": "./src/generators/migrate-to-cypress-11/migrate-to-cypress-11#migrateCypressProject",
"schema": "./src/generators/migrate-to-cypress-11/schema.json",
"description": "Migrate existing Cypress e2e projects to Cypress v11"
}
},
"generators": { "generators": {
"init": { "init": {
"factory": "./src/generators/init/init#cypressInitGenerator", "factory": "./src/generators/init/init#cypressInitGenerator",

View File

@ -27,8 +27,8 @@
"url": "https://github.com/nrwl/nx/issues" "url": "https://github.com/nrwl/nx/issues"
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"schematics": "./generators.json", "generators": "./generators.json",
"builders": "./executors.json", "executors": "./executors.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { default as cypressExecutor } from './cypress.impl';
export default convertNxExecutor(cypressExecutor);

View File

@ -11,7 +11,6 @@ import {
updateJson, updateJson,
updateProjectConfiguration, updateProjectConfiguration,
updateNxJson, updateNxJson,
convertNxGenerator,
} from '@nx/devkit'; } from '@nx/devkit';
import { installedCypressVersion } from '../../utils/cypress-version'; import { installedCypressVersion } from '../../utils/cypress-version';
@ -210,4 +209,3 @@ export function updateTsConfigForComponentTesting(
} }
export default componentConfigurationGenerator; export default componentConfigurationGenerator;
export const compat = convertNxGenerator(componentConfigurationGenerator);

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
formatFiles, formatFiles,
generateFiles, generateFiles,
GeneratorCallback, GeneratorCallback,
@ -37,6 +36,7 @@ export interface CypressE2EConfigSchema {
linter?: Linter; linter?: Linter;
port?: number | 'cypress-auto'; port?: number | 'cypress-auto';
} }
type NormalizedSchema = ReturnType<typeof normalizeOptions>; type NormalizedSchema = ReturnType<typeof normalizeOptions>;
export async function configurationGenerator( export async function configurationGenerator(
@ -221,4 +221,3 @@ function addTarget(tree: Tree, opts: NormalizedSchema) {
} }
export default configurationGenerator; export default configurationGenerator;
export const compat = convertNxGenerator(configurationGenerator);

View File

@ -1,7 +1,6 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
addProjectConfiguration, addProjectConfiguration,
convertNxGenerator,
formatFiles, formatFiles,
generateFiles, generateFiles,
GeneratorCallback, GeneratorCallback,
@ -266,6 +265,3 @@ async function normalizeOptions(
} }
export default cypressProjectGenerator; export default cypressProjectGenerator;
export const cypressProjectSchematic = convertNxGenerator(
cypressProjectGenerator
);

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
GeneratorCallback, GeneratorCallback,
readNxJson, readNxJson,
removeDependenciesFromPackageJson, removeDependenciesFromPackageJson,
@ -70,4 +69,3 @@ export async function cypressInitGenerator(tree: Tree, options: Schema) {
} }
export default cypressInitGenerator; export default cypressInitGenerator;
export const cypressInitSchematic = convertNxGenerator(cypressInitGenerator);

View File

@ -2,21 +2,6 @@
"name": "Nx Detox", "name": "Nx Detox",
"version": "0.1", "version": "0.1",
"extends": ["@nx/workspace"], "extends": ["@nx/workspace"],
"schematics": {
"init": {
"factory": "./src/generators/init/init#detoxInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the `@nrwl/detox` plugin.",
"hidden": true
},
"application": {
"factory": "./src/generators/application/application#detoxApplicationSchematic",
"schema": "./src/generators/application/schema.json",
"aliases": ["app"],
"x-type": "application",
"description": "Create a Detox application."
}
},
"generators": { "generators": {
"init": { "init": {
"factory": "./src/generators/init/init#detoxInitGenerator", "factory": "./src/generators/init/init#detoxInitGenerator",

View File

@ -35,12 +35,12 @@
"peerDependencies": { "peerDependencies": {
"detox": "^20.9.0" "detox": "^20.9.0"
}, },
"builders": "./executors.json", "executors": "./executors.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"
}, },
"schematics": "./generators.json", "generators": "./generators.json",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
} }

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import detoxBuildExecutor from './build.impl';
export default convertNxExecutor(detoxBuildExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import detoxTestExecutor from './test.impl';
export default convertNxExecutor(detoxTestExecutor);

View File

@ -1,9 +1,4 @@
import { import { formatFiles, runTasksInSerial, Tree } from '@nx/devkit';
convertNxGenerator,
formatFiles,
runTasksInSerial,
Tree,
} from '@nx/devkit';
import detoxInitGenerator from '../init/init'; import detoxInitGenerator from '../init/init';
import { addGitIgnoreEntry } from './lib/add-git-ignore-entry'; import { addGitIgnoreEntry } from './lib/add-git-ignore-entry';
@ -44,6 +39,3 @@ export async function detoxApplicationGeneratorInternal(
} }
export default detoxApplicationGenerator; export default detoxApplicationGenerator;
export const detoxApplicationSchematic = convertNxGenerator(
detoxApplicationGenerator
);

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
formatFiles, formatFiles,
GeneratorCallback, GeneratorCallback,
removeDependenciesFromPackageJson, removeDependenciesFromPackageJson,
@ -54,4 +53,3 @@ function moveDependency(host: Tree) {
} }
export default detoxInitGenerator; export default detoxInitGenerator;
export const detoxInitSchematic = convertNxGenerator(detoxInitGenerator);

View File

@ -4,7 +4,6 @@
// eslint-disable-next-line @typescript-eslint/no-restricted-imports // eslint-disable-next-line @typescript-eslint/no-restricted-imports
export { export {
wrapAngularDevkitSchematic, wrapAngularDevkitSchematic,
overrideCollectionResolutionForTesting,
mockSchematicsForTesting, mockSchematicsForTesting,
NxScopedHost, NxScopedHost,
} from 'nx/src/adapter/ngcli-adapter'; } from 'nx/src/adapter/ngcli-adapter';

View File

@ -1,11 +1,4 @@
{ {
"builders": {
"esbuild": {
"implementation": "./src/executors/esbuild/compat",
"schema": "./src/executors/esbuild/schema.json",
"description": "Bundle a package using EsBuild."
}
},
"executors": { "executors": {
"esbuild": { "esbuild": {
"implementation": "./src/executors/esbuild/esbuild.impl", "implementation": "./src/executors/esbuild/esbuild.impl",

View File

@ -1,20 +1,6 @@
{ {
"name": "Nx esbuild", "name": "Nx esbuild",
"version": "0.1", "version": "0.1",
"schematics": {
"init": {
"factory": "./src/generators/init/init#esbuildInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the `@nrwl/esbuild` plugin.",
"hidden": true
},
"configuration": {
"aliases": ["esbuild-project"],
"factory": "./src/generators/configuration/configuration#compat",
"schema": "./src/generators/configuration/schema.json",
"description": "Add esbuild configuration to a project."
}
},
"generators": { "generators": {
"init": { "init": {
"factory": "./src/generators/init/init#esbuildInitGenerator", "factory": "./src/generators/init/init#esbuildInitGenerator",

View File

@ -22,8 +22,8 @@
"url": "https://github.com/nrwl/nx/issues" "url": "https://github.com/nrwl/nx/issues"
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"schematics": "./generators.json", "generators": "./generators.json",
"builders": "./executors.json", "executors": "./executors.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import esbuildExecutor from './esbuild.impl';
export default convertNxExecutor(esbuildExecutor);

View File

@ -1,6 +1,5 @@
import type { Tree } from '@nx/devkit'; import type { Tree } from '@nx/devkit';
import { import {
convertNxGenerator,
formatFiles, formatFiles,
joinPathFragments, joinPathFragments,
readProjectConfiguration, readProjectConfiguration,
@ -131,6 +130,4 @@ function getTsConfigFile(tree: Tree, options: EsBuildProjectSchema) {
return options.tsConfig; return options.tsConfig;
} }
export const compat = convertNxGenerator(configurationGenerator);
export default configurationGenerator; export default configurationGenerator;

View File

@ -1,9 +1,4 @@
import { import { addDependenciesToPackageJson, formatFiles, Tree } from '@nx/devkit';
addDependenciesToPackageJson,
convertNxGenerator,
formatFiles,
Tree,
} from '@nx/devkit';
import { Schema } from './schema'; import { Schema } from './schema';
import { esbuildVersion } from '@nx/js/src/utils/versions'; import { esbuildVersion } from '@nx/js/src/utils/versions';
import { nxVersion } from '../../utils/versions'; import { nxVersion } from '../../utils/versions';
@ -26,5 +21,3 @@ export async function esbuildInitGenerator(tree: Tree, schema: Schema) {
} }
export default esbuildInitGenerator; export default esbuildInitGenerator;
export const esbuildInitSchematic = convertNxGenerator(esbuildInitGenerator);

View File

@ -55,62 +55,5 @@
"schema": "./src/executors/submit/schema.json", "schema": "./src/executors/submit/schema.json",
"description": "Submit app binary to App Store and/or Play Store" "description": "Submit app binary to App Store and/or Play Store"
} }
},
"builders": {
"update": {
"implementation": "./src/executors/update/compat",
"schema": "./src/executors/update/schema.json",
"description": "Start an EAS update for your expo project"
},
"build": {
"implementation": "./src/executors/build/compat",
"schema": "./src/executors/build/schema.json",
"description": "Start an EAS build for your expo project"
},
"build-list": {
"implementation": "./src/executors/build-list/compat",
"schema": "./src/executors/build-list/schema.json",
"description": "List all EAS builds for your Expo project"
},
"run": {
"implementation": "./src/executors/run/compat",
"schema": "./src/executors/run/schema.json",
"description": "Run the Android app binary locally or run the iOS app binary locally"
},
"start": {
"implementation": "./src/executors/start/compat",
"schema": "./src/executors/start/schema.json",
"description": "Start a local dev server for the app or start a Webpack dev server for the web app"
},
"sync-deps": {
"implementation": "./src/executors/sync-deps/compat",
"schema": "./src/executors/sync-deps/schema.json",
"description": "Syncs dependencies to package.json (required for autolinking)."
},
"ensure-symlink": {
"implementation": "./src/executors/ensure-symlink/compat",
"schema": "./src/executors/ensure-symlink/schema.json",
"description": "Ensure workspace node_modules is symlink under app's node_modules folder."
},
"prebuild": {
"implementation": "./src/executors/prebuild/compat",
"schema": "./src/executors/prebuild/schema.json",
"description": "Create native iOS and Android project files for building natively."
},
"install": {
"implementation": "./src/executors/install/compat",
"schema": "./src/executors/install/schema.json",
"description": "Install a module or other package to a project."
},
"export": {
"implementation": "./src/executors/export/compat",
"schema": "./src/executors/export/schema.json",
"description": "Export the JavaScript and assets for your app using Metro/webpack bundler"
},
"submit": {
"implementation": "./src/executors/submit/compat",
"schema": "./src/executors/submit/schema.json",
"description": "Submit app binary to App Store and/or Play Store"
}
} }
} }

View File

@ -2,34 +2,6 @@
"name": "Nx Expo", "name": "Nx Expo",
"version": "0.1", "version": "0.1",
"extends": ["@nx/workspace"], "extends": ["@nx/workspace"],
"schematics": {
"init": {
"factory": "./src/generators/init/init#expoInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the @nrwl/expo plugin",
"hidden": true
},
"application": {
"factory": "./src/generators/application/application#expoApplicationSchematic",
"schema": "./src/generators/application/schema.json",
"aliases": ["app"],
"x-type": "application",
"description": "Create an application"
},
"library": {
"factory": "./src/generators/library/library#expoLibrarySchematic",
"schema": "./src/generators/library/schema.json",
"aliases": ["lib"],
"x-type": "library",
"description": "Create a library"
},
"component": {
"factory": "./src/generators/component/component#expoComponentSchematic",
"schema": "./src/generators/component/schema.json",
"description": "Create a component",
"aliases": ["c"]
}
},
"generators": { "generators": {
"init": { "init": {
"factory": "./src/generators/init/init#expoInitGenerator", "factory": "./src/generators/init/init#expoInitGenerator",

View File

@ -47,12 +47,12 @@
"@expo/cli": ">= 0.10.0", "@expo/cli": ">= 0.10.0",
"eas-cli": ">= 3.15.0" "eas-cli": ">= 3.15.0"
}, },
"builders": "./executors.json", "executors": "./executors.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"
}, },
"schematics": "./generators.json", "generators": "./generators.json",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
} }

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import buildListExecutor from './build-list.impl';
export default convertNxExecutor(buildListExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import buildExecutor from './build.impl';
export default convertNxExecutor(buildExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import ensureSymlinkExecutor from './ensure-symlink.impl';
export default convertNxExecutor(ensureSymlinkExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import exportExecutor from './export.impl';
export default convertNxExecutor(exportExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import installExecutor from './install.impl';
export default convertNxExecutor(installExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import prebuildExecutor from './prebuild.impl';
export default convertNxExecutor(prebuildExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import runExecutor from './run.impl';
export default convertNxExecutor(runExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import startExecutor from './start.impl';
export default convertNxExecutor(startExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import submitExecutor from './submit.impl';
export default convertNxExecutor(submitExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import syncDepsExecutor from './sync-deps.impl';
export default convertNxExecutor(syncDepsExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import buildExecutor from './update.impl';
export default convertNxExecutor(buildExecutor);

View File

@ -1,5 +1,4 @@
import { import {
convertNxGenerator,
formatFiles, formatFiles,
GeneratorCallback, GeneratorCallback,
joinPathFragments, joinPathFragments,
@ -67,6 +66,3 @@ export async function expoApplicationGeneratorInternal(
} }
export default expoApplicationGenerator; export default expoApplicationGenerator;
export const expoApplicationSchematic = convertNxGenerator(
expoApplicationGenerator
);

View File

@ -2,7 +2,6 @@ import * as ts from 'typescript';
import { Schema } from './schema'; import { Schema } from './schema';
import { import {
applyChangesToString, applyChangesToString,
convertNxGenerator,
formatFiles, formatFiles,
generateFiles, generateFiles,
getProjects, getProjects,
@ -83,6 +82,3 @@ function addExportsToBarrel(host: Tree, options: NormalizedSchema) {
} }
export default expoComponentGenerator; export default expoComponentGenerator;
export const expoComponentSchematic = convertNxGenerator(
expoComponentGenerator
);

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
formatFiles, formatFiles,
GeneratorCallback, GeneratorCallback,
removeDependenciesFromPackageJson, removeDependenciesFromPackageJson,
@ -112,4 +111,3 @@ function moveDependency(host: Tree) {
} }
export default expoInitGenerator; export default expoInitGenerator;
export const expoInitSchematic = convertNxGenerator(expoInitGenerator);

View File

@ -1,6 +1,5 @@
import { import {
addProjectConfiguration, addProjectConfiguration,
convertNxGenerator,
ensurePackage, ensurePackage,
formatFiles, formatFiles,
generateFiles, generateFiles,
@ -220,4 +219,3 @@ function maybeJs(options: NormalizedSchema, path: string): string {
} }
export default expoLibraryGenerator; export default expoLibraryGenerator;
export const expoLibrarySchematic = convertNxGenerator(expoLibraryGenerator);

View File

@ -10,7 +10,6 @@
"aliases": ["ng-add"], "aliases": ["ng-add"],
"hidden": true "hidden": true
}, },
"application": { "application": {
"factory": "./src/generators/application/application#applicationGeneratorInternal", "factory": "./src/generators/application/application#applicationGeneratorInternal",
"schema": "./src/generators/application/schema.json", "schema": "./src/generators/application/schema.json",
@ -18,22 +17,5 @@
"x-type": "application", "x-type": "application",
"description": "Create an Express application." "description": "Create an Express application."
} }
},
"schematics": {
"init": {
"factory": "./src/generators/init/init#initSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the `@nrwl/express` plugin.",
"aliases": ["ng-add"],
"hidden": true
},
"application": {
"factory": "./src/generators/application/application#applicationSchematic",
"schema": "./src/generators/application/schema.json",
"aliases": ["app"],
"x-type": "application",
"description": "Create an Express application."
}
} }
} }

View File

@ -24,7 +24,7 @@
"url": "https://github.com/nrwl/nx/issues" "url": "https://github.com/nrwl/nx/issues"
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"schematics": "./generators.json", "generators": "./generators.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"

View File

@ -1,5 +1,5 @@
import type { Tree } from '@nx/devkit'; import type { Tree } from '@nx/devkit';
import { convertNxGenerator, formatFiles, toJS, updateJson } from '@nx/devkit'; import { formatFiles, toJS, updateJson } from '@nx/devkit';
import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils';
import { applicationGenerator as nodeApplicationGenerator } from '@nx/node'; import { applicationGenerator as nodeApplicationGenerator } from '@nx/node';
import { join } from 'path'; import { join } from 'path';
@ -83,7 +83,6 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) {
} }
export default applicationGenerator; export default applicationGenerator;
export const applicationSchematic = convertNxGenerator(applicationGenerator);
async function normalizeOptions( async function normalizeOptions(
host: Tree, host: Tree,

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
formatFiles, formatFiles,
removeDependenciesFromPackageJson, removeDependenciesFromPackageJson,
Tree, Tree,
@ -47,4 +46,3 @@ export async function initGenerator(tree: Tree, schema: Schema) {
} }
export default initGenerator; export default initGenerator;
export const initSchematic = convertNxGenerator(initGenerator);

View File

@ -1,11 +1,4 @@
{ {
"builders": {
"jest": {
"implementation": "./src/executors/jest/compat",
"schema": "./src/executors/jest/schema.json",
"description": "Run Jest unit tests."
}
},
"executors": { "executors": {
"jest": { "jest": {
"implementation": "./src/executors/jest/jest.impl", "implementation": "./src/executors/jest/jest.impl",

View File

@ -1,21 +1,6 @@
{ {
"name": "Nx Jest", "name": "Nx Jest",
"version": "0.1", "version": "0.1",
"schematics": {
"init": {
"factory": "./src/generators/init/init#jestInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize the `@nrwl/jest` plugin.",
"aliases": ["ng-add"],
"hidden": true
},
"configuration": {
"factory": "./src/generators/configuration/configuration#compat",
"schema": "./src/generators/configuration/schema.json",
"description": "Add Jest configuration to a project.",
"hidden": true
}
},
"generators": { "generators": {
"init": { "init": {
"factory": "./src/generators/init/init#jestInitGenerator", "factory": "./src/generators/init/init#jestInitGenerator",

View File

@ -27,8 +27,8 @@
"url": "https://github.com/nrwl/nx/issues" "url": "https://github.com/nrwl/nx/issues"
}, },
"homepage": "https://nx.dev", "homepage": "https://nx.dev",
"schematics": "./generators.json", "generators": "./generators.json",
"builders": "./executors.json", "executors": "./executors.json",
"ng-update": { "ng-update": {
"requirements": {}, "requirements": {},
"migrations": "./migrations.json" "migrations": "./migrations.json"

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { default as jestExecutor } from './jest.impl';
export default convertNxExecutor(jestExecutor);

View File

@ -7,7 +7,6 @@ import { JestProjectSchema, NormalizedJestProjectSchema } from './schema';
import { import {
formatFiles, formatFiles,
Tree, Tree,
convertNxGenerator,
GeneratorCallback, GeneratorCallback,
readProjectConfiguration, readProjectConfiguration,
} from '@nx/devkit'; } from '@nx/devkit';
@ -75,5 +74,3 @@ export async function configurationGenerator(
} }
export default configurationGenerator; export default configurationGenerator;
export const compat = convertNxGenerator(configurationGenerator);

View File

@ -1,10 +1,8 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
GeneratorCallback, GeneratorCallback,
getProjects, getProjects,
readNxJson, readNxJson,
readProjectConfiguration,
removeDependenciesFromPackageJson, removeDependenciesFromPackageJson,
runTasksInSerial, runTasksInSerial,
stripIndents, stripIndents,
@ -233,5 +231,3 @@ function normalizeOptions(options: JestInitSchema) {
} }
export default jestInitGenerator; export default jestInitGenerator;
export const jestInitSchematic = convertNxGenerator(jestInitGenerator);

View File

@ -28,27 +28,5 @@
"schema": "./src/executors/verdaccio/schema.json", "schema": "./src/executors/verdaccio/schema.json",
"description": "Start local registry with verdaccio" "description": "Start local registry with verdaccio"
} }
},
"builders": {
"tsc": {
"implementation": "./src/executors/tsc/compat",
"schema": "./src/executors/tsc/schema.json",
"description": "Build a project using TypeScript."
},
"swc": {
"implementation": "./src/executors/swc/compat",
"schema": "./src/executors/swc/schema.json",
"description": "Build a project using SWC."
},
"node": {
"implementation": "./src/executors/node/compat",
"schema": "./src/executors/node/schema.json",
"description": "Execute a Node application."
},
"verdaccio": {
"implementation": "./src/executors/verdaccio/compat",
"schema": "./src/executors/verdaccio/schema.json",
"description": "Start local registry with verdaccio"
}
} }
} }

View File

@ -1,41 +1,6 @@
{ {
"name": "nx/js", "name": "nx/js",
"version": "0.1", "version": "0.1",
"schematics": {
"library": {
"factory": "./src/generators/library/library#librarySchematic",
"schema": "./src/generators/library/schema.json",
"aliases": ["lib"],
"x-type": "library",
"description": "Create a library."
},
"init": {
"factory": "./src/generators/init/init#initSchematic",
"schema": "./src/generators/init/schema.json",
"x-type": "init",
"description": "Initialize a TS/JS workspace.",
"hidden": true
},
"convert-to-swc": {
"factory": "./src/generators/convert-to-swc/convert-to-swc#convertToSwcSchematic",
"schema": "./src/generators/convert-to-swc/schema.json",
"aliases": ["swc"],
"x-type": "library",
"description": "Convert a TypeScript library to compile with SWC."
},
"setup-verdaccio": {
"factory": "./src/generators/setup-verdaccio/generator#setupVerdaccioSchematic",
"schema": "./src/generators/setup-verdaccio/schema.json",
"alias": ["verdaccio"],
"description": "Setup Verdaccio for local package management."
},
"setup-build": {
"factory": "./src/generators/setup-build/generator#setupBuildSchematic",
"schema": "./src/generators/setup-build/schema.json",
"alias": ["build"],
"description": "setup-build generator"
}
},
"generators": { "generators": {
"library": { "library": {
"factory": "./src/generators/library/library#libraryGeneratorInternal", "factory": "./src/generators/library/library#libraryGeneratorInternal",

View File

@ -28,9 +28,7 @@
"migrations": "./migrations.json" "migrations": "./migrations.json"
}, },
"generators": "./generators.json", "generators": "./generators.json",
"schematics": "./generators.json",
"executors": "./executors.json", "executors": "./executors.json",
"builders": "./executors.json",
"dependencies": { "dependencies": {
"@babel/core": "^7.22.9", "@babel/core": "^7.22.9",
"@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-properties": "^7.18.6",

View File

@ -1,4 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import nodeExecutor from './node.impl';
export default convertNxExecutor(nodeExecutor);

View File

@ -1,4 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { swcExecutor } from './swc.impl';
export default convertNxExecutor(swcExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { tscExecutor } from './tsc.impl';
export default convertNxExecutor(tscExecutor);

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nx/devkit';
import { verdaccioExecutor } from './verdaccio.impl';
export default convertNxExecutor(verdaccioExecutor);

View File

@ -1,6 +1,5 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
installPackagesTask, installPackagesTask,
ProjectConfiguration, ProjectConfiguration,
readJson, readJson,
@ -109,4 +108,3 @@ function checkSwcDependencies(
} }
export default convertToSwcGenerator; export default convertToSwcGenerator;
export const convertToSwcSchematic = convertNxGenerator(convertToSwcGenerator);

View File

@ -1,11 +1,9 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
convertNxGenerator,
ensurePackage, ensurePackage,
formatFiles, formatFiles,
generateFiles, generateFiles,
GeneratorCallback, GeneratorCallback,
joinPathFragments,
readJson, readJson,
stripIndents, stripIndents,
Tree, Tree,
@ -154,5 +152,3 @@ export async function initGenerator(
} }
export default initGenerator; export default initGenerator;
export const initSchematic = convertNxGenerator(initGenerator);

View File

@ -1,7 +1,6 @@
import { import {
addDependenciesToPackageJson, addDependenciesToPackageJson,
addProjectConfiguration, addProjectConfiguration,
convertNxGenerator,
ensurePackage, ensurePackage,
formatFiles, formatFiles,
generateFiles, generateFiles,
@ -239,6 +238,7 @@ export type AddLintOptions = Pick<
| 'rootProject' | 'rootProject'
| 'bundler' | 'bundler'
>; >;
export async function addLint( export async function addLint(
tree: Tree, tree: Tree,
options: AddLintOptions options: AddLintOptions
@ -813,4 +813,3 @@ function determineEntryFields(
} }
export default libraryGenerator; export default libraryGenerator;
export const librarySchematic = convertNxGenerator(libraryGenerator);

View File

@ -1,5 +1,4 @@
import { import {
convertNxGenerator,
ensurePackage, ensurePackage,
formatFiles, formatFiles,
type GeneratorCallback, type GeneratorCallback,
@ -161,4 +160,3 @@ export async function setupBuildGenerator(
} }
export default setupBuildGenerator; export default setupBuildGenerator;
export const setupBuildSchematic = convertNxGenerator(setupBuildGenerator);

Some files were not shown because too many files have changed in this diff Show More