@nx/js 17.0.4 → 17.0.6

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.
Files changed (54) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -9
  3. package/babel.js +16 -36
  4. package/executors.json +1 -1
  5. package/migrations.json +0 -56
  6. package/package.json +9 -9
  7. package/src/executors/node/node.impl.js +1 -1
  8. package/src/executors/node/schema.json +1 -1
  9. package/src/executors/release-publish/release-publish.impl.js +32 -135
  10. package/src/executors/release-publish/schema.d.ts +0 -2
  11. package/src/executors/release-publish/schema.json +1 -1
  12. package/src/executors/swc/schema.json +1 -1
  13. package/src/executors/swc/swc.impl.js +7 -6
  14. package/src/executors/verdaccio/schema.json +1 -1
  15. package/src/executors/verdaccio/verdaccio.impl.js +1 -1
  16. package/src/generators/convert-to-swc/schema.json +1 -1
  17. package/src/generators/init/init.js +2 -3
  18. package/src/generators/init/schema.d.ts +0 -1
  19. package/src/generators/init/schema.json +1 -7
  20. package/src/generators/library/files/{readme → lib}/README.md +1 -1
  21. package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +1 -5
  22. package/src/generators/library/library.d.ts +1 -1
  23. package/src/generators/library/library.js +29 -171
  24. package/src/generators/library/schema.json +2 -8
  25. package/src/generators/release-version/release-version.d.ts +1 -2
  26. package/src/generators/release-version/release-version.js +86 -341
  27. package/src/generators/release-version/schema.json +4 -26
  28. package/src/generators/release-version/utils/resolve-local-package-dependencies.d.ts +1 -7
  29. package/src/generators/release-version/utils/resolve-local-package-dependencies.js +4 -14
  30. package/src/generators/release-version/utils/resolve-version-spec.js +1 -4
  31. package/src/generators/setup-build/generator.js +0 -3
  32. package/src/generators/setup-build/schema.json +1 -1
  33. package/src/generators/setup-verdaccio/schema.json +1 -1
  34. package/src/utils/add-local-registry-scripts.js +6 -26
  35. package/src/utils/assets/copy-assets-handler.js +4 -4
  36. package/src/utils/buildable-libs-utils.js +2 -6
  37. package/src/utils/find-npm-dependencies.d.ts +1 -2
  38. package/src/utils/find-npm-dependencies.js +11 -28
  39. package/src/utils/inline.js +4 -6
  40. package/src/utils/minimal-publish-script.d.ts +2 -0
  41. package/src/utils/minimal-publish-script.js +74 -0
  42. package/src/utils/schema.d.ts +0 -3
  43. package/src/utils/swc/get-swcrc-path.d.ts +1 -4
  44. package/src/utils/swc/get-swcrc-path.js +1 -6
  45. package/src/utils/swc/inline.d.ts +1 -1
  46. package/src/utils/swc/inline.js +2 -1
  47. package/src/utils/typescript/ast-utils.js +3 -2
  48. package/src/utils/typescript/ts-config.js +0 -1
  49. package/src/utils/versions.d.ts +4 -4
  50. package/src/utils/versions.js +4 -4
  51. package/src/generators/release-version/utils/update-lock-file.d.ts +0 -5
  52. package/src/generators/release-version/utils/update-lock-file.js +0 -105
  53. package/src/utils/npm-config.d.ts +0 -25
  54. package/src/utils/npm-config.js +0 -90
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
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 Monorepos · Fast CI
18
+ # Nx: Smart, Fast and Extensible Build System
24
19
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
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 Monorepos · Fast CI"></a></p>
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
68
63
 
