-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add deprecation wrapper for workspace-generator
- Loading branch information
1 parent
7b35f66
commit 09af47c
Showing
9 changed files
with
150 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
packages/nx-plugin/src/generators/local-plugin-from-tools/schema.d.ts
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
packages/nx-plugin/src/generators/local-plugin-from-tools/schema.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
import yargs = require('yargs'); | ||
import { readNxJson } from '../config/configuration'; | ||
import { NxJsonConfiguration } from '../devkit-exports'; | ||
import { NX_PREFIX } from '../utils/logger'; | ||
import { output } from '../utils/output'; | ||
|
||
export async function workspaceGenerators(args: string[]) { | ||
const bodyLines: string[] = [ | ||
'Instead, Nx now supports executing generators or executors from ', | ||
'local plugins. To run a generator from a local plugin, ', | ||
'use `nx generate` like you would with any other generator.', | ||
'', | ||
'For more information, see: https://nx.dev/deprecated/workspace-generators', | ||
]; | ||
output.error({ | ||
/** | ||
* Wraps `workspace-generator` to invoke `generate`. | ||
* | ||
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins. | ||
*/ | ||
export async function workspaceGenerators(args: yargs.Arguments) { | ||
const generator = process.argv.slice(3); | ||
|
||
output.warn({ | ||
title: `${NX_PREFIX} Workspace Generators are no longer supported`, | ||
bodyLines, | ||
bodyLines: [ | ||
'Instead, Nx now supports executing generators or executors from ', | ||
'local plugins. To run a generator from a local plugin, ', | ||
'use `nx generate` like you would with any other generator.', | ||
'', | ||
'For more information, see: https://nx.dev/deprecated/workspace-generators', | ||
], | ||
}); | ||
// In case users have scripted around workspace-generator, this will ensure commands fail :) | ||
process.exit(1); | ||
|
||
const nxJson: NxJsonConfiguration = readNxJson(); | ||
const collection = nxJson.npmScope | ||
? `@${nxJson.npmScope}/workspace-plugin` | ||
: 'workspace-plugin'; | ||
|
||
args._ = args._.slice(1); | ||
args.generator = `${collection}:${generator}`; | ||
|
||
return (await import('./generate')).generate(process.cwd(), args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters