@nx/js 17.3.0-beta.1 → 17.3.0-beta.3

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 CHANGED
@@ -123,6 +123,15 @@
123
123
  "version": "~5.2.2"
124
124
  }
125
125
  }
126
+ },
127
+ "17.3.0": {
128
+ "version": "17.3.0-beta.3",
129
+ "packages": {
130
+ "@types/node": {
131
+ "version": "^18.16.9",
132
+ "alwaysAddToPackageJson": false
133
+ }
134
+ }
126
135
  }
127
136
  }
128
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "17.3.0-beta.1",
3
+ "version": "17.3.0-beta.3",
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.1",
61
- "@nx/workspace": "17.3.0-beta.1",
62
- "@nrwl/js": "17.3.0-beta.1"
60
+ "@nx/devkit": "17.3.0-beta.3",
61
+ "@nx/workspace": "17.3.0-beta.3",
62
+ "@nrwl/js": "17.3.0-beta.3"
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 (options.dryRun) {
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 (!options.dryRun) {
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 (!options.dryRun) {
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
- console.error('npm dist-tag add error:');
100
- if (stdoutData.error.summary) {
101
- console.error(stdoutData.error.summary);
102
- }
103
- if (stdoutData.error.detail) {
104
- console.error(stdoutData.error.detail);
105
- }
106
- if (context.isVerbose) {
107
- console.error('npm dist-tag add stdout:');
108
- console.error(JSON.stringify(stdoutData, null, 2));
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);
@@ -124,9 +135,9 @@ async function runExecutor(options, context) {
124
135
  const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
125
136
  // 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
126
137
  if (!(stdoutData.error?.code?.includes('E404') &&
127
- stdoutData.error?.summary?.includes('no such package available')) &&
138
+ stdoutData.error?.summary?.toLowerCase().includes('not found')) &&
128
139
  !(err.stderr?.toString().includes('E404') &&
129
- err.stderr?.toString().includes('no such package available'))) {
140
+ err.stderr?.toString().toLowerCase().includes('not found'))) {
130
141
  console.error(`Something unexpected went wrong when checking for existing dist-tags.\n`, err);
131
142
  return {
132
143
  success: false,
@@ -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 (options.dryRun) {
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 {
@@ -153,7 +153,10 @@ To fix this you will either need to add a package.json file at that location, or
153
153
  if (options.currentVersionResolver !== 'git-tag') {
154
154
  throw new Error(`Invalid currentVersionResolver "${options.currentVersionResolver}" provided for release group "${options.releaseGroup.name}". Must be "git-tag" when "specifierSource" is "conventional-commits"`);
155
155
  }
156
- specifier = await (0, resolve_semver_specifier_1.resolveSemverSpecifierFromConventionalCommits)(latestMatchingGitTag.tag, options.projectGraph, projects.map((p) => p.name));
156
+ const affectedProjects = options.releaseGroup.projectsRelationship === 'independent'
157
+ ? [projectName]
158
+ : projects.map((p) => p.name);
159
+ specifier = await (0, resolve_semver_specifier_1.resolveSemverSpecifierFromConventionalCommits)(latestMatchingGitTag.tag, options.projectGraph, affectedProjects);
157
160
  if (!specifier) {
158
161
  log(`🚫 No changes were detected using git history and the conventional commits standard.`);
159
162
  break;
@@ -177,7 +177,7 @@ function recursiveUpdateImport(dirPath, importRegex, inlinedDepsDestOutputRecord
177
177
  const updatedContent = fileContent.replace(importRegex, (matched) => {
178
178
  const result = matched.replace(/['"]/g, '');
179
179
  // If a match is the same as the rootParentDir, we're checking its own files so we return the matched as in no changes.
180
- if (result === rootParentDir)
180
+ if (result === rootParentDir || !inlinedDepsDestOutputRecord[result])
181
181
  return matched;
182
182
  const importPath = `"${(0, path_1.relative)(dirPath, inlinedDepsDestOutputRecord[result])}"`;
183
183
  return (0, devkit_1.normalizePath)(importPath);
@@ -6,7 +6,7 @@ export declare const swcCoreVersion = "~1.3.85";
6
6
  export declare const swcHelpersVersion = "~0.5.2";
7
7
  export declare const swcNodeVersion = "~1.6.7";
8
8
  export declare const tsLibVersion = "^2.3.0";
9
- export declare const typesNodeVersion = "18.7.1";
9
+ export declare const typesNodeVersion = "18.16.9";
10
10
  export declare const verdaccioVersion = "^5.0.4";
11
11
  export declare const typescriptVersion = "~5.2.2";
12
12
  /**
@@ -9,7 +9,7 @@ exports.swcCoreVersion = '~1.3.85';
9
9
  exports.swcHelpersVersion = '~0.5.2';
10
10
  exports.swcNodeVersion = '~1.6.7';
11
11
  exports.tsLibVersion = '^2.3.0';
12
- exports.typesNodeVersion = '18.7.1';
12
+ exports.typesNodeVersion = '18.16.9';
13
13
  exports.verdaccioVersion = '^5.0.4';
14
14
  // Typescript
15
15
  exports.typescriptVersion = '~5.2.2';