package/babel.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path_1 = require("path");
4
- const semver_1 = require("semver");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  module.exports = function (api, options = {}) {
7
6
  api.assertVersion(7);
@@ -13,10 +12,10 @@ module.exports = function (api, options = {}) {
13
12
  const emitDecoratorMetadata = api.caller((caller) => caller?.emitDecoratorMetadata ?? true);
14
13
  // Determine settings for `@babel//babel-plugin-transform-class-properties`,
15
14
  // so that we can sync the `loose` option with `@babel/preset-env`.
16
- // TODO(v19): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
15
+ // TODO(v18): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
17
16
  const loose = options.classProperties?.loose ?? options.loose ?? true;
18
17
  if (options.classProperties) {
19
- devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 19`);
18
+ devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 18`);
20
19
  }
21
20
  return {
22
21
  presets: [
@@ -26,9 +25,21 @@ module.exports = function (api, options = {}) {
26
25
  // For Jest tests, NODE_ENV is set as 'test' and we only want to set target as Node.
27
26
  // All other options will fail in Jest since Node does not support some ES features
28
27
  // such as import syntax.
29
- isTest || process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID
28
+ isTest || process.env.NODE_ENV === 'test'
30
29
  ? { targets: { node: 'current' }, loose: true }
31
- : createBabelPresetEnvOptions(options.useBuiltIns, isModern, loose),
30
+ : {
31
+ // Allow importing core-js in entrypoint and use browserslist to select polyfills.
32
+ useBuiltIns: options.useBuiltIns ?? 'entry',
33
+ corejs: options.useBuiltIns !== false ? 3 : null,
34
+ // Do not transform modules to CJS
35
+ modules: false,
36
+ targets: isModern ? { esmodules: 'intersect' } : undefined,
37
+ bugfixes: true,
38
+ // Exclude transforms that make all code slower
39
+ exclude: ['transform-typeof-symbol'],
40
+ // This must match the setting for `@babel/plugin-proposal-class-properties`
41
+ loose,
42
+ },
32
43
  ],
33
44
  [
34
45
  require.resolve('@babel/preset-typescript'),
@@ -78,34 +89,3 @@ module.exports = function (api, options = {}) {
78
89
  ],
79
90
  };
80
91
  };
81
- function createBabelPresetEnvOptions(useBuiltIns, isModern, loose) {
82
- const presetOptions = {
83
- // Do not transform modules to CJS
84
- modules: false,
85
- targets: isModern ? { esmodules: 'intersect' } : undefined,
86
- bugfixes: true,
87
- // Exclude transforms that make all code slower
88
- exclude: ['transform-typeof-symbol'],
89
- // This must match the setting for `@babel/plugin-proposal-class-properties`
90
- loose,
91
- };
92
- // If core-js is installed then set corresponding options, otherwise don't use core-js.
93
- // Previously, core-js was required for all projects, but it is not longer required when using only stable JS features that does not need to be transpiled.
94
- const coreJsVersion = findCoreJsVersion();
95
- if (coreJsVersion) {
96
- presetOptions.useBuiltIns = useBuiltIns ?? 'entry';
97
- presetOptions.corejs = useBuiltIns !== false ? coreJsVersion : null;
98
- }
99
- return presetOptions;
100
- }
101
- function findCoreJsVersion() {
102
- try {
103
- // nx-ignore-next-line
104
- const v = require('core-js/package.json').version;
105
- const { major, minor } = (0, semver_1.parse)(v);
106
- return `${major}.${minor}`;
107
- }
108
- catch (e) {
109
- return null;
110
- }
111
- }
package/executors.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "executors": {
4
4
  "tsc": {
5
5
  "implementation": "./src/executors/tsc/tsc.impl",
package/migrations.json CHANGED
@@ -111,62 +111,6 @@
111
111
  "alwaysAddToPackageJson": false
112
112
  }
113
113
  }
114
- },
115
- "17.1.0": {
116
- "version": "17.1.0-beta.4",
117
- "x-prompt": "Do you want to update to TypeScript v5.2?",
118
- "requires": {
119
- "typescript": ">=5.1.0 <5.2.0"
120
- },
121
- "packages": {
122
- "typescript": {
123
- "version": "~5.2.2"
124
- }
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
- }
135
- },
136
- "17.3.0-beta.10": {
137
- "version": "17.3.0-beta.10",
138
- "x-prompt": "Do you want to update to TypeScript v5.3?",
139
- "requires": {
140
- "typescript": ">=5.2.0 <5.3.0"
141
- },
142
- "packages": {
143
- "typescript": {
144
- "version": "~5.3.2",
145
- "alwaysAddToPackageJson": false
146
- }
147
- }
148
- },
149
- "18.0.4": {
150
- "version": "18.0.4-beta.0",
151
- "packages": {
152
- "@swc-node/register": {
153
- "version": "~1.8.0",
154
- "alwaysAddToPackageJson": false
155
- }
156
- }
157
- },
158
- "18.2.0": {
159
- "version": "18.2.0-beta.0",
160
- "x-prompt": "Do you want to update to TypeScript v5.4?",
161
- "requires": {
162
- "typescript": ">=5.3.0 <5.4.0"
163
- },
164
- "packages": {
165
- "typescript": {
166
- "version": "~5.4.2",
167
- "alwaysAddToPackageJson": false
168
- }
169
- }
170
114
  }
171
115
  }
