@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
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNpmTag = exports.getNpmRegistry = exports.parseRegistryOptions = void 0;
4
- const child_process_1 = require("child_process");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
7
- async function parseRegistryOptions(cwd, pkg, options, logWarnFn = console.warn) {
8
- const npmRcPath = (0, path_1.join)(pkg.packageRoot, '.npmrc');
9
- if ((0, fs_1.existsSync)(npmRcPath)) {
10
- const relativeNpmRcPath = (0, path_1.relative)(cwd, npmRcPath);
11
- logWarnFn(`\nIgnoring .npmrc file detected in the package root: ${relativeNpmRcPath}. Nested .npmrc files are not supported by npm. Only the .npmrc file at the root of the workspace will be used. To customize the registry or tag for specific packages, see https://nx.dev/recipes/nx-release/configure-custom-registries\n`);
12
- }
13
- const scope = pkg.packageJson.name.startsWith('@')
14
- ? pkg.packageJson.name.split('/')[0]
15
- : '';
16
- // If the package is scoped, then the registry argument that will
17
- // correctly override the registry in the .npmrc file must be scoped.
18
- const registryConfigKey = scope ? `${scope}:registry` : 'registry';
19
- const publishConfigRegistry = pkg.packageJson.publishConfig?.[registryConfigKey];
20
- // Even though it won't override the actual registry that's actually used,
21
- // the user might think otherwise, so we should still warn if the user has
22
- // set a 'registry' in 'publishConfig' for a scoped package.
23
- if (publishConfigRegistry || pkg.packageJson.publishConfig?.registry) {
24
- const relativePackageJsonPath = (0, path_1.relative)(cwd, (0, path_1.join)(pkg.packageRoot, 'package.json'));
25
- if (options.registry) {
26
- logWarnFn(`\nRegistry detected in the 'publishConfig' of the package manifest: ${relativePackageJsonPath}. This will override your registry option set in the project configuration or passed via the --registry argument, which is why configuring the registry with 'publishConfig' is not recommended. For details, see https://nx.dev/recipes/nx-release/configure-custom-registries\n`);
27
- }
28
- else {
29
- logWarnFn(`\nRegistry detected in the 'publishConfig' of the package manifest: ${relativePackageJsonPath}. Configuring the registry in this way is not recommended because it prevents the registry from being overridden in project configuration or via the --registry argument. To customize the registry for specific packages, see https://nx.dev/recipes/nx-release/configure-custom-registries\n`);
30
- }
31
- }
32
- const registry =
33
- // `npm publish` will always use the publishConfig registry if it exists, even over the --registry arg
34
- publishConfigRegistry ||
35
- options.registry ||
36
- (await getNpmRegistry(cwd, scope));
37
- const tag = options.tag || (await getNpmTag(cwd));
38
- return { registry, tag, registryConfigKey };
39
- }
40
- exports.parseRegistryOptions = parseRegistryOptions;
41
- /**
42
- * Returns the npm registry that is used for publishing.
43
- *
44
- * @param scope the scope of the package for which to determine the registry
45
- * @param cwd the directory where the npm config should be read from
46
- */
47
- async function getNpmRegistry(cwd, scope) {
48
- let registry;
49
- if (scope) {
50
- registry = await getNpmConfigValue(`${scope}:registry`, cwd);
51
- }
52
- if (!registry) {
53
- registry = await getNpmConfigValue('registry', cwd);
54
- }
55
- return registry;
56
- }
57
- exports.getNpmRegistry = getNpmRegistry;
58
- /**
59
- * Returns the npm tag that is used for publishing.
60
- *
61
- * @param cwd the directory where the npm config should be read from
62
- */
63
- async function getNpmTag(cwd) {
64
- // npm does not support '@scope:tag' in the npm config, so we only need to check for 'tag'.
65
- return getNpmConfigValue('tag', cwd);
66
- }
67
- exports.getNpmTag = getNpmTag;
68
- async function getNpmConfigValue(key, cwd) {
69
- try {
70
- const result = await execAsync(`npm config get ${key}`, cwd);
71
- return result === 'undefined' ? undefined : result;
72
- }
73
- catch (e) {
74
- return Promise.resolve(undefined);
75
- }
76
- }
77
- async function execAsync(command, cwd) {
78
- // Must be non-blocking async to allow spinner to render
79
- return new Promise((resolve, reject) => {
80
- (0, child_process_1.exec)(command, { cwd }, (error, stdout, stderr) => {
81
- if (error) {
82
- return reject(error);
83
- }
84
- if (stderr) {
85
- return reject(stderr);
86
- }
87
- return resolve(stdout.trim());
88
- });
89
- });
90
- }