nx 21.1.1 → 21.2.0-beta.1
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/.eslintrc.json +1 -0
- package/README.md +3 -3
- package/package.json +11 -11
- package/src/adapter/compat.js +4 -0
- package/src/command-line/init/implementation/angular/index.js +3 -1
- package/src/command-line/init/implementation/angular/standalone-workspace.js +51 -25
- package/src/command-line/nx-commands.js +1 -1
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/executors/run-commands/running-tasks.js +7 -15
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/utils/register.d.ts +2 -0
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/src/project-graph/project-graph.js +1 -1
package/.eslintrc.json
CHANGED
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<p style="text-align: center;">
|
2
2
|
<picture>
|
3
3
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
4
|
-
<img alt="Nx - Smart
|
4
|
+
<img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
5
5
|
</picture>
|
6
6
|
</p>
|
7
7
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
<hr>
|
22
22
|
|
23
|
-
# Nx: Smart
|
23
|
+
# Nx: Smart Repos · Fast Builds
|
24
24
|
|
25
25
|
Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
|
26
26
|
|
@@ -62,5 +62,5 @@ npx nx@latest init
|
|
62
62
|
- [Blog Posts About Nx](https://nx.dev/blog)
|
63
63
|
|
64
64
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
65
|
-
width="100%" alt="Nx - Smart
|
65
|
+
width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
|
66
66
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.2.0-beta.1",
|
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": {
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-arm64": "21.
|
87
|
-
"@nx/nx-darwin-x64": "21.
|
88
|
-
"@nx/nx-freebsd-x64": "21.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.
|
86
|
+
"@nx/nx-darwin-arm64": "21.2.0-beta.1",
|
87
|
+
"@nx/nx-darwin-x64": "21.2.0-beta.1",
|
88
|
+
"@nx/nx-freebsd-x64": "21.2.0-beta.1",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.2.0-beta.1",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.2.0-beta.1",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.2.0-beta.1",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.2.0-beta.1",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.2.0-beta.1",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.2.0-beta.1",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.2.0-beta.1"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
package/src/adapter/compat.js
CHANGED
@@ -95,7 +95,9 @@ function addPluginDependencies() {
|
|
95
95
|
const angularCliVersion = packageJson.devDependencies['@angular/cli'] ??
|
96
96
|
packageJson.dependencies?.['@angular/cli'] ??
|
97
97
|
packageJson.devDependencies['@angular-devkit/build-angular'] ??
|
98
|
-
packageJson.dependencies?.['@angular-devkit/build-angular']
|
98
|
+
packageJson.dependencies?.['@angular-devkit/build-angular'] ??
|
99
|
+
packageJson.devDependencies['@angular/build'] ??
|
100
|
+
packageJson.dependencies?.['@angular/build'];
|
99
101
|
for (const dep of peerDepsToInstall) {
|
100
102
|
if (!packageJson.devDependencies[dep] && !packageJson.dependencies?.[dep]) {
|
101
103
|
packageJson.devDependencies[dep] = angularCliVersion;
|
@@ -2,13 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setupStandaloneWorkspace = setupStandaloneWorkspace;
|
4
4
|
const fs_1 = require("fs");
|
5
|
-
const
|
5
|
+
const node_path_1 = require("node:path");
|
6
6
|
const angular_json_1 = require("../../../../adapter/angular-json");
|
7
7
|
const fileutils_1 = require("../../../../utils/fileutils");
|
8
|
-
const
|
8
|
+
const path_1 = require("../../../../utils/path");
|
9
9
|
const utils_1 = require("../utils");
|
10
10
|
async function setupStandaloneWorkspace(repoRoot, cacheableOperations, workspaceTargets) {
|
11
|
-
const angularJsonPath = (0,
|
11
|
+
const angularJsonPath = (0, node_path_1.join)(repoRoot, 'angular.json');
|
12
12
|
const angularJson = (0, fileutils_1.readJsonFile)(angularJsonPath);
|
13
13
|
const workspaceCapabilities = getWorkspaceCapabilities(angularJson.projects);
|
14
14
|
createNxJson(repoRoot, angularJson, cacheableOperations, workspaceCapabilities, workspaceTargets);
|
@@ -24,9 +24,9 @@ async function setupStandaloneWorkspace(repoRoot, cacheableOperations, workspace
|
|
24
24
|
// update its targets outputs and delete angular.json
|
25
25
|
const projects = (0, angular_json_1.toNewFormat)(angularJson).projects;
|
26
26
|
for (const [projectName, project] of Object.entries(projects ?? {})) {
|
27
|
-
updateProjectOutputs(repoRoot, project);
|
28
|
-
(0, fileutils_1.writeJsonFile)((0,
|
29
|
-
$schema: (0,
|
27
|
+
updateProjectOutputs(repoRoot, projectName, project, cacheableOperations);
|
28
|
+
(0, fileutils_1.writeJsonFile)((0, node_path_1.join)(project.root, 'project.json'), {
|
29
|
+
$schema: (0, path_1.normalizePath)((0, node_path_1.relative)((0, node_path_1.join)(repoRoot, project.root), (0, node_path_1.join)(repoRoot, 'node_modules/nx/schemas/project-schema.json'))),
|
30
30
|
name: projectName,
|
31
31
|
...project,
|
32
32
|
root: undefined,
|
@@ -36,7 +36,7 @@ async function setupStandaloneWorkspace(repoRoot, cacheableOperations, workspace
|
|
36
36
|
}
|
37
37
|
function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjectConfigFile, test, karmaProjectConfigFile, }, workspaceTargets) {
|
38
38
|
(0, utils_1.createNxJsonFile)(repoRoot, [], cacheableOperations, {});
|
39
|
-
const nxJson = (0, fileutils_1.readJsonFile)((0,
|
39
|
+
const nxJson = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(repoRoot, 'nx.json'));
|
40
40
|
nxJson.namedInputs = {
|
41
41
|
sharedGlobals: [],
|
42
42
|
default: ['{projectRoot}/**/*', 'sharedGlobals'],
|
@@ -70,7 +70,7 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
|
|
70
70
|
}
|
71
71
|
if (workspaceTargets.includes('test')) {
|
72
72
|
const inputs = ['default', '^production'];
|
73
|
-
if ((0, fileutils_1.fileExists)((0,
|
73
|
+
if ((0, fileutils_1.fileExists)((0, node_path_1.join)(repoRoot, 'karma.conf.js'))) {
|
74
74
|
inputs.push('{workspaceRoot}/karma.conf.js');
|
75
75
|
}
|
76
76
|
nxJson.targetDefaults.test = {
|
@@ -80,10 +80,10 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
|
|
80
80
|
}
|
81
81
|
if (workspaceTargets.includes('lint')) {
|
82
82
|
const inputs = ['default'];
|
83
|
-
if ((0, fileutils_1.fileExists)((0,
|
83
|
+
if ((0, fileutils_1.fileExists)((0, node_path_1.join)(repoRoot, '.eslintrc.json'))) {
|
84
84
|
inputs.push('{workspaceRoot}/.eslintrc.json');
|
85
85
|
}
|
86
|
-
if ((0, fileutils_1.fileExists)((0,
|
86
|
+
if ((0, fileutils_1.fileExists)((0, node_path_1.join)(repoRoot, 'eslint.config.cjs'))) {
|
87
87
|
inputs.push('{workspaceRoot}/eslint.config.cjs');
|
88
88
|
}
|
89
89
|
nxJson.targetDefaults.lint = {
|
@@ -97,11 +97,30 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
|
|
97
97
|
inputs: ['default', '^production'],
|
98
98
|
};
|
99
99
|
}
|
100
|
-
(0, fileutils_1.writeJsonFile)((0,
|
100
|
+
(0, fileutils_1.writeJsonFile)((0, node_path_1.join)(repoRoot, 'nx.json'), nxJson);
|
101
101
|
}
|
102
|
-
function updateProjectOutputs(repoRoot, project) {
|
103
|
-
Object.
|
104
|
-
if (
|
102
|
+
function updateProjectOutputs(repoRoot, projectName, project, cacheableOperations) {
|
103
|
+
Object.entries(project.targets ?? {}).forEach(([targetName, target]) => {
|
104
|
+
if (target.executor === '@angular/build:application' ||
|
105
|
+
target.executor === '@angular-devkit/build-angular:application') {
|
106
|
+
if (target.options.outputPath) {
|
107
|
+
if (typeof target.options.outputPath === 'string') {
|
108
|
+
target.outputs = ['{options.outputPath}'];
|
109
|
+
}
|
110
|
+
else if (target.options.outputPath.base) {
|
111
|
+
target.outputs = ['{options.outputPath.base}'];
|
112
|
+
}
|
113
|
+
else if (cacheableOperations.includes(targetName)) {
|
114
|
+
target.cache = false;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
target.options.outputPath = node_path_1.posix.join('dist', projectName);
|
119
|
+
target.outputs = ['{options.outputPath}'];
|
120
|
+
}
|
121
|
+
}
|
122
|
+
else if ([
|
123
|
+
'@angular-devkit/build-angular:browser-esbuild',
|
105
124
|
'@angular-devkit/build-angular:browser',
|
106
125
|
'@angular-builders/custom-webpack:browser',
|
107
126
|
'ngx-build-plus:browser',
|
@@ -109,7 +128,12 @@ function updateProjectOutputs(repoRoot, project) {
|
|
109
128
|
'@angular-builders/custom-webpack:server',
|
110
129
|
'ngx-build-plus:server',
|
111
130
|
].includes(target.executor)) {
|
112
|
-
target.
|
131
|
+
if (target.options.outputPath) {
|
132
|
+
target.outputs = ['{options.outputPath}'];
|
133
|
+
}
|
134
|
+
else if (cacheableOperations.includes(targetName)) {
|
135
|
+
target.cache = false;
|
136
|
+
}
|
113
137
|
}
|
114
138
|
else if (target.executor === '@angular-eslint/builder:lint') {
|
115
139
|
target.outputs = ['{options.outputFile}'];
|
@@ -117,10 +141,11 @@ function updateProjectOutputs(repoRoot, project) {
|
|
117
141
|
else if (target.executor === '@angular-devkit/build-angular:ng-packagr' ||
|
118
142
|
target.executor === '@angular/build:ng-packagr') {
|
119
143
|
try {
|
120
|
-
const
|
144
|
+
const ngPackagrProject = target.options.project ?? node_path_1.posix.join(project.root, 'ng-package.json');
|
145
|
+
const ngPackageJsonPath = (0, node_path_1.join)(repoRoot, ngPackagrProject);
|
121
146
|
const ngPackageJson = (0, fileutils_1.readJsonFile)(ngPackageJsonPath);
|
122
|
-
const outputPath = (0,
|
123
|
-
target.outputs = [`{workspaceRoot}/${(0,
|
147
|
+
const outputPath = (0, node_path_1.relative)(repoRoot, (0, node_path_1.resolve)((0, node_path_1.dirname)(ngPackageJsonPath), ngPackageJson.dest));
|
148
|
+
target.outputs = [`{workspaceRoot}/${(0, path_1.normalizePath)(outputPath)}`];
|
124
149
|
}
|
125
150
|
catch { }
|
126
151
|
}
|
@@ -153,19 +178,20 @@ function getWorkspaceCapabilities(projects) {
|
|
153
178
|
return capabilities;
|
154
179
|
}
|
155
180
|
function projectUsesKarmaBuilder(project) {
|
156
|
-
return Object.values(project.architect ?? {}).some((target) => target.builder === '@angular
|
181
|
+
return Object.values(project.architect ?? {}).some((target) => target.builder === '@angular/build:karma' ||
|
182
|
+
target.builder === '@angular-devkit/build-angular:karma');
|
157
183
|
}
|
158
184
|
function projectHasKarmaConfig(project) {
|
159
|
-
return (0, fileutils_1.fileExists)((0,
|
185
|
+
return (0, fileutils_1.fileExists)((0, node_path_1.join)(project.root, 'karma.conf.js'));
|
160
186
|
}
|
161
187
|
function projectHasEslintConfig(project) {
|
162
|
-
return ((0, fileutils_1.fileExists)((0,
|
163
|
-
(0, fileutils_1.fileExists)((0,
|
164
|
-
(0, fileutils_1.fileExists)((0,
|
165
|
-
(0, fileutils_1.fileExists)((0,
|
188
|
+
return ((0, fileutils_1.fileExists)((0, node_path_1.join)(project.root, '.eslintrc.json')) ||
|
189
|
+
(0, fileutils_1.fileExists)((0, node_path_1.join)(project.root, 'eslint.config.js')) ||
|
190
|
+
(0, fileutils_1.fileExists)((0, node_path_1.join)(project.root, 'eslint.config.mjs')) ||
|
191
|
+
(0, fileutils_1.fileExists)((0, node_path_1.join)(project.root, 'eslint.config.cjs')));
|
166
192
|
}
|
167
193
|
function replaceNgWithNxInPackageJsonScripts(repoRoot) {
|
168
|
-
const packageJsonPath = (0,
|
194
|
+
const packageJsonPath = (0, node_path_1.join)(repoRoot, 'package.json');
|
169
195
|
const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
|
170
196
|
packageJson.scripts ??= {};
|
171
197
|
Object.keys(packageJson.scripts).forEach((script) => {
|
@@ -44,7 +44,7 @@ exports.parserConfiguration = {
|
|
44
44
|
*/
|
45
45
|
exports.commandsObject = yargs
|
46
46
|
.parserConfiguration(exports.parserConfiguration)
|
47
|
-
.usage(chalk.bold('Smart
|
47
|
+
.usage(chalk.bold('Smart Repos · Fast Builds'))
|
48
48
|
.demandCommand(1, '')
|
49
49
|
.command(command_object_1.yargsRegisterCommand)
|
50
50
|
.command(command_object_22.yargsAddCommand)
|