@nx/js 17.2.5 → 17.2.7
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/README.md +4 -9
- package/package.json +4 -4
- package/src/executors/release-publish/release-publish.impl.js +28 -17
- package/src/generators/library/files/lib/README.md +1 -1
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +5 -1
- package/src/generators/release-version/release-version.js +6 -2
package/README.md
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
<p style="text-align: center;">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
-
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
-
</picture>
|
|
6
|
-
</p>
|
|
1
|
+
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
7
2
|
|
|
8
3
|
<div style="text-align: center;">
|
|
9
4
|
|
|
@@ -20,9 +15,9 @@
|
|
|
20
15
|
|
|
21
16
|
<hr>
|
|
22
17
|
|
|
23
|
-
# Nx: Smart
|
|
18
|
+
# Nx: Smart, Fast and Extensible Build System
|
|
24
19
|
|
|
25
|
-
Nx is a build system with
|
|
20
|
+
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
|
26
21
|
|
|
27
22
|
This package is a [JavaScript/TypeScript plugin for Nx](https://nx.dev/js/overview).
|
|
28
23
|
|
|
@@ -64,5 +59,5 @@ npx nx@latest init
|
|
|
64
59
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
65
60
|
|
|
66
61
|
<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"
|
|
67
|
-
width="100%" alt="Nx - Smart
|
|
62
|
+
width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
|
|
68
63
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "
|
|
61
|
-
"@nx/workspace": "
|
|
62
|
-
"@nrwl/js": "
|
|
60
|
+
"@nx/devkit": "17.2.7",
|
|
61
|
+
"@nx/workspace": "17.2.7",
|
|
62
|
+
"@nrwl/js": "17.2.7"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -17,6 +17,11 @@ function processEnv(color) {
|
|
|
17
17
|
return env;
|
|
18
18
|
}
|
|
19
19
|
async function runExecutor(options, context) {
|
|
20
|
+
/**
|
|
21
|
+
* We need to check both the env var and the option because the executor may have been triggered
|
|
22
|
+
* indirectly via dependsOn, in which case the env var will be set, but the option will not.
|
|
23
|
+
*/
|
|
24
|
+
const isDryRun = process.env.NX_DRY_RUN === 'true' || options.dryRun || false;
|
|
20
25
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
21
26
|
const packageRoot = (0, devkit_1.joinPathFragments)(context.root, options.packageRoot ?? projectConfig.root);
|
|
22
27
|
const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
|
|
@@ -46,7 +51,7 @@ async function runExecutor(options, context) {
|
|
|
46
51
|
if (options.otp) {
|
|
47
52
|
npmPublishCommandSegments.push(`--otp=${options.otp}`);
|
|
48
53
|
}
|
|
49
|
-
if (
|
|
54
|
+
if (isDryRun) {
|
|
50
55
|
npmPublishCommandSegments.push(`--dry-run`);
|
|
51
56
|
}
|
|
52
57
|
// Resolve values using the `npm config` command so that things like environment variables and `publishConfig`s are accounted for
|
|
@@ -60,7 +65,7 @@ async function runExecutor(options, context) {
|
|
|
60
65
|
* Therefore, so as to not produce misleading output in dry around dist-tags being altered, we do not
|
|
61
66
|
* perform the npm view step, and just show npm publish's dry-run output.
|
|
62
67
|
*/
|
|
63
|
-
if (!
|
|
68
|
+
if (!isDryRun) {
|
|
64
69
|
const currentVersion = projectPackageJson.version;
|
|
65
70
|
try {
|
|
66
71
|
const result = (0, child_process_1.execSync)(npmViewCommandSegments.join(' '), {
|
|
@@ -78,7 +83,7 @@ async function runExecutor(options, context) {
|
|
|
78
83
|
}
|
|
79
84
|
if (resultJson.versions.includes(currentVersion)) {
|
|
80
85
|
try {
|
|
81
|
-
if (!
|
|
86
|
+
if (!isDryRun) {
|
|
82
87
|
(0, child_process_1.execSync)(`npm dist-tag add ${packageName}@${currentVersion} ${tag} --registry=${registry}`, {
|
|
83
88
|
env: processEnv(true),
|
|
84
89
|
cwd: packageRoot,
|
|
@@ -96,20 +101,26 @@ async function runExecutor(options, context) {
|
|
|
96
101
|
catch (err) {
|
|
97
102
|
try {
|
|
98
103
|
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
99
|
-
|
|
100
|
-
if (stdoutData.error
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
console.error(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
// If the error is that the package doesn't exist, then we can ignore it because we will be publishing it for the first time in the next step
|
|
105
|
+
if (!(stdoutData.error?.code?.includes('E404') &&
|
|
106
|
+
stdoutData.error?.summary?.includes('no such package available')) &&
|
|
107
|
+
!(err.stderr?.toString().includes('E404') &&
|
|
108
|
+
err.stderr?.toString().includes('no such package available'))) {
|
|
109
|
+
console.error('npm dist-tag add error:');
|
|
110
|
+
if (stdoutData.error.summary) {
|
|
111
|
+
console.error(stdoutData.error.summary);
|
|
112
|
+
}
|
|
113
|
+
if (stdoutData.error.detail) {
|
|
114
|
+
console.error(stdoutData.error.detail);
|
|
115
|
+
}
|
|
116
|
+
if (context.isVerbose) {
|
|
117
|
+
console.error('npm dist-tag add stdout:');
|
|
118
|
+
console.error(JSON.stringify(stdoutData, null, 2));
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
success: false,
|
|
122
|
+
};
|
|
109
123
|
}
|
|
110
|
-
return {
|
|
111
|
-
success: false,
|
|
112
|
-
};
|
|
113
124
|
}
|
|
114
125
|
catch (err) {
|
|
115
126
|
console.error('Something unexpected went wrong when processing the npm dist-tag add output\n', err);
|
|
@@ -145,7 +156,7 @@ async function runExecutor(options, context) {
|
|
|
145
156
|
// If npm workspaces are in use, the publish output will nest the data under the package name, so we normalize it first
|
|
146
157
|
const normalizedStdoutData = stdoutData[packageName] ?? stdoutData;
|
|
147
158
|
(0, log_tar_1.logTar)(normalizedStdoutData);
|
|
148
|
-
if (
|
|
159
|
+
if (isDryRun) {
|
|
149
160
|
console.log(`Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`);
|
|
150
161
|
}
|
|
151
162
|
else {
|
|
@@ -14,6 +14,6 @@ Run `<%= cliCommand %> build <%= name %>` to build the library.
|
|
|
14
14
|
|
|
15
15
|
## Running unit tests
|
|
16
16
|
|
|
17
|
-
Run `<%= cliCommand %> test <%= name %>` to execute the unit tests via [Jest](https://jestjs.io).
|
|
17
|
+
Run `<%= cliCommand %> test <%= name %>` to execute the unit tests via <% if(unitTestRunner === 'jest') { %>[Jest](https://jestjs.io)<% } else { %>[Vitest](https://vitest.dev/)<% } %>.
|
|
18
18
|
|
|
19
19
|
<% } %>
|
|
@@ -6,5 +6,9 @@
|
|
|
6
6
|
"types": ["node"]
|
|
7
7
|
},
|
|
8
8
|
"include": ["src/**/*.ts"<% if (js) { %>, "src/**/*.js"<% } %>],
|
|
9
|
-
"exclude": [
|
|
9
|
+
"exclude": [
|
|
10
|
+
<% if (hasUnitTestRunner && unitTestRunner === 'jest') { %>"jest.config.ts",
|
|
11
|
+
<% } else if (hasUnitTestRunner) { %>"vite.config.ts",
|
|
12
|
+
<% } %>"src/**/*.spec.ts", "src/**/*.test.ts"<% if (js) { %>, "src/**/*.spec.js", "src/**/*.test.js"<% } %>
|
|
13
|
+
]
|
|
10
14
|
}
|
|
@@ -18,8 +18,12 @@ async function releaseVersionGenerator(tree, options) {
|
|
|
18
18
|
try {
|
|
19
19
|
const versionData = {};
|
|
20
20
|
// If the user provided a specifier, validate that it is valid semver or a relative semver keyword
|
|
21
|
-
if (options.specifier
|
|
22
|
-
|
|
21
|
+
if (options.specifier) {
|
|
22
|
+
if (!(0, semver_1.isValidSemverSpecifier)(options.specifier)) {
|
|
23
|
+
throw new Error(`The given version specifier "${options.specifier}" is not valid. You provide an exact version or a valid semver keyword such as "major", "minor", "patch", etc.`);
|
|
24
|
+
}
|
|
25
|
+
// The node semver library classes a leading `v` as valid, but we want to ensure it is not present in the final version
|
|
26
|
+
options.specifier = options.specifier.replace(/^v/, '');
|
|
23
27
|
}
|
|
24
28
|
const projects = options.projects;
|
|
25
29
|
const createResolvePackageRoot = (customPackageRoot) => (projectNode) => {
|