@nx/workspace 16.0.0-beta.2 → 16.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +6 -0
- package/package.json +29 -29
- package/src/generators/move/lib/create-project-configuration-in-new-destination.js +6 -5
- package/src/generators/move/lib/create-project-configuration-in-new-destination.js.map +1 -1
- package/src/generators/move/lib/normalize-schema.js +3 -3
- package/src/generators/move/lib/normalize-schema.js.map +1 -1
- package/src/generators/move/lib/update-imports.js +9 -8
- package/src/generators/move/lib/update-imports.js.map +1 -1
- package/src/generators/move/lib/utils.js +3 -0
- package/src/generators/move/lib/utils.js.map +1 -1
- package/src/generators/move/schema.d.ts +2 -1
- package/src/generators/preset/schema.d.ts +1 -1
- package/src/generators/preset/schema.json +1 -1
- package/src/generators/workspace-generator/schema.d.ts +1 -4
- package/src/generators/workspace-generator/schema.json +1 -17
- package/src/generators/workspace-generator/workspace-generator.d.ts +1 -1
- package/src/generators/workspace-generator/workspace-generator.js +9 -17
- package/src/generators/workspace-generator/workspace-generator.js.map +1 -1
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.d.ts +2 -0
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js +135 -0
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js.map +1 -0
- package/src/utilities/ts-config.d.ts +2 -0
- package/src/utilities/ts-config.js +29 -1
- package/src/utilities/ts-config.js.map +1 -1
- package/src/generators/workspace-generator/files/index.ts__tmpl__ +0 -10
- package/src/generators/workspace-generator/files/schema.json__tmpl__ +0 -17
package/migrations.json
CHANGED
|
@@ -89,6 +89,12 @@
|
|
|
89
89
|
"version": "16.0.0-beta.1",
|
|
90
90
|
"description": "Replace @nrwl/workspace with @nx/workspace",
|
|
91
91
|
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
92
|
+
},
|
|
93
|
+
"16-0-0-move-workspace-generators-into-local-plugin": {
|
|
94
|
+
"version": "16.0.0-beta.4",
|
|
95
|
+
"description": "Generates a plugin called 'workspace-plugin' containing your workspace generators.",
|
|
96
|
+
"cli": "nx",
|
|
97
|
+
"implementation": "./src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin"
|
|
92
98
|
}
|
|
93
99
|
},
|
|
94
100
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "16.0.0-beta.
|
|
3
|
+
"version": "16.0.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
|
6
6
|
"repository": {
|
|
@@ -33,36 +33,36 @@
|
|
|
33
33
|
"requirements": {},
|
|
34
34
|
"migrations": "./migrations.json",
|
|
35
35
|
"packageGroup": {
|
|
36
|
-
"@nrwl/js": "16.0.0-beta.
|
|
37
|
-
"@nrwl/jest": "16.0.0-beta.
|
|
38
|
-
"@nrwl/linter": "16.0.0-beta.
|
|
39
|
-
"@nrwl/angular": "16.0.0-beta.
|
|
40
|
-
"@nrwl/cypress": "16.0.0-beta.
|
|
41
|
-
"@nrwl/detox": "16.0.0-beta.
|
|
42
|
-
"@nrwl/devkit": "16.0.0-beta.
|
|
43
|
-
"@nrwl/esbuild": "16.0.0-beta.
|
|
44
|
-
"@nrwl/eslint-plugin-nx": "16.0.0-beta.
|
|
45
|
-
"@nrwl/expo": "16.0.0-beta.
|
|
46
|
-
"@nrwl/express": "16.0.0-beta.
|
|
47
|
-
"@nrwl/nest": "16.0.0-beta.
|
|
48
|
-
"@nrwl/next": "16.0.0-beta.
|
|
49
|
-
"@nrwl/node": "16.0.0-beta.
|
|
36
|
+
"@nrwl/js": "16.0.0-beta.4",
|
|
37
|
+
"@nrwl/jest": "16.0.0-beta.4",
|
|
38
|
+
"@nrwl/linter": "16.0.0-beta.4",
|
|
39
|
+
"@nrwl/angular": "16.0.0-beta.4",
|
|
40
|
+
"@nrwl/cypress": "16.0.0-beta.4",
|
|
41
|
+
"@nrwl/detox": "16.0.0-beta.4",
|
|
42
|
+
"@nrwl/devkit": "16.0.0-beta.4",
|
|
43
|
+
"@nrwl/esbuild": "16.0.0-beta.4",
|
|
44
|
+
"@nrwl/eslint-plugin-nx": "16.0.0-beta.4",
|
|
45
|
+
"@nrwl/expo": "16.0.0-beta.4",
|
|
46
|
+
"@nrwl/express": "16.0.0-beta.4",
|
|
47
|
+
"@nrwl/nest": "16.0.0-beta.4",
|
|
48
|
+
"@nrwl/next": "16.0.0-beta.4",
|
|
49
|
+
"@nrwl/node": "16.0.0-beta.4",
|
|
50
50
|
"nx-cloud": "latest",
|
|
51
|
-
"@nrwl/nx-plugin": "16.0.0-beta.
|
|
52
|
-
"@nrwl/react-native": "16.0.0-beta.
|
|
53
|
-
"@nrwl/react": "16.0.0-beta.
|
|
54
|
-
"@nrwl/rollup": "16.0.0-beta.
|
|
55
|
-
"@nrwl/storybook": "16.0.0-beta.
|
|
56
|
-
"@nrwl/tao": "16.0.0-beta.
|
|
57
|
-
"@nrwl/vite": "16.0.0-beta.
|
|
58
|
-
"@nrwl/web": "16.0.0-beta.
|
|
59
|
-
"@nrwl/webpack": "16.0.0-beta.
|
|
60
|
-
"nx": "16.0.0-beta.
|
|
51
|
+
"@nrwl/nx-plugin": "16.0.0-beta.4",
|
|
52
|
+
"@nrwl/react-native": "16.0.0-beta.4",
|
|
53
|
+
"@nrwl/react": "16.0.0-beta.4",
|
|
54
|
+
"@nrwl/rollup": "16.0.0-beta.4",
|
|
55
|
+
"@nrwl/storybook": "16.0.0-beta.4",
|
|
56
|
+
"@nrwl/tao": "16.0.0-beta.4",
|
|
57
|
+
"@nrwl/vite": "16.0.0-beta.4",
|
|
58
|
+
"@nrwl/web": "16.0.0-beta.4",
|
|
59
|
+
"@nrwl/webpack": "16.0.0-beta.4",
|
|
60
|
+
"nx": "16.0.0-beta.4"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@nrwl/workspace": "16.0.0-beta.
|
|
65
|
-
"@nx/devkit": "16.0.0-beta.
|
|
64
|
+
"@nrwl/workspace": "16.0.0-beta.4",
|
|
65
|
+
"@nx/devkit": "16.0.0-beta.4",
|
|
66
66
|
"@parcel/watcher": "2.0.4",
|
|
67
67
|
"chalk": "^4.1.0",
|
|
68
68
|
"chokidar": "^3.5.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"ignore": "^5.0.4",
|
|
75
75
|
"minimatch": "3.0.5",
|
|
76
76
|
"npm-run-path": "^4.0.1",
|
|
77
|
-
"nx": "16.0.0-beta.
|
|
77
|
+
"nx": "16.0.0-beta.4",
|
|
78
78
|
"open": "^8.4.0",
|
|
79
79
|
"rxjs": "^6.5.4",
|
|
80
80
|
"tmp": "~0.2.1",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
88
|
"types": "./index.d.ts",
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "0fc3d4441eb6900f8bdf0091c39f65e3cd1977ba"
|
|
90
90
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createProjectConfigurationInNewDestination = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
function createProjectConfigurationInNewDestination(tree, schema, projectConfig) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
projectConfig.name = schema.newProjectName;
|
|
8
|
+
// Subtle bug if project name === path, where the updated name was being overrideen.
|
|
9
|
+
const { name } = projectConfig, rest = tslib_1.__rest(projectConfig, ["name"]);
|
|
9
10
|
// replace old root path with new one
|
|
10
|
-
const projectString = JSON.stringify(
|
|
11
|
+
const projectString = JSON.stringify(rest);
|
|
11
12
|
const newProjectString = projectString.replace(new RegExp(projectConfig.root, 'g'), schema.relativeToRootDestination);
|
|
12
|
-
const newProject = JSON.parse(newProjectString);
|
|
13
|
+
const newProject = Object.assign({ name }, JSON.parse(newProjectString));
|
|
13
14
|
// Create a new project with the root replaced
|
|
14
15
|
(0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject);
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-project-configuration-in-new-destination.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/create-project-configuration-in-new-destination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-project-configuration-in-new-destination.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/create-project-configuration-in-new-destination.ts"],"names":[],"mappings":";;;;AAAA,uCAIoB;AAGpB,SAAgB,0CAA0C,CACxD,IAAU,EACV,MAAwB,EACxB,aAAmC;IAEnC,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC;IAE3C,oFAAoF;IACpF,MAAM,EAAE,IAAI,KAAc,aAAa,EAAtB,IAAI,kBAAK,aAAa,EAAjC,QAAiB,CAAgB,CAAC;IAExC,qCAAqC;IACrC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,CAC5C,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,EACnC,MAAM,CAAC,yBAAyB,CACjC,CAAC;IACF,MAAM,UAAU,mBACd,IAAI,IACD,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAChC,CAAC;IAEF,8CAA8C;IAC9C,IAAA,gCAAuB,EAAC,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AAvBD,gGAuBC"}
|
|
@@ -5,13 +5,13 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("nx/src/utils/path");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
function normalizeSchema(tree, schema, projectConfiguration) {
|
|
8
|
-
var _a;
|
|
8
|
+
var _a, _b;
|
|
9
9
|
const destination = schema.destination.startsWith('/')
|
|
10
10
|
? (0, utils_1.normalizeSlashes)(schema.destination.slice(1))
|
|
11
11
|
: schema.destination;
|
|
12
|
-
const newProjectName = (0, utils_1.getNewProjectName)(destination);
|
|
12
|
+
const newProjectName = (_a = schema.newProjectName) !== null && _a !== void 0 ? _a : (0, utils_1.getNewProjectName)(destination);
|
|
13
13
|
const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
14
|
-
return Object.assign(Object.assign({}, schema), { destination, importPath: (
|
|
14
|
+
return Object.assign(Object.assign({}, schema), { destination, importPath: (_b = schema.importPath) !== null && _b !== void 0 ? _b : (0, utils_1.normalizeSlashes)((0, path_1.getImportPath)(npmScope, destination)), newProjectName, relativeToRootDestination: (0, utils_1.getDestination)(tree, schema, projectConfiguration) });
|
|
15
15
|
}
|
|
16
16
|
exports.normalizeSchema = normalizeSchema;
|
|
17
17
|
//# sourceMappingURL=normalize-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-schema.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/normalize-schema.ts"],"names":[],"mappings":";;;AAAA,uCAA4E;AAC5E,4CAAkD;AAElD,mCAA8E;AAE9E,SAAgB,eAAe,CAC7B,IAAU,EACV,MAAc,EACd,oBAA0C;;IAE1C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IACvB,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"normalize-schema.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/normalize-schema.ts"],"names":[],"mappings":";;;AAAA,uCAA4E;AAC5E,4CAAkD;AAElD,mCAA8E;AAE9E,SAAgB,eAAe,CAC7B,IAAU,EACV,MAAc,EACd,oBAA0C;;IAE1C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IACvB,MAAM,cAAc,GAClB,MAAA,MAAM,CAAC,cAAc,mCAAI,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC;IAC1D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAE9C,uCACK,MAAM,KACT,WAAW,EACX,UAAU,EACR,MAAA,MAAM,CAAC,UAAU,mCACjB,IAAA,wBAAgB,EAAC,IAAA,oBAAa,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,EACxD,cAAc,EACd,yBAAyB,EAAE,IAAA,sBAAc,EACvC,IAAI,EACJ,MAAM,EACN,oBAAoB,CACrB,IACD;AACJ,CAAC;AAzBD,0CAyBC"}
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateImports = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const ts_config_1 = require("../../../utilities/ts-config");
|
|
6
|
-
const typescript_1 = require("nx/src/utils/typescript");
|
|
7
6
|
const utils_1 = require("./utils");
|
|
8
7
|
const path_1 = require("path");
|
|
9
|
-
const
|
|
8
|
+
const typescript_1 = require("../../../utilities/typescript");
|
|
10
9
|
let tsModule;
|
|
11
10
|
/**
|
|
12
11
|
* Updates all the imports in the workspace and modifies the tsconfig appropriately.
|
|
@@ -65,7 +64,9 @@ function updateImports(tree, schema, project) {
|
|
|
65
64
|
const updatedPath = path.map((x) => (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, x)));
|
|
66
65
|
if (schema.updateImportPath) {
|
|
67
66
|
tsConfig.compilerOptions.paths[projectRef.to] = updatedPath;
|
|
68
|
-
|
|
67
|
+
if (projectRef.from !== projectRef.to) {
|
|
68
|
+
delete tsConfig.compilerOptions.paths[projectRef.from];
|
|
69
|
+
}
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
72
|
tsConfig.compilerOptions.paths[projectRef.from] = updatedPath;
|
|
@@ -79,7 +80,7 @@ exports.updateImports = updateImports;
|
|
|
79
80
|
*/
|
|
80
81
|
function updateImportPaths(tree, path, from, to) {
|
|
81
82
|
if (!tsModule) {
|
|
82
|
-
tsModule = (0,
|
|
83
|
+
tsModule = (0, typescript_1.ensureTypescript)();
|
|
83
84
|
}
|
|
84
85
|
const contents = tree.read(path, 'utf-8');
|
|
85
86
|
const sourceFile = tsModule.createSourceFile(path, contents, tsModule.ScriptTarget.Latest, true);
|
|
@@ -95,9 +96,9 @@ function updateImportPaths(tree, path, from, to) {
|
|
|
95
96
|
*/
|
|
96
97
|
function updateImportDeclarations(sourceFile, from, to) {
|
|
97
98
|
if (!tsModule) {
|
|
98
|
-
tsModule = (0,
|
|
99
|
+
tsModule = (0, typescript_1.ensureTypescript)();
|
|
99
100
|
}
|
|
100
|
-
const importDecls = (0,
|
|
101
|
+
const importDecls = (0, ts_config_1.findNodes)(sourceFile, tsModule.SyntaxKind.ImportDeclaration);
|
|
101
102
|
const changes = [];
|
|
102
103
|
for (const { moduleSpecifier } of importDecls) {
|
|
103
104
|
if (tsModule.isStringLiteral(moduleSpecifier)) {
|
|
@@ -111,9 +112,9 @@ function updateImportDeclarations(sourceFile, from, to) {
|
|
|
111
112
|
*/
|
|
112
113
|
function updateDynamicImports(sourceFile, from, to) {
|
|
113
114
|
if (!tsModule) {
|
|
114
|
-
tsModule = (0,
|
|
115
|
+
tsModule = (0, typescript_1.ensureTypescript)();
|
|
115
116
|
}
|
|
116
|
-
const expressions = (0,
|
|
117
|
+
const expressions = (0, ts_config_1.findNodes)(sourceFile, tsModule.SyntaxKind.CallExpression);
|
|
117
118
|
const changes = [];
|
|
118
119
|
for (const { expression, arguments: args } of expressions) {
|
|
119
120
|
const moduleSpecifier = args[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-imports.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-imports.ts"],"names":[],"mappings":";;;AAAA,uCAaoB;AAEpB,
|
|
1
|
+
{"version":3,"file":"update-imports.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-imports.ts"],"names":[],"mappings":";;;AAAA,uCAaoB;AAEpB,4DAGsC;AAEtC,mCAA2C;AAC3C,+BAAgC;AAChC,8DAAiE;AAEjE,IAAI,QAAqC,CAAC;AAE1C;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE;QACzC,wCAAwC;QACxC,OAAO;KACR;IAED,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEnC,gDAAgD;IAChD,6EAA6E;IAC7E,MAAM,YAAY,GAAG,IAAA,qCAAyB,EAAC,IAAI,CAAC,CAAC;IACrD,IAAI,QAAa,CAAC;IAClB,IAAI,QAAgB,CAAC;IACrB,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC7B,QAAQ,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAExC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BAAU,CAAC,MAAM;gBACvB,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE,GAAG,CAAC;gBACrC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;aAC9D;SACF,CAAC;KACH;SAAM;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC"}
|
|
@@ -10,6 +10,9 @@ const devkit_1 = require("@nx/devkit");
|
|
|
10
10
|
* folders. In that case, they're on their own :/
|
|
11
11
|
*/
|
|
12
12
|
function getDestination(host, schema, project) {
|
|
13
|
+
if (schema.destinationRelativeToRoot) {
|
|
14
|
+
return schema.destination;
|
|
15
|
+
}
|
|
13
16
|
const projectType = project.projectType;
|
|
14
17
|
const workspaceLayout = (0, devkit_1.getWorkspaceLayout)(host);
|
|
15
18
|
let rootFolder = workspaceLayout.libsDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/utils.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAIpB;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,IAAU,EACV,MAAc,EACd,OAA6B;IAE7B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAExC,MAAM,eAAe,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAEjD,IAAI,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC;IACzC,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC;KACtC;IACD,OAAO,IAAA,0BAAiB,EAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;AAC3D,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/utils.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAIpB;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,IAAU,EACV,MAAc,EACd,OAA6B;IAE7B,IAAI,MAAM,CAAC,yBAAyB,EAAE;QACpC,OAAO,MAAM,CAAC,WAAW,CAAC;KAC3B;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAExC,MAAM,eAAe,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAEjD,IAAI,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC;IACzC,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC;KACtC;IACD,OAAO,IAAA,0BAAiB,EAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;AAC3D,CAAC;AAlBD,wCAkBC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAFD,8CAEC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAClB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AALD,4CAKC"}
|
|
@@ -4,10 +4,11 @@ export interface Schema {
|
|
|
4
4
|
importPath?: string;
|
|
5
5
|
updateImportPath: boolean;
|
|
6
6
|
skipFormat?: boolean;
|
|
7
|
+
destinationRelativeToRoot?: boolean;
|
|
8
|
+
newProjectName?: string;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export interface NormalizedSchema extends Schema {
|
|
10
12
|
importPath: string;
|
|
11
|
-
newProjectName: string;
|
|
12
13
|
relativeToRootDestination: string;
|
|
13
14
|
}
|
|
@@ -10,7 +10,7 @@ export interface Schema {
|
|
|
10
10
|
standaloneConfig?: boolean;
|
|
11
11
|
framework?: string;
|
|
12
12
|
packageManager?: PackageManager;
|
|
13
|
-
bundler?: 'vite' | 'webpack';
|
|
13
|
+
bundler?: 'vite' | 'webpack' | 'rspack';
|
|
14
14
|
docker?: boolean;
|
|
15
15
|
routing?: boolean;
|
|
16
16
|
standaloneApi?: boolean;
|
|
@@ -4,22 +4,6 @@
|
|
|
4
4
|
"title": "Create a custom generator",
|
|
5
5
|
"description": "Create a custom generator.",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"name": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Generator name.",
|
|
11
|
-
"$default": {
|
|
12
|
-
"$source": "argv",
|
|
13
|
-
"index": 0
|
|
14
|
-
},
|
|
15
|
-
"x-prompt": "What name would you like to use for the workspace generator?"
|
|
16
|
-
},
|
|
17
|
-
"skipFormat": {
|
|
18
|
-
"description": "Skip formatting files.",
|
|
19
|
-
"type": "boolean",
|
|
20
|
-
"default": false,
|
|
21
|
-
"x-priority": "internal"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
7
|
+
"properties": {},
|
|
24
8
|
"required": ["name"]
|
|
25
9
|
}
|
|
@@ -2,26 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("../../utils/versions");
|
|
6
5
|
function default_1(host, schema) {
|
|
7
6
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
18
|
-
}
|
|
19
|
-
return installTask;
|
|
7
|
+
const message = (0, devkit_1.stripIndents) `Workspace Generators are no longer supported. Instead,
|
|
8
|
+
Nx now supports executing generators or executors from local plugins. To get
|
|
9
|
+
started, install @nx/nx-plugin and run \`nx g plugin\`.
|
|
10
|
+
|
|
11
|
+
Afterwards, or if you already have an Nx plugin, you can run
|
|
12
|
+
\`nx g generator --project {my-plugin}\` to add a new generator.
|
|
13
|
+
|
|
14
|
+
For more information, see: https://nx.dev/deprecated/workspace-generators`;
|
|
15
|
+
throw new Error(message);
|
|
20
16
|
});
|
|
21
17
|
}
|
|
22
18
|
exports.default = default_1;
|
|
23
|
-
function normalizeOptions(options) {
|
|
24
|
-
const name = (0, devkit_1.names)(options.name).fileName;
|
|
25
|
-
return Object.assign(Object.assign({}, options), { name, tmpl: '' });
|
|
26
|
-
}
|
|
27
19
|
//# sourceMappingURL=workspace-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-generator.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/workspace-generator/workspace-generator.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"workspace-generator.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/workspace-generator/workspace-generator.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAEhD,mBAA+B,IAAU,EAAE,MAAc;;QACvD,MAAM,OAAO,GAAG,IAAA,qBAAY,EAAA;;;;;;;8EAOgD,CAAC;QAE7E,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CAAA;AAXD,4BAWC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
// nx-ignore-next-line
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const move_1 = require("../../generators/move/move");
|
|
8
|
+
const versions_1 = require("../../utils/versions");
|
|
9
|
+
const PROJECT_NAME = 'workspace-plugin';
|
|
10
|
+
const DESTINATION = `tools/${PROJECT_NAME}`;
|
|
11
|
+
function default_1(tree) {
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const tasks = [];
|
|
14
|
+
if (!tree.children('tools/generators').length) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let project = (0, devkit_1.getProjects)(tree).get(PROJECT_NAME);
|
|
18
|
+
if (!project) {
|
|
19
|
+
yield createNewPlugin(tree);
|
|
20
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
21
|
+
'@nx/nx-plugin': versions_1.nxVersion,
|
|
22
|
+
}));
|
|
23
|
+
project = (0, devkit_1.readProjectConfiguration)(tree, PROJECT_NAME);
|
|
24
|
+
}
|
|
25
|
+
yield updateExistingPlugin(tree, project);
|
|
26
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
27
|
+
return () => {
|
|
28
|
+
for (const task of tasks) {
|
|
29
|
+
task();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.default = default_1;
|
|
35
|
+
// Inspired by packages/nx/src/command-line/workspace-generators.ts
|
|
36
|
+
function collectAndMoveGenerators(tree, destinationProjectRoot) {
|
|
37
|
+
var _a;
|
|
38
|
+
const generators = {};
|
|
39
|
+
const generatorsDir = 'tools/generators';
|
|
40
|
+
const destinationDir = (0, devkit_1.joinPathFragments)(destinationProjectRoot, 'src', 'generators');
|
|
41
|
+
for (const c of tree.children('tools/generators')) {
|
|
42
|
+
const childDir = path.join(generatorsDir, c);
|
|
43
|
+
const schemaPath = (0, devkit_1.joinPathFragments)(childDir, 'schema.json');
|
|
44
|
+
if (tree.exists(schemaPath)) {
|
|
45
|
+
const schema = (0, devkit_1.readJson)(tree, schemaPath);
|
|
46
|
+
generators[c] = {
|
|
47
|
+
implementation: `./src/generators/${c}`,
|
|
48
|
+
schema: `./src/generators/${(0, devkit_1.joinPathFragments)(c, 'schema.json')}`,
|
|
49
|
+
description: (_a = schema.description) !== null && _a !== void 0 ? _a : `Generator ${c}`,
|
|
50
|
+
};
|
|
51
|
+
tree.rename(childDir, (0, devkit_1.joinPathFragments)(destinationDir, c));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return generators;
|
|
55
|
+
}
|
|
56
|
+
function createNewPlugin(tree) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
(0, devkit_1.ensurePackage)('@nx/nx-plugin', versions_1.nxVersion);
|
|
59
|
+
const { pluginGenerator } =
|
|
60
|
+
// nx-ignore-next-line
|
|
61
|
+
require('@nx/nx-plugin/src/generators/plugin/plugin');
|
|
62
|
+
// nx-ignore-next-line
|
|
63
|
+
const { Linter } = (0, devkit_1.ensurePackage)('@nx/linter', versions_1.nxVersion);
|
|
64
|
+
const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
65
|
+
const importPath = npmScope ? `${npmScope}/${PROJECT_NAME}` : PROJECT_NAME;
|
|
66
|
+
yield pluginGenerator(tree, {
|
|
67
|
+
minimal: true,
|
|
68
|
+
name: PROJECT_NAME,
|
|
69
|
+
importPath: importPath,
|
|
70
|
+
skipTsConfig: false,
|
|
71
|
+
compiler: 'tsc',
|
|
72
|
+
linter: Linter.EsLint,
|
|
73
|
+
skipFormat: true,
|
|
74
|
+
skipLintChecks: false,
|
|
75
|
+
unitTestRunner: 'jest',
|
|
76
|
+
e2eTestRunner: 'none',
|
|
77
|
+
});
|
|
78
|
+
getCreateGeneratorsJson()(tree, (0, devkit_1.readProjectConfiguration)(tree, PROJECT_NAME).root, PROJECT_NAME);
|
|
79
|
+
yield moveGeneratedPlugin(tree, DESTINATION, importPath);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function moveGeneratedPlugin(tree, destination, importPath) {
|
|
83
|
+
const config = (0, devkit_1.readProjectConfiguration)(tree, PROJECT_NAME);
|
|
84
|
+
if (config.root !== DESTINATION) {
|
|
85
|
+
return (0, move_1.moveGenerator)(tree, {
|
|
86
|
+
destination,
|
|
87
|
+
projectName: PROJECT_NAME,
|
|
88
|
+
newProjectName: PROJECT_NAME,
|
|
89
|
+
updateImportPath: true,
|
|
90
|
+
destinationRelativeToRoot: true,
|
|
91
|
+
importPath: importPath,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function updateExistingPlugin(tree, project) {
|
|
96
|
+
const packageJson = (0, devkit_1.readJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'));
|
|
97
|
+
const defaultGeneratorsPath = (0, devkit_1.joinPathFragments)(project.root, 'generators.json');
|
|
98
|
+
let generatorsJsonPath = packageJson.generators ||
|
|
99
|
+
packageJson.schematics ||
|
|
100
|
+
tree.exists(defaultGeneratorsPath)
|
|
101
|
+
? defaultGeneratorsPath
|
|
102
|
+
: null;
|
|
103
|
+
if (!generatorsJsonPath) {
|
|
104
|
+
getCreateGeneratorsJson()(tree, (0, devkit_1.readProjectConfiguration)(tree, PROJECT_NAME).root, PROJECT_NAME);
|
|
105
|
+
generatorsJsonPath = defaultGeneratorsPath;
|
|
106
|
+
}
|
|
107
|
+
(0, devkit_1.updateJson)(tree, generatorsJsonPath, (json) => {
|
|
108
|
+
var _a;
|
|
109
|
+
const generators = collectAndMoveGenerators(tree, project.root);
|
|
110
|
+
(_a = json.generators) !== null && _a !== void 0 ? _a : (json.generators = {});
|
|
111
|
+
for (const generator in generators) {
|
|
112
|
+
if (json.generators[generator]) {
|
|
113
|
+
devkit_1.output.warn({
|
|
114
|
+
title: `Generator ${generator} already exists in ${project.name}`,
|
|
115
|
+
bodyLines: [
|
|
116
|
+
'Since you have a generator with the same name in your plugin, the generator from workspace-generators has been discarded.',
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
json.generators[generator] = generators[generator];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return json;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function getCreateGeneratorsJson() {
|
|
128
|
+
// We cant use `as typeof import('@nx/nx-plugin/src/generators/generator/generator');` here
|
|
129
|
+
// because it will cause a typescript error at build time.
|
|
130
|
+
const { createGeneratorsJson } =
|
|
131
|
+
// nx-ignore-next-line
|
|
132
|
+
require('@nx/nx-plugin/src/generators/generator/generator');
|
|
133
|
+
return createGeneratorsJson;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=move-workspace-generators-to-local-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move-workspace-generators-to-local-plugin.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts"],"names":[],"mappings":";;;AAAA,uCAcoB;AACpB,sBAAsB;AACtB,6BAA6B;AAK7B,qDAA2D;AAC3D,mDAAiD;AAGjD,MAAM,YAAY,GAAG,kBAAkB,CAAC;AACxC,MAAM,WAAW,GAAG,SAAS,YAAY,EAAE,CAAC;AAE5C,mBAA+B,IAAU;;QACvC,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,MAAM,EAAE;YAC7C,OAAO;SACR;QAED,IAAI,OAAO,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CACR,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;gBACE,eAAe,EAAE,oBAAS;aAC3B,CACF,CACF,CAAC;YACF,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;SACxD;QACD,MAAM,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1C,MAAM,IAAA,oBAAW,EAAC,IA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;aACpD;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,uBAAuB;IAO9B,4FAA4F;IAC5F,0DAA0D;IAC1D,MAAM,EAAE,oBAAoB,EAAE;IAC5B,sBAAsB;IACtB,OAAO,CAAC,kDAAkD,CAAC,CAAC;IAC9D,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
+
import type { Node, SyntaxKind } from 'typescript';
|
|
2
3
|
export declare function readTsConfig(tsConfigPath: string): import("typescript").ParsedCommandLine;
|
|
3
4
|
export declare function getRootTsConfigPathInTree(tree: Tree): string | null;
|
|
4
5
|
export declare function getRelativePathToRootTsConfig(tree: Tree, targetPath: string): string;
|
|
5
6
|
export declare function getRootTsConfigFileName(): string | null;
|
|
7
|
+
export declare function findNodes(node: Node, kind: SyntaxKind | SyntaxKind[], max?: number): Node[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRootTsConfigFileName = exports.getRelativePathToRootTsConfig = exports.getRootTsConfigPathInTree = exports.readTsConfig = void 0;
|
|
3
|
+
exports.findNodes = exports.getRootTsConfigFileName = exports.getRelativePathToRootTsConfig = exports.getRootTsConfigPathInTree = exports.readTsConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -37,4 +37,32 @@ function getRootTsConfigFileName() {
|
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
exports.getRootTsConfigFileName = getRootTsConfigFileName;
|
|
40
|
+
function findNodes(node, kind, max = Infinity) {
|
|
41
|
+
if (!node || max == 0) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const arr = [];
|
|
45
|
+
const hasMatch = Array.isArray(kind)
|
|
46
|
+
? kind.includes(node.kind)
|
|
47
|
+
: node.kind === kind;
|
|
48
|
+
if (hasMatch) {
|
|
49
|
+
arr.push(node);
|
|
50
|
+
max--;
|
|
51
|
+
}
|
|
52
|
+
if (max > 0) {
|
|
53
|
+
for (const child of node.getChildren()) {
|
|
54
|
+
findNodes(child, kind, max).forEach((node) => {
|
|
55
|
+
if (max > 0) {
|
|
56
|
+
arr.push(node);
|
|
57
|
+
}
|
|
58
|
+
max--;
|
|
59
|
+
});
|
|
60
|
+
if (max <= 0) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return arr;
|
|
66
|
+
}
|
|
67
|
+
exports.findNodes = findNodes;
|
|
40
68
|
//# sourceMappingURL=ts-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-config.js","sourceRoot":"","sources":["../../../../../packages/workspace/src/utilities/ts-config.ts"],"names":[],"mappings":";;;AAAA,uCAAiE;AACjE,2BAAgC;AAChC,+BAAqC;
|
|
1
|
+
{"version":3,"file":"ts-config.js","sourceRoot":"","sources":["../../../../../packages/workspace/src/utilities/ts-config.ts"],"names":[],"mappings":";;;AAAA,uCAAiE;AACjE,2BAAgC;AAChC,+BAAqC;AAErC,6CAAgD;AAEhD,IAAI,QAAqC,CAAC;AAE1C,SAAgB,YAAY,CAAC,YAAoB;IAC/C,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAA,6BAAgB,GAAE,CAAC;KAC/B;IACD,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CACxC,YAAY,EACZ,QAAQ,CAAC,GAAG,CAAC,QAAQ,CACtB,CAAC;IACF,OAAO,QAAQ,CAAC,0BAA0B,CACxC,UAAU,CAAC,MAAM,EACjB,QAAQ,CAAC,GAAG,EACZ,IAAA,cAAO,EAAC,YAAY,CAAC,CACtB,CAAC;AACJ,CAAC;AAbD,oCAaC;AAED,SA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AE,EAAE;YACtC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC3C,IAAI,GAAG,GAAG,CAAC,EAAE;oBACX,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAChB;gBACD,GAAG,EAAE,CAAC;YACR,CAAC,CAAC,CAAC;YAEH,IAAI,GAAG,IAAI,CAAC,EAAE;gBACZ,MAAM;aACP;SACF;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAjCD,8BAiCC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tree, formatFiles, installPackagesTask } from '@nx/devkit';
|
|
2
|
-
import { libraryGenerator } from '@nx/js';
|
|
3
|
-
|
|
4
|
-
export default async function(tree: Tree, schema: any) {
|
|
5
|
-
await libraryGenerator(tree, {name: schema.name});
|
|
6
|
-
await formatFiles(tree);
|
|
7
|
-
return () => {
|
|
8
|
-
installPackagesTask(tree)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "<%= name %>",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"name": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "Library name",
|
|
10
|
-
"$default": {
|
|
11
|
-
"$source": "argv",
|
|
12
|
-
"index": 0
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"required": ["name"]
|
|
17
|
-
}
|