@nx/js 17.3.0-beta.5 → 17.3.0-beta.8
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/package.json +5 -5
- package/src/executors/verdaccio/verdaccio.impl.js +1 -1
- package/src/generators/init/init.js +2 -2
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +6 -0
- package/src/generators/library/library.js +1 -1
- package/src/generators/release-version/release-version.js +26 -3
- package/src/generators/setup-build/generator.js +3 -0
- package/src/utils/assets/copy-assets-handler.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.8",
|
|
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": {
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"tsconfig-paths": "^4.1.2",
|
|
53
53
|
"ignore": "^5.0.4",
|
|
54
54
|
"js-tokens": "^4.0.0",
|
|
55
|
-
"minimatch": "
|
|
55
|
+
"minimatch": "9.0.3",
|
|
56
56
|
"ora": "5.3.0",
|
|
57
57
|
"semver": "7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "17.3.0-beta.
|
|
61
|
-
"@nx/workspace": "17.3.0-beta.
|
|
62
|
-
"@nrwl/js": "17.3.0-beta.
|
|
60
|
+
"@nx/devkit": "17.3.0-beta.8",
|
|
61
|
+
"@nx/workspace": "17.3.0-beta.8",
|
|
62
|
+
"@nrwl/js": "17.3.0-beta.8"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|
|
@@ -149,7 +149,7 @@ function getYarnUnsafeHttpWhitelist(isYarnV1) {
|
|
|
149
149
|
: null;
|
|
150
150
|
}
|
|
151
151
|
function setYarnUnsafeHttpWhitelist(currentWhitelist, options) {
|
|
152
|
-
if (currentWhitelist.size >
|
|
152
|
+
if (currentWhitelist.size > 0) {
|
|
153
153
|
(0, child_process_1.execSync)(`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(Array.from(currentWhitelist))}'` + (options.location === 'user' ? ' --home' : ''));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
@@ -50,7 +50,7 @@ async function initGenerator(tree, schema) {
|
|
|
50
50
|
'@swc-node/register': versions_1.swcNodeVersion,
|
|
51
51
|
'@swc/core': versions_1.swcCoreVersion,
|
|
52
52
|
};
|
|
53
|
-
if (!schema.js) {
|
|
53
|
+
if (!schema.js && !schema.keepExistingVersions) {
|
|
54
54
|
const installedTsVersion = await getInstalledTypescriptVersion(tree);
|
|
55
55
|
if (!installedTsVersion ||
|
|
56
56
|
!(0, semver_2.satisfies)(installedTsVersion, versions_1.supportedTypescriptVersions, {
|
|
@@ -96,7 +96,7 @@ async function initGenerator(tree, schema) {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
const installTask = !schema.skipPackageJson
|
|
99
|
-
? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies)
|
|
99
|
+
? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions)
|
|
100
100
|
: () => { };
|
|
101
101
|
tasks.push(installTask);
|
|
102
102
|
(0, devkit_1.ensurePackage)('prettier', versions_1.prettierVersion);
|
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"description": "Skip adding package.json dependencies",
|
|
22
22
|
"x-priority": "internal"
|
|
23
23
|
},
|
|
24
|
+
"keepExistingVersions": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"x-priority": "internal",
|
|
27
|
+
"description": "Keep existing dependencies versions",
|
|
28
|
+
"default": false
|
|
29
|
+
},
|
|
24
30
|
"tsConfigName": {
|
|
25
31
|
"type": "string",
|
|
26
32
|
"description": "Customize the generated tsconfig file name.",
|
|
@@ -163,7 +163,7 @@ function addProject(tree, options) {
|
|
|
163
163
|
async function addLint(tree, options) {
|
|
164
164
|
const { lintProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/eslint', versions_1.nxVersion);
|
|
165
165
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
166
|
-
const task = lintProjectGenerator(tree, {
|
|
166
|
+
const task = await lintProjectGenerator(tree, {
|
|
167
167
|
project: options.name,
|
|
168
168
|
linter: options.linter,
|
|
169
169
|
skipFormat: true,
|
|
@@ -25,6 +25,14 @@ async function releaseVersionGenerator(tree, options) {
|
|
|
25
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
26
|
options.specifier = options.specifier.replace(/^v/, '');
|
|
27
27
|
}
|
|
28
|
+
if (options.versionPrefix &&
|
|
29
|
+
version_1.validReleaseVersionPrefixes.indexOf(options.versionPrefix) === -1) {
|
|
30
|
+
throw new Error(`Invalid value for version.generatorOptions.versionPrefix: "${options.versionPrefix}"
|
|
31
|
+
|
|
32
|
+
Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
33
|
+
.map((s) => `"${s}"`)
|
|
34
|
+
.join(', ')}`);
|
|
35
|
+
}
|
|
28
36
|
if (options.firstRelease) {
|
|
29
37
|
// always use disk as a fallback for the first release
|
|
30
38
|
options.fallbackCurrentVersionResolver = 'disk';
|
|
@@ -242,7 +250,7 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
242
250
|
versionData[projectName] = {
|
|
243
251
|
currentVersion,
|
|
244
252
|
dependentProjects,
|
|
245
|
-
newVersion: null, // will stay as null in the final result the case that no changes are detected
|
|
253
|
+
newVersion: null, // will stay as null in the final result in the case that no changes are detected
|
|
246
254
|
};
|
|
247
255
|
if (!specifier) {
|
|
248
256
|
log(`🚫 Skipping versioning "${projectPackageJson.name}" as no changes were detected.`);
|
|
@@ -262,8 +270,23 @@ To fix this you will either need to add a package.json file at that location, or
|
|
|
262
270
|
}
|
|
263
271
|
for (const dependentProject of dependentProjects) {
|
|
264
272
|
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectNameToPackageRootMap.get(dependentProject.source), 'package.json'), (json) => {
|
|
265
|
-
|
|
266
|
-
|
|
273
|
+
// Auto (i.e.infer existing) by default
|
|
274
|
+
let versionPrefix = options.versionPrefix ?? 'auto';
|
|
275
|
+
// For auto, we infer the prefix based on the current version of the dependent
|
|
276
|
+
if (versionPrefix === 'auto') {
|
|
277
|
+
versionPrefix = ''; // we don't want to end up printing auto
|
|
278
|
+
const current = json[dependentProject.dependencyCollection][packageName];
|
|
279
|
+
if (current) {
|
|
280
|
+
const prefixMatch = current.match(/^[~^]/);
|
|
281
|
+
if (prefixMatch) {
|
|
282
|
+
versionPrefix = prefixMatch[0];
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
versionPrefix = '';
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
json[dependentProject.dependencyCollection][packageName] = `${versionPrefix}${newVersion}`;
|
|
267
290
|
return json;
|
|
268
291
|
});
|
|
269
292
|
}
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const add_swc_config_1 = require("../../utils/swc/add-swc-config");
|
|
6
6
|
const add_swc_dependencies_1 = require("../../utils/swc/add-swc-dependencies");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
|
+
const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
|
|
8
9
|
async function setupBuildGenerator(tree, options) {
|
|
9
10
|
const tasks = [];
|
|
10
11
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -101,6 +102,7 @@ async function setupBuildGenerator(tree, options) {
|
|
|
101
102
|
break;
|
|
102
103
|
}
|
|
103
104
|
case 'tsc': {
|
|
105
|
+
(0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, '@nx/js:tsc');
|
|
104
106
|
const outputPath = (0, devkit_1.joinPathFragments)('dist', project.root);
|
|
105
107
|
project.targets[buildTarget] = {
|
|
106
108
|
executor: `@nx/js:tsc`,
|
|
@@ -116,6 +118,7 @@ async function setupBuildGenerator(tree, options) {
|
|
|
116
118
|
break;
|
|
117
119
|
}
|
|
118
120
|
case 'swc': {
|
|
121
|
+
(0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, '@nx/js:swc');
|
|
119
122
|
const outputPath = (0, devkit_1.joinPathFragments)('dist', project.root);
|
|
120
123
|
project.targets[buildTarget] = {
|
|
121
124
|
executor: `@nx/js:swc`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CopyAssetsHandler = exports.defaultFileEventHandler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const minimatch_1 = require("minimatch");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fse = require("fs-extra");
|
|
7
7
|
const ignore_1 = require("ignore");
|
|
@@ -114,8 +114,8 @@ class CopyAssetsHandler {
|
|
|
114
114
|
for (const event of events) {
|
|
115
115
|
const pathFromRoot = path.relative(this.rootDir, event.path);
|
|
116
116
|
for (const ag of this.assetGlobs) {
|
|
117
|
-
if (minimatch(pathFromRoot, ag.pattern) &&
|
|
118
|
-
!ag.ignore?.some((ig) => minimatch(pathFromRoot, ig)) &&
|
|
117
|
+
if ((0, minimatch_1.minimatch)(pathFromRoot, ag.pattern) &&
|
|
118
|
+
!ag.ignore?.some((ig) => (0, minimatch_1.minimatch)(pathFromRoot, ig)) &&
|
|
119
119
|
!this.ignore.ignores(pathFromRoot)) {
|
|
120
120
|
const relPath = path.relative(ag.input, pathFromRoot);
|
|
121
121
|
const destPath = relPath.startsWith('..') ? pathFromRoot : relPath;
|
|
@@ -134,7 +134,7 @@ class CopyAssetsHandler {
|
|
|
134
134
|
}
|
|
135
135
|
filesToEvent(files, assetGlob) {
|
|
136
136
|
return files.reduce((acc, src) => {
|
|
137
|
-
if (!assetGlob.ignore?.some((ig) => minimatch(src, ig)) &&
|
|
137
|
+
if (!assetGlob.ignore?.some((ig) => (0, minimatch_1.minimatch)(src, ig)) &&
|
|
138
138
|
!this.ignore.ignores(src)) {
|
|
139
139
|
const relPath = path.relative(assetGlob.input, src);
|
|
140
140
|
const dest = relPath.startsWith('..') ? src : relPath;
|