@nx/js 17.3.0-beta.6 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "17.3.0-beta.6",
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": {
@@ -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": "17.3.0-beta.6",
61
- "@nx/workspace": "17.3.0-beta.6",
62
- "@nrwl/js": "17.3.0-beta.6"
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"
@@ -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
- json[dependentProject.dependencyCollection][packageName] =
266
- newVersion;
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
  }