@nx/js 17.0.3 → 17.0.4
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/LICENSE +1 -1
- package/README.md +9 -4
- package/babel.js +36 -16
- package/executors.json +1 -1
- package/migrations.json +56 -0
- package/package.json +9 -9
- package/src/executors/node/node.impl.js +1 -1
- package/src/executors/node/schema.json +1 -1
- package/src/executors/release-publish/release-publish.impl.js +135 -32
- package/src/executors/release-publish/schema.d.ts +2 -0
- package/src/executors/release-publish/schema.json +1 -1
- package/src/executors/swc/schema.json +1 -1
- package/src/executors/swc/swc.impl.js +6 -7
- package/src/executors/verdaccio/schema.json +1 -1
- package/src/executors/verdaccio/verdaccio.impl.js +1 -1
- package/src/generators/convert-to-swc/schema.json +1 -1
- package/src/generators/init/init.js +3 -2
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +7 -1
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +5 -1
- package/src/generators/library/files/{lib → readme}/README.md +1 -1
- package/src/generators/library/library.d.ts +1 -1
- package/src/generators/library/library.js +171 -29
- package/src/generators/library/schema.json +8 -2
- package/src/generators/release-version/release-version.d.ts +2 -1
- package/src/generators/release-version/release-version.js +341 -86
- package/src/generators/release-version/schema.json +26 -4
- package/src/generators/release-version/utils/resolve-local-package-dependencies.d.ts +7 -1
- package/src/generators/release-version/utils/resolve-local-package-dependencies.js +14 -4
- package/src/generators/release-version/utils/resolve-version-spec.js +4 -1
- package/src/generators/release-version/utils/update-lock-file.d.ts +5 -0
- package/src/generators/release-version/utils/update-lock-file.js +105 -0
- package/src/generators/setup-build/generator.js +3 -0
- package/src/generators/setup-build/schema.json +1 -1
- package/src/generators/setup-verdaccio/schema.json +1 -1
- package/src/utils/add-local-registry-scripts.js +26 -6
- package/src/utils/assets/copy-assets-handler.js +4 -4
- package/src/utils/buildable-libs-utils.js +6 -2
- package/src/utils/find-npm-dependencies.d.ts +2 -1
- package/src/utils/find-npm-dependencies.js +28 -11
- package/src/utils/inline.js +6 -4
- package/src/utils/npm-config.d.ts +25 -0
- package/src/utils/npm-config.js +90 -0
- package/src/utils/schema.d.ts +3 -0
- package/src/utils/swc/get-swcrc-path.d.ts +4 -1
- package/src/utils/swc/get-swcrc-path.js +6 -1
- package/src/utils/swc/inline.d.ts +1 -1
- package/src/utils/swc/inline.js +1 -2
- package/src/utils/typescript/ast-utils.js +2 -3
- package/src/utils/typescript/ts-config.js +1 -0
- package/src/utils/versions.d.ts +4 -4
- package/src/utils/versions.js +4 -4
- package/src/utils/minimal-publish-script.d.ts +0 -2
- package/src/utils/minimal-publish-script.js +0 -74
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addMinimalPublishScript = void 0;
|
|
4
|
-
const publishScriptContent = `
|
|
5
|
-
/**
|
|
6
|
-
* This is a minimal script to publish your package to "npm".
|
|
7
|
-
* This is meant to be used as-is or customize as you see fit.
|
|
8
|
-
*
|
|
9
|
-
* This script is executed on "dist/path/to/library" as "cwd" by default.
|
|
10
|
-
*
|
|
11
|
-
* You might need to authenticate with NPM before running this script.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { execSync } from 'child_process';
|
|
15
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
16
|
-
|
|
17
|
-
import devkit from '@nx/devkit';
|
|
18
|
-
const { readCachedProjectGraph } = devkit;
|
|
19
|
-
|
|
20
|
-
function invariant(condition, message) {
|
|
21
|
-
if (!condition) {
|
|
22
|
-
console.error(message);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag}
|
|
28
|
-
// Default "tag" to "next" so we won't publish the "latest" tag by accident.
|
|
29
|
-
const [, , name, version, tag = 'next'] = process.argv;
|
|
30
|
-
|
|
31
|
-
// A simple SemVer validation to validate the version
|
|
32
|
-
const validVersion = /^\\d+\\.\\d+\\.\\d+(-\\w+\\.\\d+)?/;
|
|
33
|
-
invariant(
|
|
34
|
-
version && validVersion.test(version),
|
|
35
|
-
\`No version provided or version did not match Semantic Versioning, expected: #.#.#-tag.# or #.#.#, got \${version}.\`
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const graph = readCachedProjectGraph();
|
|
40
|
-
const project = graph.nodes[name];
|
|
41
|
-
|
|
42
|
-
invariant(
|
|
43
|
-
project,
|
|
44
|
-
\`Could not find project "\${name}" in the workspace. Is the project.json configured correctly?\`
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const outputPath = project.data?.targets?.build?.options?.outputPath;
|
|
48
|
-
invariant(
|
|
49
|
-
outputPath,
|
|
50
|
-
\`Could not find "build.options.outputPath" of project "\${name}". Is project.json configured correctly?\`
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
process.chdir(outputPath);
|
|
54
|
-
|
|
55
|
-
// Updating the version in "package.json" before publishing
|
|
56
|
-
try {
|
|
57
|
-
const json = JSON.parse(readFileSync(\`package.json\`).toString());
|
|
58
|
-
json.version = version;
|
|
59
|
-
writeFileSync(\`package.json\`, JSON.stringify(json, null, 2));
|
|
60
|
-
} catch (e) {
|
|
61
|
-
console.error(\`Error reading package.json file from library build output.\`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Execute "npm publish" to publish
|
|
65
|
-
execSync(\`npm publish --access public --tag \${tag}\`);
|
|
66
|
-
`;
|
|
67
|
-
function addMinimalPublishScript(tree) {
|
|
68
|
-
const publishScriptPath = 'tools/scripts/publish.mjs';
|
|
69
|
-
if (!tree.exists(publishScriptPath)) {
|
|
70
|
-
tree.write(publishScriptPath, publishScriptContent);
|
|
71
|
-
}
|
|
72
|
-
return publishScriptPath;
|
|
73
|
-
}
|
|
74
|
-
exports.addMinimalPublishScript = addMinimalPublishScript;
|