172
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "17.0.4",
3
+ "version": "v17.0.6",
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": {
@@ -30,11 +30,11 @@
30
30
  "generators": "./generators.json",
31
31
  "executors": "./executors.json",
32
32
  "dependencies": {
33
- "@babel/core": "^7.23.2",
33
+ "@babel/core": "^7.22.9",
34
34
  "@babel/plugin-proposal-decorators": "^7.22.7",
35
- "@babel/plugin-transform-runtime": "^7.23.2",
35
+ "@babel/plugin-transform-runtime": "^7.22.9",
36
36
  "@babel/plugin-transform-class-properties": "^7.22.5",
37
- "@babel/preset-env": "^7.23.2",
37
+ "@babel/preset-env": "^7.22.9",
38
38
  "@babel/preset-typescript": "^7.22.5",
39
39
  "@babel/runtime": "^7.22.6",
40
40
  "@phenomnomnominal/tsquery": "~5.0.1",
@@ -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": "9.0.3",
55
+ "minimatch": "3.0.5",
56
56
  "ora": "5.3.0",
57
- "semver": "^7.5.3",
57
+ "semver": "7.5.3",
58
58
  "source-map-support": "0.5.19",
59
59
  "tslib": "^2.3.0",
60
- "@nx/devkit": "17.0.4",
61
- "@nx/workspace": "17.0.4",
62
- "@nrwl/js": "17.0.4"
60
+ "@nx/devkit": "v17.0.6",
61
+ "@nx/workspace": "v17.0.6",
62
+ "@nrwl/js": "v17.0.6"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "verdaccio": "^5.0.4"
@@ -61,7 +61,7 @@ async function* nodeExecutor(options, context) {
61
61
  await previousTask?.stop('SIGTERM');
62
62
  await task.start();
63
63
  };
64
- const debouncedProcessQueue = debounce(processQueue, options.debounce ?? 1_000);
64
+ const debouncedProcessQueue = debounce(processQueue, options.debounce ?? 1000);
65
65
  const addToQueue = async (childProcess, buildResult) => {
66
66
  const task = {
67
67
  id: (0, crypto_1.randomUUID)(),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "direct-nodejs",
4
- "$schema": "https://json-schema.org/schema",
4
+ "$schema": "http://json-schema.org/schema",
5
5
  "cli": "nx",
6
6
  "title": "Node executor",
7
7
  "description": "Execute Nodejs applications.",
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const child_process_1 = require("child_process");
5
5
  const npm_run_path_1 = require("npm-run-path");
6
- const path_1 = require("path");
7
- const npm_config_1 = require("../../utils/npm-config");
8
6
  const log_tar_1 = require("./log-tar");
9
7
  const chalk = require("chalk");
10
8
  const LARGE_BUFFER = 1024 * 1000000;
@@ -19,154 +17,46 @@ function processEnv(color) {
19
17
  return env;
20
18
  }
21
19
  async function runExecutor(options, context) {
22
- /**
23
- * We need to check both the env var and the option because the executor may have been triggered
24
- * indirectly via dependsOn, in which case the env var will be set, but the option will not.
25
- */
26
- const isDryRun = process.env.NX_DRY_RUN === 'true' || options.dryRun || false;
27
20
  const projectConfig = context.projectsConfigurations.projects[context.projectName];
28
- const packageRoot = (0, path_1.join)(context.root, options.packageRoot ?? projectConfig.root);
29
- const packageJsonPath = (0, path_1.join)(packageRoot, 'package.json');
30
- const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
31
- const packageName = packageJson.name;
21
+ const packageRoot = (0, devkit_1.joinPathFragments)(context.root, options.packageRoot ?? projectConfig.root);
22
+ const packageJsonPath = (0, devkit_1.joinPathFragments)(packageRoot, 'package.json');
23
+ const projectPackageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
24
+ const name = projectPackageJson.name;
32
25
  // If package and project name match, we can make log messages terser
33
- let packageTxt = packageName === context.projectName
34
- ? `package "${packageName}"`
35
- : `package "${packageName}" from project "${context.projectName}"`;
36
- if (packageJson.private === true) {
37
- console.warn(`Skipped ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`);
26
+ let packageTxt = name === context.projectName
27
+ ? `package "${name}"`
28
+ : `package "${name}" from project "${context.projectName}"`;
29
+ if (projectPackageJson.private === true) {
30
+ console.warn(`Skipping ${packageTxt}, because it has \`"private": true\` in ${packageJsonPath}`);
38
31
  return {
39
32
  success: true,
40
33
  };
41
34
  }
42
- const warnFn = (message) => {
43
- console.log(chalk.keyword('orange')(message));
44
- };
45
- const { registry, tag, registryConfigKey } = await (0, npm_config_1.parseRegistryOptions)(context.root, {
46
- packageRoot,
47
- packageJson,
48
- }, {
49
- registry: options.registry,
50
- tag: options.tag,
51
- }, warnFn);
52
- const npmViewCommandSegments = [
53
- `npm view ${packageName} versions dist-tags --json --"${registryConfigKey}=${registry}"`,
54
- ];
55
- const npmDistTagAddCommandSegments = [
56
- `npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}"`,
57
- ];
58
- /**
59
- * In a dry-run scenario, it is most likely that all commands are being run with dry-run, therefore
60
- * the most up to date/relevant version might not exist on disk for us to read and make the npm view
61
- * request with.
62
- *
63
- * Therefore, so as to not produce misleading output in dry around dist-tags being altered, we do not
64
- * perform the npm view step, and just show npm publish's dry-run output.
65
- */
66
- if (!isDryRun && !options.firstRelease) {
67
- const currentVersion = packageJson.version;
68
- try {
69
- const result = (0, child_process_1.execSync)(npmViewCommandSegments.join(' '), {
70
- env: processEnv(true),
71
- cwd: context.root,
72
- stdio: ['ignore', 'pipe', 'pipe'],
73
- });
74
- const resultJson = JSON.parse(result.toString());
75
- const distTags = resultJson['dist-tags'] || {};
76
- if (distTags[tag] === currentVersion) {
77
- console.warn(`Skipped ${packageTxt} because v${currentVersion} already exists in ${registry} with tag "${tag}"`);
78
- return {
79
- success: true,
80
- };
81
- }
82
- if (resultJson.versions.includes(currentVersion)) {
83
- try {
84
- if (!isDryRun) {
85
- (0, child_process_1.execSync)(npmDistTagAddCommandSegments.join(' '), {
86
- env: processEnv(true),
87
- cwd: context.root,
88
- stdio: 'ignore',
89
- });
90
- console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
91
- }
92
- else {
93
- console.log(`Would add the dist-tag ${tag} to v${currentVersion} for registry ${registry}, but ${chalk.keyword('orange')('[dry-run]')} was set.\n`);
94
- }
95
- return {
96
- success: true,
97
- };
98
- }
99
- catch (err) {
100
- try {
101
- const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
102
- // 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
103
- if (!(stdoutData.error?.code?.includes('E404') &&
104
- stdoutData.error?.summary?.includes('no such package available')) &&
105
- !(err.stderr?.toString().includes('E404') &&
106
- err.stderr?.toString().includes('no such package available'))) {
107
- console.error('npm dist-tag add error:');
108
- if (stdoutData.error.summary) {
109
- console.error(stdoutData.error.summary);
110
- }
111
- if (stdoutData.error.detail) {
112
- console.error(stdoutData.error.detail);
113
- }
114
- if (context.isVerbose) {
115
- console.error('npm dist-tag add stdout:');
116
- console.error(JSON.stringify(stdoutData, null, 2));
117
- }
118
- return {
119
- success: false,
120
- };
121
- }
122
- }
123
- catch (err) {
124
- console.error('Something unexpected went wrong when processing the npm dist-tag add output\n', err);
125
- return {
126
- success: false,
127
- };
128
- }
129
- }
130
- }
131
- }
132
- catch (err) {
133
- const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
134
- // 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
135
- if (!(stdoutData.error?.code?.includes('E404') &&
136
- stdoutData.error?.summary?.toLowerCase().includes('not found')) &&
137
- !(err.stderr?.toString().includes('E404') &&
138
- err.stderr?.toString().toLowerCase().includes('not found'))) {
139
- console.error(`Something unexpected went wrong when checking for existing dist-tags.\n`, err);
140
- return {
141
- success: false,
142
- };
143
- }
144
- }
145
- }
146
- if (options.firstRelease && context.isVerbose) {
147
- console.log('Skipped npm view because --first-release was set');
35
+ const npmPublishCommandSegments = [`npm publish --json`];
36
+ if (options.registry) {
37
+ npmPublishCommandSegments.push(`--registry=${options.registry}`);
148
38
  }
149
- const npmPublishCommandSegments = [
150
- `npm publish ${packageRoot} --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
151
- ];
152
- if (options.otp) {
153
- npmPublishCommandSegments.push(`--otp=${options.otp}`);
39
+ if (options.tag) {
40
+ npmPublishCommandSegments.push(`--tag=${options.tag}`);
154
41
  }
155
- if (isDryRun) {
42
+ if (options.dryRun) {
156
43
  npmPublishCommandSegments.push(`--dry-run`);
157
44
  }
45
+ // Resolve values using the `npm config` command so that things like environment variables and `publishConfig`s are accounted for
46
+ const registry = options.registry ?? (0, child_process_1.execSync)(`npm config get registry`).toString().trim();
47
+ const tag = options.tag ?? (0, child_process_1.execSync)(`npm config get tag`).toString().trim();
158
48
  try {
159
49
  const output = (0, child_process_1.execSync)(npmPublishCommandSegments.join(' '), {
160
50
  maxBuffer: LARGE_BUFFER,
161
51
  env: processEnv(true),
162
- cwd: context.root,
52
+ cwd: packageRoot,
163
53
  stdio: ['ignore', 'pipe', 'pipe'],
164
54
  });
165
55
  const stdoutData = JSON.parse(output.toString());
166
56
  // If npm workspaces are in use, the publish output will nest the data under the package name, so we normalize it first
167
- const normalizedStdoutData = stdoutData[packageName] ?? stdoutData;
57
+ const normalizedStdoutData = stdoutData[context.projectName] ?? stdoutData;
168
58
  (0, log_tar_1.logTar)(normalizedStdoutData);
169
- if (isDryRun) {
59
+ if (options.dryRun) {
170
60
  console.log(`Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`);
171
61
  }
172
62
  else {
@@ -178,7 +68,16 @@ async function runExecutor(options, context) {
178
68
  }
179
69
  catch (err) {
180
70
  try {
71
+ const currentVersion = projectPackageJson.version;
181
72
  const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
73
+ if (stdoutData.error?.code === 'EPUBLISHCONFLICT' ||
74
+ (stdoutData.error?.code === 'E403' &&
75
+ stdoutData.error?.body?.error?.includes('You cannot publish over the previously published versions'))) {
76
+ console.warn(`Skipping ${packageTxt}, as v${currentVersion} has already been published to ${registry} with tag "${tag}"`);
77
+ return {
78
+ success: true,
79
+ };
80
+ }
182
81
  console.error('npm publish error:');
183
82
  if (stdoutData.error.summary) {
184
83
  console.error(stdoutData.error.summary);
@@ -186,15 +85,13 @@ async function runExecutor(options, context) {
186
85
  if (stdoutData.error.detail) {
187
86
  console.error(stdoutData.error.detail);
188
87
  }
189
- if (context.isVerbose) {
190
- console.error('npm publish stdout:');
191
- console.error(JSON.stringify(stdoutData, null, 2));
192
- }
193
88
  return {
194
89
  success: false,
195
90
  };
196
91
  }
197
92
  catch (err) {
93
+ // npm v9 onwards seems to guarantee stdout will be well formed JSON when --json is used, so maybe we need to
94
+ // specify that as minimum supported version? (comes with node 18 and 20 by default)
198
95
  console.error('Something unexpected went wrong when processing the npm publish output\n', err);
199
96
  return {
200
97
  success: false,
@@ -2,7 +2,5 @@ export interface PublishExecutorSchema {
2
2
  packageRoot?: string;
3
3
  registry?: string;
4
4
  tag?: string;
5
- otp?: number;
6
5
  dryRun?: boolean;
7
- firstRelease?: boolean;
8
6
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Implementation details of `nx release publish`",
5
5
  "description": "DO NOT INVOKE DIRECTLY WITH `nx run`. Use `nx release publish` instead.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "direct-nodejs",
4
- "$schema": "https://json-schema.org/schema",
4
+ "$schema": "http://json-schema.org/schema",
5
5
  "cli": "nx",
6
6
  "title": "Typescript Build Target",
7
7
  "description": "Builds using SWC.",
@@ -42,7 +42,7 @@ function normalizeOptions(options, root, sourceRoot, projectRoot) {
42
42
  // default to current directory if projectRootParts is [].
43
43
  // Eg: when a project is at the root level, outside of layout dir
44
44
  const swcCwd = projectRootParts.join('/') || '.';
45
- const { swcrcPath, tmpSwcrcPath } = (0, get_swcrc_path_1.getSwcrcPath)(options, root, projectRoot);
45
+ const swcrcPath = (0, get_swcrc_path_1.getSwcrcPath)(options, root, projectRoot);
46
46
  const swcCliOptions = {
47
47
  srcPath: projectDir,
48
48
  destPath: (0, path_1.relative)((0, path_1.join)(root, swcCwd), outputPath),
@@ -60,7 +60,6 @@ function normalizeOptions(options, root, sourceRoot, projectRoot) {
60
60
  outputPath,
61
61
  tsConfig: (0, path_1.join)(root, options.tsConfig),
62
62
  swcCliOptions,
63
- tmpSwcrcPath,
64
63
  };
65
64
  }
66
65
  async function* swcExecutor(_options, context) {
@@ -80,11 +79,14 @@ async function* swcExecutor(_options, context) {
80
79
  // remap paths for SWC compilation
81
80
  options.swcCliOptions.srcPath = options.swcCliOptions.swcCwd;
82
81
  options.swcCliOptions.swcCwd = '.';
83
- options.swcCliOptions.destPath = (0, path_1.join)(options.swcCliOptions.destPath.split((0, path_1.normalize)('../')).at(-1), options.swcCliOptions.srcPath);
82
+ options.swcCliOptions.destPath = options.swcCliOptions.destPath
83
+ .split('../')
84
+ .at(-1)
85
+ .concat('/', options.swcCliOptions.srcPath);
84
86
  // tmp swcrc with dependencies to exclude
85
87
  // - buildable libraries
86
88
  // - other libraries that are not dependent on the current project
87
- options.swcCliOptions.swcrcPath = (0, inline_2.generateTmpSwcrc)(inlineProjectGraph, options.swcCliOptions.swcrcPath, options.tmpSwcrcPath);
89
+ options.swcCliOptions.swcrcPath = (0, inline_2.generateTmpSwcrc)(inlineProjectGraph, options.swcCliOptions.swcrcPath);
88
90
  }
89
91
  function determineModuleFormatFromSwcrc(absolutePathToSwcrc) {
90
92
  const swcrc = (0, devkit_1.readJsonFile)(absolutePathToSwcrc);
@@ -134,8 +136,7 @@ async function* swcExecutor(_options, context) {
134
136
  }
135
137
  exports.swcExecutor = swcExecutor;
136
138
  function removeTmpSwcrc(swcrcPath) {
137
- if (swcrcPath.includes((0, path_1.normalize)('tmp/')) &&
138
- swcrcPath.includes('.generated.swcrc')) {
139
+ if (swcrcPath.includes('tmp/') && swcrcPath.includes('.generated.swcrc')) {
139
140
  (0, fs_extra_1.removeSync)((0, path_1.dirname)(swcrcPath));
140
141
  }
141
142
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "Verdaccio Local Registry",
5
5
  "description": "Start a local registry with Verdaccio.",
@@ -149,7 +149,7 @@ function getYarnUnsafeHttpWhitelist(isYarnV1) {
149
149
  : null;
150
150
  }
151
151
  function setYarnUnsafeHttpWhitelist(currentWhitelist, options) {
152
- if (currentWhitelist.size > 0) {
152
+ if (currentWhitelist.size > 1) {
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 {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "$id": "NxTypescriptLibrary",
4
4
  "cli": "nx",
5
5
  "title": "Convert a TSC library to SWC",
@@ -49,9 +49,8 @@ async function initGenerator(tree, schema) {
49
49
  // we prefer to use SWC, and fallback to ts-node for workspaces that don't use SWC.
50
50
  '@swc-node/register': versions_1.swcNodeVersion,
51
51
  '@swc/core': versions_1.swcCoreVersion,
52
- '@swc/helpers': versions_1.swcHelpersVersion,
53
52
  };
54
- if (!schema.js && !schema.keepExistingVersions) {
53
+ if (!schema.js) {
55
54
  const installedTsVersion = await getInstalledTypescriptVersion(tree);
56
55
  if (!installedTsVersion ||
57
56
  !(0, semver_2.satisfies)(installedTsVersion, versions_1.supportedTypescriptVersions, {
@@ -97,7 +96,7 @@ async function initGenerator(tree, schema) {
97
96
  });
98
97
  }
99
98
  const installTask = !schema.skipPackageJson
100
- ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, schema.keepExistingVersions)
99
+ ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies)
101
100
  : () => { };
102
101
  tasks.push(installTask);
103
102
  (0, devkit_1.ensurePackage)('prettier', versions_1.prettierVersion);
@@ -2,6 +2,5 @@ export interface InitSchema {
2
2
  js?: boolean;
3
3
  skipFormat?: boolean;
4
4
  skipPackageJson?: boolean;
5
- keepExistingVersions?: boolean;
6
5
  tsConfigName?: string;
7
6
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "$id": "NxTypescriptInit",
4
4
  "cli": "nx",
5
5
  "title": "Init nx/js",
@@ -21,12 +21,6 @@
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
- },
30
24
  "tsConfigName": {
31
25
  "type": "string",
32
26
  "description": "Customize the generated tsconfig file name.",
@@ -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 <% if(unitTestRunner === 'jest') { %>[Jest](https://jestjs.io)<% } else { %>[Vitest](https://vitest.dev/)<% } %>.
17
+ Run `<%= cliCommand %> test <%= name %>` to execute the unit tests via [Jest](https://jestjs.io).
18
18
 
19
19
  <% } %>
@@ -6,9 +6,5 @@
6
6
  "types": ["node"]
7
7
  },
8
8
  "include": ["src/**/*.ts"<% if (js) { %>, "src/**/*.js"<% } %>],
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
- ]
9
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"<% if (js) { %>, "src/**/*.spec.js", "src/**/*.test.js"<% } %>]
14
10
  }
@@ -11,6 +11,6 @@ export interface NormalizedSchema extends LibraryGeneratorSchema {
11
11
  parsedTags: string[];
12
12
  importPath?: string;
13
13
  }
14
- export type AddLintOptions = Pick<NormalizedSchema, 'name' | 'linter' | 'projectRoot' | 'unitTestRunner' | 'js' | 'setParserOptionsProject' | 'rootProject' | 'bundler' | 'addPlugin'>;
14
+ export type AddLintOptions = Pick<NormalizedSchema, 'name' | 'linter' | 'projectRoot' | 'unitTestRunner' | 'js' | 'setParserOptionsProject' | 'rootProject' | 'bundler'>;
15
15
  export declare function addLint(tree: Tree, options: AddLintOptions): Promise<GeneratorCallback>;
16
16
  export default libraryGenerator;