nx 18.1.0-beta.2 → 18.1.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 -1
- package/package.json +13 -12
- package/schemas/nx-schema.json +20 -2
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.d.ts +2 -1
- package/src/adapter/angular-json.js +1 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +2 -0
- package/src/adapter/ngcli-adapter.js +3 -3
- package/src/command-line/add/add.js +2 -1
- package/src/command-line/generate/generator-utils.js +2 -2
- package/src/command-line/graph/graph.js +1 -1
- package/src/command-line/init/command-object.js +3 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +2 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +2 -2
- package/src/command-line/init/implementation/utils.d.ts +1 -3
- package/src/command-line/init/implementation/utils.js +10 -18
- package/src/command-line/init/init-v2.js +20 -12
- package/src/command-line/migrate/migrate.js +3 -1
- package/src/command-line/release/changelog.js +43 -2
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/config/config.d.ts +2 -15
- package/src/command-line/release/config/config.js +62 -19
- package/src/command-line/release/publish.js +4 -3
- package/src/command-line/release/release.js +12 -11
- package/src/command-line/release/utils/git.js +45 -2
- package/src/command-line/release/utils/shared.d.ts +5 -1
- package/src/command-line/release/version.d.ts +4 -1
- package/src/command-line/release/version.js +70 -19
- package/src/command-line/run/executor-utils.js +2 -2
- package/src/config/nx-json.d.ts +18 -0
- package/src/config/schema-utils.js +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +4 -1
- package/src/devkit-exports.d.ts +3 -2
- package/src/devkit-exports.js +2 -1
- package/src/devkit-internals.d.ts +1 -0
- package/src/devkit-internals.js +3 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +4 -1
- package/src/executors/run-commands/run-commands.impl.js +34 -14
- package/src/generators/utils/project-configuration.js +17 -3
- package/src/migrations/update-15-1-0/set-project-names.js +4 -2
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +21 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +4 -24
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/lock-file/lock-file.d.ts +1 -1
- package/src/plugins/js/lock-file/lock-file.js +13 -1
- package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
- package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
- package/src/plugins/package-json-workspaces/create-nodes.js +24 -31
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +1 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -1
- package/src/plugins/project-json/build-nodes/project-json.js +1 -0
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +17 -6
- package/src/plugins/target-defaults/target-defaults-plugin.js +40 -31
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -3
- package/src/project-graph/build-project-graph.js +11 -11
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/plugins/index.d.ts +2 -0
- package/src/project-graph/plugins/index.js +8 -0
- package/src/project-graph/plugins/internal-api.d.ts +18 -0
- package/src/project-graph/plugins/internal-api.js +48 -0
- package/src/project-graph/plugins/messaging.d.ts +94 -0
- package/src/project-graph/plugins/messaging.js +23 -0
- package/src/project-graph/plugins/plugin-pool.d.ts +4 -0
- package/src/project-graph/plugins/plugin-pool.js +216 -0
- package/src/project-graph/plugins/plugin-worker.d.ts +1 -0
- package/src/project-graph/plugins/plugin-worker.js +115 -0
- package/src/{utils/nx-plugin.d.ts → project-graph/plugins/public-api.d.ts} +7 -41
- package/src/project-graph/plugins/public-api.js +4 -0
- package/src/project-graph/plugins/utils.d.ts +9 -0
- package/src/project-graph/plugins/utils.js +55 -0
- package/src/project-graph/plugins/worker-api.d.ts +26 -0
- package/src/project-graph/plugins/worker-api.js +177 -0
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph.js +2 -2
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +35 -64
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +8 -4
- package/src/project-graph/utils/retrieve-workspace-files.js +17 -15
- package/src/tasks-runner/task-orchestrator.js +23 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.d.ts +1 -0
- package/src/utils/logger.js +5 -0
- package/src/utils/nx-plugin.deprecated.d.ts +4 -2
- package/src/utils/nx-plugin.deprecated.js +4 -4
- package/src/utils/package-json.js +2 -2
- package/src/utils/package-manager.d.ts +6 -0
- package/src/utils/package-manager.js +16 -1
- package/src/utils/plugins/core-plugins.js +4 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
- package/src/utils/plugins/plugin-capabilities.js +8 -7
- package/src/utils/nx-plugin.js +0 -293
package/migrations.json
CHANGED
|
@@ -86,9 +86,14 @@
|
|
|
86
86
|
"18.0.0-disable-adding-plugins-for-existing-workspaces": {
|
|
87
87
|
"cli": "nx",
|
|
88
88
|
"version": "18.0.0-beta.2",
|
|
89
|
-
"description": "Updates .
|
|
89
|
+
"description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
|
|
90
90
|
"implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
|
|
91
91
|
"x-repair-skip": true
|
|
92
|
+
},
|
|
93
|
+
"move-default-base-to-nx-json-root": {
|
|
94
|
+
"version": "18.1.0-beta.3",
|
|
95
|
+
"description": "Moves affected.defaultBase to defaultBase in `nx.json`",
|
|
96
|
+
"implementation": "./src/migrations/update-17-2-0/move-default-base"
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "18.1.0-beta.
|
|
3
|
+
"version": "18.1.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yargs-parser": "21.1.1",
|
|
67
67
|
"node-machine-id": "1.1.12",
|
|
68
68
|
"ora": "5.3.0",
|
|
69
|
-
"@nrwl/tao": "18.1.0-beta.
|
|
69
|
+
"@nrwl/tao": "18.1.0-beta.4"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@swc-node/register": "^1.8.0",
|
|
@@ -81,16 +81,16 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
|
84
|
-
"@nx/nx-darwin-x64": "18.1.0-beta.
|
|
85
|
-
"@nx/nx-darwin-arm64": "18.1.0-beta.
|
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.1.0-beta.
|
|
87
|
-
"@nx/nx-linux-x64-musl": "18.1.0-beta.
|
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.1.0-beta.
|
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.1.0-beta.
|
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.1.0-beta.
|
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.1.0-beta.
|
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.1.0-beta.
|
|
93
|
-
"@nx/nx-freebsd-x64": "18.1.0-beta.
|
|
84
|
+
"@nx/nx-darwin-x64": "18.1.0-beta.4",
|
|
85
|
+
"@nx/nx-darwin-arm64": "18.1.0-beta.4",
|
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.1.0-beta.4",
|
|
87
|
+
"@nx/nx-linux-x64-musl": "18.1.0-beta.4",
|
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.1.0-beta.4",
|
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.1.0-beta.4",
|
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.1.0-beta.4",
|
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.1.0-beta.4",
|
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.1.0-beta.4",
|
|
93
|
+
"@nx/nx-freebsd-x64": "18.1.0-beta.4"
|
|
94
94
|
},
|
|
95
95
|
"nx-migrations": {
|
|
96
96
|
"migrations": "./migrations.json",
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
"@nrwl/next",
|
|
127
127
|
"@nx/node",
|
|
128
128
|
"@nrwl/node",
|
|
129
|
+
"@nx/nuxt",
|
|
129
130
|
"@nx/playwright",
|
|
130
131
|
"@nx/plugin",
|
|
131
132
|
"@nrwl/nx-plugin",
|
package/schemas/nx-schema.json
CHANGED
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
"description": "Default based branch used by affected commands."
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"additionalProperties": false
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"deprecated": "Use `defaultBase` instead. Support for setting `defaultBase` in `affected` will be removed in Nx 19."
|
|
23
|
+
},
|
|
24
|
+
"defaultBase": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Default --base used by affected logic."
|
|
22
27
|
},
|
|
23
28
|
"tasksRunnerOptions": {
|
|
24
29
|
"type": "object",
|
|
@@ -96,6 +101,10 @@
|
|
|
96
101
|
"type": "boolean",
|
|
97
102
|
"description": "Specifies whether the daemon should be used for the default tasks runner."
|
|
98
103
|
},
|
|
104
|
+
"useInferencePlugins": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"description": "Specifies whether to add inference plugins when generating new projects."
|
|
107
|
+
},
|
|
99
108
|
"release": {
|
|
100
109
|
"type": "object",
|
|
101
110
|
"description": "Configuration for the nx release commands.",
|
|
@@ -148,11 +157,16 @@
|
|
|
148
157
|
"$ref": "#/definitions/NxReleaseVersionConfiguration"
|
|
149
158
|
},
|
|
150
159
|
{
|
|
151
|
-
"
|
|
160
|
+
"allOf": [
|
|
152
161
|
{
|
|
153
162
|
"not": {
|
|
154
163
|
"required": ["git"]
|
|
155
164
|
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"not": {
|
|
168
|
+
"required": ["preVersionCommand"]
|
|
169
|
+
}
|
|
156
170
|
}
|
|
157
171
|
]
|
|
158
172
|
}
|
|
@@ -567,6 +581,10 @@
|
|
|
567
581
|
},
|
|
568
582
|
"git": {
|
|
569
583
|
"$ref": "#/definitions/NxReleaseGitConfiguration"
|
|
584
|
+
},
|
|
585
|
+
"preVersionCommand": {
|
|
586
|
+
"type": "string",
|
|
587
|
+
"description": "A command to run after validation of nx release configuration, but before versioning begins. Used for preparing build artifacts. If --dry-run is passed, the command is still executed, but with the NX_DRY_RUN environment variable set to 'true'."
|
|
570
588
|
}
|
|
571
589
|
}
|
|
572
590
|
},
|
|
@@ -127,6 +127,26 @@
|
|
|
127
127
|
"items": {
|
|
128
128
|
"type": "string"
|
|
129
129
|
}
|
|
130
|
+
},
|
|
131
|
+
"release": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"description": "Configuration for the nx release commands.",
|
|
134
|
+
"properties": {
|
|
135
|
+
"version": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"description": "Configuration for the nx release version command.",
|
|
138
|
+
"properties": {
|
|
139
|
+
"generator": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"description": "The version generator to use. Defaults to @nx/js:release-version."
|
|
142
|
+
},
|
|
143
|
+
"generatorOptions": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"description": "Options for the version generator."
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
130
150
|
}
|
|
131
151
|
},
|
|
132
152
|
"definitions": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ProjectsConfigurations } from '../config/workspace-json-project-json';
|
|
2
|
-
import { NxPluginV2 } from '../
|
|
2
|
+
import { NxPluginV2 } from '../project-graph/plugins';
|
|
3
3
|
export declare const NX_ANGULAR_JSON_PLUGIN_NAME = "nx-angular-json-plugin";
|
|
4
4
|
export declare const NxAngularJsonPlugin: NxPluginV2;
|
|
5
|
+
export default NxAngularJsonPlugin;
|
|
5
6
|
export declare function shouldMergeAngularProjects(root: string, includeProjectsFromAngularJson: boolean): boolean;
|
|
6
7
|
export declare function isAngularPluginInstalled(): boolean;
|
|
7
8
|
export declare function toNewFormat(w: any): ProjectsConfigurations;
|
|
@@ -14,6 +14,7 @@ exports.NxAngularJsonPlugin = {
|
|
|
14
14
|
}),
|
|
15
15
|
],
|
|
16
16
|
};
|
|
17
|
+
exports.default = exports.NxAngularJsonPlugin;
|
|
17
18
|
function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
|
|
18
19
|
if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
|
|
19
20
|
// Include projects from angular.json if explicitly required.
|
package/src/adapter/compat.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts"];
|
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess"];
|
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins"];
|
package/src/adapter/compat.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.allowedProjectExtensions = [
|
|
|
38
38
|
exports.allowedWorkspaceExtensions = [
|
|
39
39
|
'implicitDependencies',
|
|
40
40
|
'affected',
|
|
41
|
+
'defaultBase',
|
|
41
42
|
'tasksRunnerOptions',
|
|
42
43
|
'workspaceLayout',
|
|
43
44
|
'plugins',
|
|
@@ -57,6 +58,7 @@ exports.allowedWorkspaceExtensions = [
|
|
|
57
58
|
'parallel',
|
|
58
59
|
'cacheDirectory',
|
|
59
60
|
'useDaemonProcess',
|
|
61
|
+
'useInferencePlugins',
|
|
60
62
|
];
|
|
61
63
|
if (!patched) {
|
|
62
64
|
Module.prototype.require = function () {
|
|
@@ -19,7 +19,7 @@ const package_json_1 = require("../utils/package-json");
|
|
|
19
19
|
const package_manager_1 = require("../utils/package-manager");
|
|
20
20
|
const angular_json_1 = require("./angular-json");
|
|
21
21
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
|
22
|
-
const
|
|
22
|
+
const plugins_1 = require("../project-graph/plugins");
|
|
23
23
|
const schema_utils_1 = require("../config/schema-utils");
|
|
24
24
|
async function createBuilderContext(builderInfo, context) {
|
|
25
25
|
require('./compat');
|
|
@@ -146,7 +146,7 @@ function createNodeModulesEngineHost(resolvePaths, projects) {
|
|
|
146
146
|
collectionFilePath = require.resolve(name, { paths });
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
149
|
-
const { json: { generators, schematics }, path: packageJsonPath, } = (0,
|
|
149
|
+
const { json: { generators, schematics }, path: packageJsonPath, } = (0, plugins_1.readPluginPackageJson)(name, projects, paths);
|
|
150
150
|
if (!schematics && !generators) {
|
|
151
151
|
throw new Error(`The "${name}" package does not support Nx generators or Angular Devkit schematics.`);
|
|
152
152
|
}
|
|
@@ -802,7 +802,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
|
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
804
|
readExecutorsJson(nodeModule, builder) {
|
|
805
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
|
805
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
|
|
806
806
|
const executorsFile = packageJson.executors ?? packageJson.builders;
|
|
807
807
|
if (!executorsFile) {
|
|
808
808
|
throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
|
|
@@ -97,7 +97,8 @@ async function initializePlugin(pkgName, options) {
|
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
updatePackageScripts =
|
|
100
|
-
|
|
100
|
+
(0, nx_json_1.readNxJson)().useInferencePlugins !== false &&
|
|
101
|
+
process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
101
102
|
coreNxPlugins.includes(pkgName);
|
|
102
103
|
}
|
|
103
104
|
await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator} --keepExistingVersions${updatePackageScripts ? ' --updatePackageScripts' : ''}`, {
|
|
@@ -4,7 +4,7 @@ exports.readGeneratorsJson = exports.getGeneratorInformation = void 0;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const schema_utils_1 = require("../../config/schema-utils");
|
|
6
6
|
const fileutils_1 = require("../../utils/fileutils");
|
|
7
|
-
const
|
|
7
|
+
const plugins_1 = require("../../project-graph/plugins");
|
|
8
8
|
function getGeneratorInformation(collectionName, generatorName, root, projects) {
|
|
9
9
|
try {
|
|
10
10
|
const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
|
|
@@ -48,7 +48,7 @@ function readGeneratorsJson(collectionName, generator, root, projects) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
const { json: packageJson, path: packageJsonPath } = (0,
|
|
51
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
|
|
52
52
|
const generatorsFile = packageJson.generators ?? packageJson.schematics;
|
|
53
53
|
if (!generatorsFile) {
|
|
54
54
|
throw new Error(`The "${collectionName}" package does not support Nx generators.`);
|
|
@@ -266,7 +266,7 @@ async function generateGraph(args, affectedProjects) {
|
|
|
266
266
|
const { app, url } = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude);
|
|
267
267
|
url.pathname = args.view;
|
|
268
268
|
if (args.focus) {
|
|
269
|
-
url.pathname += '/' + args.focus;
|
|
269
|
+
url.pathname += '/' + encodeURIComponent(args.focus);
|
|
270
270
|
}
|
|
271
271
|
if (target) {
|
|
272
272
|
url.pathname += '/' + target;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsInitCommand = void 0;
|
|
4
4
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
|
5
|
-
const
|
|
5
|
+
const nx_json_1 = require("../../config/nx-json");
|
|
6
|
+
const useV2 = process.env['NX_ADD_PLUGINS'] !== 'false' &&
|
|
7
|
+
(0, nx_json_1.readNxJson)().useInferencePlugins !== false;
|
|
6
8
|
exports.yargsInitCommand = {
|
|
7
9
|
command: 'init',
|
|
8
10
|
describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
|
|
@@ -73,12 +73,12 @@ async function addNxToNest(options, packageJson) {
|
|
|
73
73
|
? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)()
|
|
74
74
|
: false);
|
|
75
75
|
}
|
|
76
|
-
(0, utils_1.createNxJsonFile)(repoRoot, [], [...cacheableOperations, ...nestCacheableScripts],
|
|
76
|
+
(0, utils_1.createNxJsonFile)(repoRoot, [], [...cacheableOperations, ...nestCacheableScripts], scriptOutputs);
|
|
77
77
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
78
78
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
79
79
|
(0, utils_1.addDepsToPackageJson)(repoRoot);
|
|
80
80
|
addNestPluginToPackageJson(repoRoot);
|
|
81
|
-
(0, utils_1.markRootPackageJsonAsNxProject)(repoRoot, cacheableOperations,
|
|
81
|
+
(0, utils_1.markRootPackageJsonAsNxProject)(repoRoot, cacheableOperations, pmc);
|
|
82
82
|
createProjectJson(repoRoot, packageJson, nestCLIConfiguration);
|
|
83
83
|
removeFile(repoRoot, 'nest-cli.json');
|
|
84
84
|
updatePackageJsonScripts(repoRoot, isJS);
|
|
@@ -48,11 +48,11 @@ async function addNxToNpmRepo(options) {
|
|
|
48
48
|
? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)()
|
|
49
49
|
: false);
|
|
50
50
|
}
|
|
51
|
-
(0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations,
|
|
51
|
+
(0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations, scriptOutputs);
|
|
52
52
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
53
53
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
54
54
|
(0, utils_1.addDepsToPackageJson)(repoRoot);
|
|
55
|
-
(0, utils_1.markRootPackageJsonAsNxProject)(repoRoot, cacheableOperations,
|
|
55
|
+
(0, utils_1.markRootPackageJsonAsNxProject)(repoRoot, cacheableOperations, pmc);
|
|
56
56
|
output_1.output.log({ title: '📦 Installing dependencies' });
|
|
57
57
|
(0, utils_1.runInstall)(repoRoot, pmc);
|
|
58
58
|
if (useNxCloud) {
|
|
@@ -8,9 +8,7 @@ export declare function updateGitIgnore(root: string): void;
|
|
|
8
8
|
export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommands): void;
|
|
9
9
|
export declare function initCloud(repoRoot: string, installationSource: 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): void;
|
|
10
10
|
export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void;
|
|
11
|
-
export declare function markRootPackageJsonAsNxProject(repoRoot: string, cacheableScripts: string[],
|
|
12
|
-
[script: string]: string;
|
|
13
|
-
}, pmc: PackageManagerCommands): void;
|
|
11
|
+
export declare function markRootPackageJsonAsNxProject(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void;
|
|
14
12
|
export declare function printFinalMessage({ learnMoreLink, bodyLines, }: {
|
|
15
13
|
learnMoreLink?: string;
|
|
16
14
|
bodyLines?: string[];
|
|
@@ -25,14 +25,14 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
|
|
|
25
25
|
nxJson.targetDefaults[scriptName] ??= {};
|
|
26
26
|
nxJson.targetDefaults[scriptName] = { dependsOn: [`^${scriptName}`] };
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
nxJson.targetDefaults[scriptName] ??= {};
|
|
34
|
-
nxJson.targetDefaults[scriptName].outputs = [`{projectRoot}/${output}`];
|
|
28
|
+
}
|
|
29
|
+
for (const [scriptName, output] of Object.entries(scriptOutputs)) {
|
|
30
|
+
if (!output) {
|
|
31
|
+
// eslint-disable-next-line no-continue
|
|
32
|
+
continue;
|
|
35
33
|
}
|
|
34
|
+
nxJson.targetDefaults[scriptName] ??= {};
|
|
35
|
+
nxJson.targetDefaults[scriptName].outputs = [`{projectRoot}/${output}`];
|
|
36
36
|
}
|
|
37
37
|
for (const target of cacheableOperations) {
|
|
38
38
|
nxJson.targetDefaults[target] ??= {};
|
|
@@ -41,8 +41,7 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
|
|
|
41
41
|
if (Object.keys(nxJson.targetDefaults).length === 0) {
|
|
42
42
|
delete nxJson.targetDefaults;
|
|
43
43
|
}
|
|
44
|
-
nxJson.
|
|
45
|
-
nxJson.affected.defaultBase ??= deduceDefaultBase();
|
|
44
|
+
nxJson.defaultBase ??= deduceDefaultBase();
|
|
46
45
|
(0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
|
|
47
46
|
}
|
|
48
47
|
exports.createNxJsonFile = createNxJsonFile;
|
|
@@ -135,16 +134,9 @@ function addVsCodeRecommendedExtensions(repoRoot, extensions) {
|
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
136
|
exports.addVsCodeRecommendedExtensions = addVsCodeRecommendedExtensions;
|
|
138
|
-
function markRootPackageJsonAsNxProject(repoRoot, cacheableScripts,
|
|
137
|
+
function markRootPackageJsonAsNxProject(repoRoot, cacheableScripts, pmc) {
|
|
139
138
|
const json = (0, fileutils_1.readJsonFile)((0, path_2.joinPathFragments)(repoRoot, `package.json`));
|
|
140
|
-
json.nx = {
|
|
141
|
-
for (let script of Object.keys(scriptOutputs)) {
|
|
142
|
-
if (scriptOutputs[script]) {
|
|
143
|
-
json.nx.targets[script] = {
|
|
144
|
-
outputs: [`{projectRoot}/${scriptOutputs[script]}`],
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
139
|
+
json.nx = {};
|
|
148
140
|
for (let script of cacheableScripts) {
|
|
149
141
|
const scriptDefinition = json.scripts[script];
|
|
150
142
|
if (!scriptDefinition) {
|
|
@@ -17,7 +17,9 @@ const workspace_context_1 = require("../../utils/workspace-context");
|
|
|
17
17
|
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
|
18
18
|
const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
|
|
19
19
|
const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
|
|
20
|
+
const path_1 = require("path");
|
|
20
21
|
async function initHandler(options) {
|
|
22
|
+
process.env.NX_RUNNING_NX_INIT = 'true';
|
|
21
23
|
const version = process.env.NX_VERSION ?? ((0, semver_1.prerelease)(versions_1.nxVersion) ? 'next' : 'latest');
|
|
22
24
|
if (process.env.NX_VERSION) {
|
|
23
25
|
output_1.output.log({ title: `Using version ${process.env.NX_VERSION}` });
|
|
@@ -31,7 +33,7 @@ async function initHandler(options) {
|
|
|
31
33
|
}
|
|
32
34
|
(0, add_nx_scripts_1.generateDotNxSetup)(version);
|
|
33
35
|
// invokes the wrapper, thus invoking the initial installation process
|
|
34
|
-
(0, child_process_1.runNxSync)('');
|
|
36
|
+
(0, child_process_1.runNxSync)('--version', { stdio: 'ignore' });
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
39
|
// TODO(jack): Remove this Angular logic once `@nx/angular` is compatible with inferred targets.
|
|
@@ -42,6 +44,7 @@ async function initHandler(options) {
|
|
|
42
44
|
});
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
47
|
+
output_1.output.log({ title: '🧐 Checking dependencies' });
|
|
45
48
|
const detectPluginsResponse = await detectPlugins();
|
|
46
49
|
if (!detectPluginsResponse?.plugins.length) {
|
|
47
50
|
// If no plugins are detected/chosen, guide users to setup
|
|
@@ -63,19 +66,23 @@ async function initHandler(options) {
|
|
|
63
66
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
64
67
|
(0, utils_1.createNxJsonFile)(repoRoot, [], [], {});
|
|
65
68
|
(0, utils_1.updateGitIgnore)(repoRoot);
|
|
66
|
-
(0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse
|
|
69
|
+
(0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse.plugins);
|
|
67
70
|
output_1.output.log({ title: '📦 Installing Nx' });
|
|
68
71
|
(0, utils_1.runInstall)(repoRoot, pmc);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
output_1.output.log({ title: '🔨 Configuring plugins' });
|
|
73
|
+
for (const plugin of detectPluginsResponse.plugins) {
|
|
74
|
+
(0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${detectPluginsResponse.updatePackageScripts
|
|
75
|
+
? '--updatePackageScripts'
|
|
76
|
+
: ''} --no-interactive`, {
|
|
77
|
+
stdio: [0, 1, 2],
|
|
78
|
+
cwd: repoRoot,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (!detectPluginsResponse.updatePackageScripts) {
|
|
82
|
+
const rootPackageJsonPath = (0, path_1.join)(repoRoot, 'package.json');
|
|
83
|
+
const json = (0, fileutils_1.readJsonFile)(rootPackageJsonPath);
|
|
84
|
+
json.nx = { includedScripts: [] };
|
|
85
|
+
(0, fileutils_1.writeJsonFile)(rootPackageJsonPath, json);
|
|
79
86
|
}
|
|
80
87
|
if (useNxCloud) {
|
|
81
88
|
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
|
|
@@ -102,6 +109,7 @@ const npmPackageToPluginMap = {
|
|
|
102
109
|
vite: '@nx/vite',
|
|
103
110
|
vitest: '@nx/vite',
|
|
104
111
|
webpack: '@nx/webpack',
|
|
112
|
+
rollup: '@nx/rollup',
|
|
105
113
|
// Testing tools
|
|
106
114
|
jest: '@nx/jest',
|
|
107
115
|
cypress: '@nx/cypress',
|
|
@@ -872,7 +872,9 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
|
872
872
|
if (b.name === '15-7-0-split-configuration-into-project-json-files') {
|
|
873
873
|
return 1;
|
|
874
874
|
}
|
|
875
|
-
return (0, semver_1.lt)(a.version, b.version)
|
|
875
|
+
return (0, semver_1.lt)(normalizeVersion(a.version), normalizeVersion(b.version))
|
|
876
|
+
? -1
|
|
877
|
+
: 1;
|
|
876
878
|
});
|
|
877
879
|
for (const m of sortedMigrations) {
|
|
878
880
|
try {
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shouldCreateGitHubRelease = exports.releaseChangelog = exports.releaseChangelogCLIHandler = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
|
+
const enquirer_1 = require("enquirer");
|
|
5
6
|
const node_fs_1 = require("node:fs");
|
|
6
7
|
const semver_1 = require("semver");
|
|
7
8
|
const tmp_1 = require("tmp");
|
|
8
9
|
const nx_json_1 = require("../../config/nx-json");
|
|
9
10
|
const tree_1 = require("../../generators/tree");
|
|
10
11
|
const register_1 = require("../../plugins/js/utils/register");
|
|
12
|
+
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
|
11
13
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
12
14
|
const utils_1 = require("../../tasks-runner/utils");
|
|
15
|
+
const is_ci_1 = require("../../utils/is-ci");
|
|
13
16
|
const output_1 = require("../../utils/output");
|
|
14
17
|
const params_1 = require("../../utils/params");
|
|
15
18
|
const path_1 = require("../../utils/path");
|
|
@@ -38,7 +41,7 @@ async function releaseChangelog(args) {
|
|
|
38
41
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
|
39
42
|
}
|
|
40
43
|
// Apply default configuration to any optional user configuration
|
|
41
|
-
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, nxJson.release);
|
|
44
|
+
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), nxJson.release);
|
|
42
45
|
if (configError) {
|
|
43
46
|
return await (0, config_1.handleNxReleaseConfigError)(configError);
|
|
44
47
|
}
|
|
@@ -302,6 +305,25 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
302
305
|
`No changes were detected for any changelog files, so no changelog entries will be generated.`,
|
|
303
306
|
],
|
|
304
307
|
});
|
|
308
|
+
if (!postGitTasks.length) {
|
|
309
|
+
// no GitHub releases to create so we can just exit
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if ((0, is_ci_1.isCI)()) {
|
|
313
|
+
output_1.output.warn({
|
|
314
|
+
title: `Skipped GitHub release creation because no changes were detected for any changelog files.`,
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
// prompt the user to see if they want to create a GitHub release anyway
|
|
319
|
+
// we know that the user has configured GitHub releases because we have postGitTasks
|
|
320
|
+
const shouldCreateGitHubReleaseAnyway = await promptForGitHubRelease();
|
|
321
|
+
if (!shouldCreateGitHubReleaseAnyway) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
for (const postGitTask of postGitTasks) {
|
|
325
|
+
await postGitTask(latestCommit);
|
|
326
|
+
}
|
|
305
327
|
return;
|
|
306
328
|
}
|
|
307
329
|
// Generate a new commit for the changes, if configured to do so
|
|
@@ -339,6 +361,9 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
|
|
|
339
361
|
return;
|
|
340
362
|
}
|
|
341
363
|
function resolveChangelogRenderer(changelogRendererPath) {
|
|
364
|
+
const interpolatedChangelogRendererPath = (0, utils_1.interpolate)(changelogRendererPath, {
|
|
365
|
+
workspaceRoot: workspace_root_1.workspaceRoot,
|
|
366
|
+
});
|
|
342
367
|
// Try and load the provided (or default) changelog renderer
|
|
343
368
|
let changelogRenderer;
|
|
344
369
|
let cleanupTranspiler = () => { };
|
|
@@ -347,7 +372,7 @@ function resolveChangelogRenderer(changelogRendererPath) {
|
|
|
347
372
|
if (rootTsconfigPath) {
|
|
348
373
|
cleanupTranspiler = (0, register_1.registerTsProject)(rootTsconfigPath);
|
|
349
374
|
}
|
|
350
|
-
const r = require(
|
|
375
|
+
const r = require(interpolatedChangelogRendererPath);
|
|
351
376
|
changelogRenderer = r.default || r;
|
|
352
377
|
}
|
|
353
378
|
catch {
|
|
@@ -600,3 +625,19 @@ function shouldCreateGitHubRelease(changelogConfig, createReleaseArg = undefined
|
|
|
600
625
|
return (changelogConfig || {}).createRelease === 'github';
|
|
601
626
|
}
|
|
602
627
|
exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
|
|
628
|
+
async function promptForGitHubRelease() {
|
|
629
|
+
try {
|
|
630
|
+
const result = await (0, enquirer_1.prompt)([
|
|
631
|
+
{
|
|
632
|
+
name: 'confirmation',
|
|
633
|
+
message: 'Do you want to create a GitHub release anyway?',
|
|
634
|
+
type: 'confirm',
|
|
635
|
+
},
|
|
636
|
+
]);
|
|
637
|
+
return result.confirmation;
|
|
638
|
+
}
|
|
639
|
+
catch (e) {
|
|
640
|
+
// Handle the case where the user exits the prompt with ctrl+c
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
@@ -21,6 +21,7 @@ export type VersionOptions = NxReleaseArgs & GitCommitAndTagOptions & {
|
|
|
21
21
|
specifier?: string;
|
|
22
22
|
preid?: string;
|
|
23
23
|
stageChanges?: boolean;
|
|
24
|
+
generatorOptionsOverrides?: Record<string, unknown>;
|
|
24
25
|
};
|
|
25
26
|
export type ChangelogOptions = NxReleaseArgs & GitCommitAndTagOptions & {
|
|
26
27
|
version?: string | null;
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nx release` is a powerful feature which spans many possible use cases. The possible variations
|
|
3
|
-
* of configuration are therefore quite complex, particularly when you consider release groups.
|
|
4
|
-
*
|
|
5
|
-
* We want to provide the best possible DX for users so that they can harness the power of `nx release`
|
|
6
|
-
* most effectively, therefore we need to both provide sensible defaults for common scenarios (to avoid
|
|
7
|
-
* verbose nx.json files wherever possible), and proactively handle potential sources of config issues
|
|
8
|
-
* in more complex use-cases.
|
|
9
|
-
*
|
|
10
|
-
* This file is the source of truth for all `nx release` configuration reconciliation, including sensible
|
|
11
|
-
* defaults and user overrides, as well as handling common errors, up front to produce a single, consistent,
|
|
12
|
-
* and easy to consume config object for all the `nx release` command implementations.
|
|
13
|
-
*/
|
|
14
1
|
import { NxJsonConfiguration } from '../../../config/nx-json';
|
|
15
|
-
import {
|
|
2
|
+
import { ProjectFileMap, ProjectGraph } from '../../../config/project-graph';
|
|
16
3
|
type DeepRequired<T> = Required<{
|
|
17
4
|
[K in keyof T]: T[K] extends Required<T[K]> ? T[K] : DeepRequired<T[K]>;
|
|
18
5
|
}>;
|
|
@@ -48,7 +35,7 @@ export interface CreateNxReleaseConfigError {
|
|
|
48
35
|
code: 'PROJECTS_AND_GROUPS_DEFINED' | 'RELEASE_GROUP_MATCHES_NO_PROJECTS' | 'RELEASE_GROUP_RELEASE_TAG_PATTERN_VERSION_PLACEHOLDER_MISSING_OR_EXCESSIVE' | 'PROJECT_MATCHES_MULTIPLE_GROUPS' | 'CONVENTIONAL_COMMITS_SHORTHAND_MIXED_WITH_OVERLAPPING_GENERATOR_OPTIONS' | 'GLOBAL_GIT_CONFIG_MIXED_WITH_GRANULAR_GIT_CONFIG';
|
|
49
36
|
data: Record<string, string | string[]>;
|
|
50
37
|
}
|
|
51
|
-
export declare function createNxReleaseConfig(projectGraph: ProjectGraph, userConfig?: NxJsonConfiguration['release']): Promise<{
|
|
38
|
+
export declare function createNxReleaseConfig(projectGraph: ProjectGraph, projectFileMap: ProjectFileMap, userConfig?: NxJsonConfiguration['release']): Promise<{
|
|
52
39
|
error: null | CreateNxReleaseConfigError;
|
|
53
40
|
nxReleaseConfig: NxReleaseConfig | null;
|
|
54
41
|
}>;
|