@nx/js 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca
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 +1 -1
- package/babel.js +1 -1
- package/generators.json +6 -1
- package/migrations.json +33 -138
- package/package.json +12 -13
- package/src/executors/node/lib/kill-tree.js +3 -3
- package/src/executors/node/node.impl.d.ts +1 -1
- package/src/executors/node/node.impl.js +24 -6
- package/src/executors/release-publish/release-publish.impl.js +61 -20
- package/src/executors/swc/schema.json +5 -5
- package/src/executors/swc/swc.impl.d.ts +1 -1
- package/src/executors/swc/swc.impl.js +70 -48
- package/src/executors/tsc/lib/get-tsconfig.js +8 -1
- package/src/executors/tsc/lib/normalize-options.js +1 -0
- package/src/executors/tsc/schema.json +8 -3
- package/src/executors/tsc/tsc.impl.d.ts +1 -1
- package/src/executors/tsc/tsc.impl.js +16 -11
- package/src/executors/verdaccio/schema.d.ts +1 -1
- package/src/executors/verdaccio/schema.json +3 -1
- package/src/executors/verdaccio/verdaccio.impl.js +36 -34
- package/src/generators/convert-to-swc/convert-to-swc.js +10 -7
- package/src/generators/init/files/ts-solution/tsconfig.base.json__tmpl__ +23 -0
- package/src/generators/init/files/ts-solution/tsconfig.json__tmpl__ +6 -0
- package/src/generators/init/init.js +68 -54
- package/src/generators/init/schema.d.ts +5 -1
- package/src/generators/init/schema.json +6 -6
- package/src/generators/library/files/lib/src/index.ts__tmpl__ +1 -1
- package/src/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +5 -5
- package/src/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +1 -1
- package/src/generators/library/files/readme/README.md +3 -11
- package/src/generators/library/files/tsconfig-lib/non-ts-solution/tsconfig.lib.json__tmpl__ +9 -0
- package/src/generators/library/files/tsconfig-lib/ts-solution/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/library.d.ts +2 -11
- package/src/generators/library/library.js +425 -248
- package/src/generators/library/schema.d.ts +50 -0
- package/src/generators/library/schema.json +21 -30
- package/src/generators/library/utils/add-release-config.d.ts +11 -0
- package/src/generators/library/utils/add-release-config.js +150 -0
- package/src/generators/release-version/release-version.d.ts +1 -1
- package/src/generators/release-version/release-version.js +67 -28
- package/src/generators/release-version/schema.d.ts +1 -1
- package/src/generators/release-version/schema.json +23 -4
- package/src/generators/setup-build/generator.js +138 -23
- package/src/generators/setup-prettier/generator.d.ts +4 -0
- package/src/generators/setup-prettier/generator.js +21 -0
- package/src/generators/setup-prettier/schema.d.ts +4 -0
- package/src/generators/setup-prettier/schema.json +22 -0
- package/src/generators/setup-verdaccio/generator.js +15 -11
- package/src/generators/typescript-sync/typescript-sync.js +91 -71
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -3
- package/src/plugins/jest/start-local-registry.d.ts +3 -1
- package/src/plugins/jest/start-local-registry.js +19 -11
- package/src/plugins/typescript/plugin.d.ts +3 -0
- package/src/plugins/typescript/plugin.js +537 -99
- package/src/plugins/typescript/util.d.ts +18 -0
- package/src/plugins/typescript/util.js +108 -0
- package/src/release/utils/update-lock-file.d.ts +10 -0
- package/src/{generators/release-version → release}/utils/update-lock-file.js +13 -10
- package/src/release/version-actions.d.ts +22 -0
- package/src/release/version-actions.js +202 -0
- package/src/utils/add-local-registry-scripts.js +24 -8
- package/src/utils/assets/assets.js +3 -2
- package/src/utils/assets/copy-assets-handler.js +18 -10
- package/src/utils/buildable-libs-utils.d.ts +0 -2
- package/src/utils/buildable-libs-utils.js +20 -49
- package/src/utils/find-npm-dependencies.d.ts +1 -0
- package/src/utils/find-npm-dependencies.js +24 -2
- package/src/utils/generator-prompts.d.ts +3 -0
- package/src/utils/generator-prompts.js +40 -0
- package/src/utils/npm-config.js +2 -5
- package/src/utils/package-json/create-entry-points.js +5 -2
- package/src/utils/package-json/sort-fields.d.ts +2 -0
- package/src/utils/package-json/sort-fields.js +40 -0
- package/src/utils/package-json/update-package-json.d.ts +4 -1
- package/src/utils/package-json/update-package-json.js +89 -19
- package/src/utils/package-manager-workspaces.d.ts +7 -0
- package/src/utils/package-manager-workspaces.js +84 -0
- package/src/utils/prettier.d.ts +5 -0
- package/src/utils/prettier.js +102 -6
- package/src/utils/schema.d.ts +4 -34
- package/src/utils/swc/add-swc-config.d.ts +2 -1
- package/src/utils/swc/add-swc-config.js +24 -8
- package/src/utils/swc/add-swc-dependencies.d.ts +4 -0
- package/src/utils/swc/add-swc-dependencies.js +11 -4
- package/src/utils/swc/compile-swc.d.ts +1 -1
- package/src/utils/swc/compile-swc.js +26 -13
- package/src/utils/typescript/configuration.d.ts +7 -0
- package/src/utils/typescript/configuration.js +64 -0
- package/src/utils/typescript/plugin.d.ts +3 -0
- package/src/utils/typescript/plugin.js +138 -0
- package/src/utils/typescript/run-type-check.d.ts +1 -0
- package/src/utils/typescript/run-type-check.js +6 -4
- package/src/utils/typescript/ts-config.d.ts +3 -2
- package/src/utils/typescript/ts-config.js +15 -3
- package/src/utils/typescript/ts-solution-setup.d.ts +9 -0
- package/src/utils/typescript/ts-solution-setup.js +214 -0
- package/src/utils/versions.d.ts +5 -5
- package/src/utils/versions.js +5 -5
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +0 -14
- package/src/generators/release-version/utils/update-lock-file.d.ts +0 -5
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts +0 -2
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +0 -34
- package/src/migrations/update-16-8-2/update-swcrc.d.ts +0 -2
- package/src/migrations/update-16-8-2/update-swcrc.js +0 -23
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.d.ts +0 -6
- package/src/migrations/update-17-0-0/remove-deprecated-build-options.js +0 -30
- package/src/utils/typescript/tsnode-register.d.ts +0 -1
- package/src/utils/typescript/tsnode-register.js +0 -23
- /package/src/generators/init/files/{__fileName__ → non-ts-solution/__fileName__} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://circleci.com/gh/nrwl/nx)
|
|
11
11
|
[]()
|
|
12
|
-
[](https://www.npmjs.com/package/nx)
|
|
13
13
|
[]()
|
|
14
14
|
[](http://commitizen.github.io/cz-cli/)
|
|
15
15
|
[](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
package/babel.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = function (api, options = {}) {
|
|
|
13
13
|
const emitDecoratorMetadata = api.caller((caller) => caller?.emitDecoratorMetadata ?? true);
|
|
14
14
|
// Determine settings for `@babel//babel-plugin-transform-class-properties`,
|
|
15
15
|
// so that we can sync the `loose` option with `@babel/preset-env`.
|
|
16
|
-
// TODO(
|
|
16
|
+
// TODO(v21): Remove classProperties since it's no longer needed, now that the class props transform is in preset-env.
|
|
17
17
|
const loose = options.classProperties?.loose ?? options.loose ?? true;
|
|
18
18
|
if (options.classProperties) {
|
|
19
19
|
devkit_1.logger.warn(`Use =\`loose\` option instead of \`classProperties.loose\`. The \`classProperties\` option will be removed in Nx 20`);
|
package/generators.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"description": "Create a library"
|
|
11
11
|
},
|
|
12
12
|
"init": {
|
|
13
|
-
"factory": "./src/generators/init/init#
|
|
13
|
+
"factory": "./src/generators/init/init#initGeneratorInternal",
|
|
14
14
|
"schema": "./src/generators/init/schema.json",
|
|
15
15
|
"aliases": ["lib"],
|
|
16
16
|
"x-type": "init",
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"description": "Synchronize TypeScript project references based on the project graph",
|
|
49
49
|
"alias": ["sync"],
|
|
50
50
|
"hidden": true
|
|
51
|
+
},
|
|
52
|
+
"setup-prettier": {
|
|
53
|
+
"factory": "./src/generators/setup-prettier/generator",
|
|
54
|
+
"schema": "./src/generators/setup-prettier/schema.json",
|
|
55
|
+
"description": "Setup Prettier as the formatting tool."
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
}
|
package/migrations.json
CHANGED
|
@@ -1,190 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"update-16-0-0-add-nx-packages": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "16.0.0-beta.1",
|
|
6
|
-
"description": "Replace @nrwl/js with @nx/js",
|
|
7
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
8
|
-
},
|
|
9
|
-
"explicitly-set-projects-to-update-buildable-deps": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "16.6.0-beta.0",
|
|
12
|
-
"description": "Explicitly set 'updateBuildableProjectDepsInPackageJson' to 'true' in targets that rely on that value as the default.",
|
|
13
|
-
"factory": "./src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps"
|
|
14
|
-
},
|
|
15
|
-
"16-8-2-update-swcrc": {
|
|
16
|
-
"cli": "nx",
|
|
17
|
-
"version": "16.8.2-beta.0",
|
|
18
|
-
"description": "Remove invalid options (strict, noInterop) for ES6 type modules.",
|
|
19
|
-
"factory": "./src/migrations/update-16-8-2/update-swcrc"
|
|
20
|
-
},
|
|
21
|
-
"update-17-0-0-remove-deprecated-build-options": {
|
|
22
|
-
"cli": "nx",
|
|
23
|
-
"version": "17.0.2",
|
|
24
|
-
"description": "Remove deprecated build options",
|
|
25
|
-
"implementation": "./src/migrations/update-17-0-0/remove-deprecated-build-options"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
2
|
+
"generators": {},
|
|
28
3
|
"packageJsonUpdates": {
|
|
29
|
-
"
|
|
30
|
-
"version": "
|
|
4
|
+
"19.0.0": {
|
|
5
|
+
"version": "19.0.0-beta.0",
|
|
31
6
|
"packages": {
|
|
32
7
|
"@swc/cli": {
|
|
33
|
-
"version": "~0.
|
|
34
|
-
"alwaysAddToPackageJson": false
|
|
35
|
-
},
|
|
36
|
-
"@swc/helpers": {
|
|
37
|
-
"version": "~0.5.0",
|
|
8
|
+
"version": "~0.3.12",
|
|
38
9
|
"alwaysAddToPackageJson": false
|
|
39
10
|
}
|
|
40
11
|
}
|
|
41
12
|
},
|
|
42
|
-
"
|
|
43
|
-
"version": "
|
|
44
|
-
"x-prompt": "Do you want to update to TypeScript v5.0?",
|
|
45
|
-
"requires": {
|
|
46
|
-
"typescript": ">=4.9.5 <5.0.0"
|
|
47
|
-
},
|
|
48
|
-
"packages": {
|
|
49
|
-
"typescript": {
|
|
50
|
-
"version": "~5.0.2"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"16.4.0": {
|
|
55
|
-
"version": "16.4.0-beta.11",
|
|
56
|
-
"x-prompt": "Do you want to update to TypeScript v5.1?",
|
|
57
|
-
"requires": {
|
|
58
|
-
"typescript": ">=5.0.0 <5.1.0"
|
|
59
|
-
},
|
|
60
|
-
"packages": {
|
|
61
|
-
"typescript": {
|
|
62
|
-
"version": "~5.1.3"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"16.8.2": {
|
|
67
|
-
"version": "16.8.2-beta.0",
|
|
13
|
+
"19.2.0": {
|
|
14
|
+
"version": "19.2.0-beta.0",
|
|
68
15
|
"packages": {
|
|
69
16
|
"@swc/core": {
|
|
70
|
-
"version": "~1.
|
|
17
|
+
"version": "~1.5.7",
|
|
71
18
|
"alwaysAddToPackageJson": false
|
|
72
19
|
},
|
|
73
20
|
"@swc/helpers": {
|
|
74
|
-
"version": "~0.5.
|
|
21
|
+
"version": "~0.5.11",
|
|
75
22
|
"alwaysAddToPackageJson": false
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"16.9.2": {
|
|
80
|
-
"version": "16.9.2-beta.0",
|
|
81
|
-
"packages": {
|
|
23
|
+
},
|
|
82
24
|
"@swc-node/register": {
|
|
83
|
-
"version": "~1.
|
|
84
|
-
"alwaysAddToPackageJson": false
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"17.0.0": {
|
|
89
|
-
"version": "17.0.0-rc.2",
|
|
90
|
-
"packages": {
|
|
91
|
-
"esbuild": {
|
|
92
|
-
"version": "^0.19.2",
|
|
25
|
+
"version": "~1.9.1",
|
|
93
26
|
"alwaysAddToPackageJson": false
|
|
94
27
|
}
|
|
95
28
|
}
|
|
96
29
|
},
|
|
97
|
-
"
|
|
98
|
-
"version": "
|
|
99
|
-
"x-prompt": "Do you want to update to TypeScript v5.
|
|
30
|
+
"19.5.1": {
|
|
31
|
+
"version": "19.5.0-beta.1",
|
|
32
|
+
"x-prompt": "Do you want to update to TypeScript v5.5?",
|
|
100
33
|
"requires": {
|
|
101
|
-
"typescript": ">=5.
|
|
34
|
+
"typescript": ">=5.4.0 <5.5.0"
|
|
102
35
|
},
|
|
103
36
|
"packages": {
|
|
104
37
|
"typescript": {
|
|
105
|
-
"version": "~5.
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"17.3.0": {
|
|
110
|
-
"version": "17.3.0-beta.3",
|
|
111
|
-
"packages": {
|
|
112
|
-
"@types/node": {
|
|
113
|
-
"version": "^18.16.9",
|
|
38
|
+
"version": "~5.5.2",
|
|
114
39
|
"alwaysAddToPackageJson": false
|
|
115
40
|
}
|
|
116
41
|
}
|
|
117
42
|
},
|
|
118
|
-
"
|
|
119
|
-
"version": "
|
|
120
|
-
"x-prompt": "Do you want to update to TypeScript v5.
|
|
43
|
+
"20.2.0": {
|
|
44
|
+
"version": "20.2.0-beta.5",
|
|
45
|
+
"x-prompt": "Do you want to update to TypeScript v5.6?",
|
|
121
46
|
"requires": {
|
|
122
|
-
"typescript": ">=5.
|
|
47
|
+
"typescript": ">=5.5.0 <5.6.0"
|
|
123
48
|
},
|
|
124
49
|
"packages": {
|
|
125
50
|
"typescript": {
|
|
126
|
-
"version": "~5.
|
|
51
|
+
"version": "~5.6.2",
|
|
127
52
|
"alwaysAddToPackageJson": false
|
|
128
53
|
}
|
|
129
54
|
}
|
|
130
55
|
},
|
|
131
|
-
"
|
|
132
|
-
"version": "
|
|
133
|
-
"
|
|
134
|
-
"@swc-node/register": {
|
|
135
|
-
"version": "~1.8.0",
|
|
136
|
-
"alwaysAddToPackageJson": false
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"18.2.0": {
|
|
141
|
-
"version": "18.2.0-beta.0",
|
|
142
|
-
"x-prompt": "Do you want to update to TypeScript v5.4?",
|
|
56
|
+
"20.4.0": {
|
|
57
|
+
"version": "20.4.0-beta.1",
|
|
58
|
+
"x-prompt": "Do you want to update to TypeScript v5.7?",
|
|
143
59
|
"requires": {
|
|
144
|
-
"typescript": ">=5.
|
|
60
|
+
"typescript": ">=5.6.0 <5.7.0"
|
|
145
61
|
},
|
|
146
62
|
"packages": {
|
|
147
63
|
"typescript": {
|
|
148
|
-
"version": "~5.
|
|
149
|
-
"alwaysAddToPackageJson": false
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"19.0.0": {
|
|
154
|
-
"version": "19.0.0-beta.0",
|
|
155
|
-
"packages": {
|
|
156
|
-
"@swc/cli": {
|
|
157
|
-
"version": "~0.3.12",
|
|
64
|
+
"version": "~5.7.2",
|
|
158
65
|
"alwaysAddToPackageJson": false
|
|
159
66
|
}
|
|
160
67
|
}
|
|
161
68
|
},
|
|
162
|
-
"
|
|
163
|
-
"version": "
|
|
69
|
+
"20.5.0": {
|
|
70
|
+
"version": "20.5.0-beta.3",
|
|
164
71
|
"packages": {
|
|
165
|
-
"
|
|
166
|
-
"version": "
|
|
167
|
-
"alwaysAddToPackageJson": false
|
|
168
|
-
},
|
|
169
|
-
"@swc/helpers": {
|
|
170
|
-
"version": "~0.5.11",
|
|
171
|
-
"alwaysAddToPackageJson": false
|
|
172
|
-
},
|
|
173
|
-
"@swc-node/register": {
|
|
174
|
-
"version": "~1.9.1",
|
|
72
|
+
"verdaccio": {
|
|
73
|
+
"version": "^6.0.5",
|
|
175
74
|
"alwaysAddToPackageJson": false
|
|
176
75
|
}
|
|
177
76
|
}
|
|
178
77
|
},
|
|
179
|
-
"
|
|
180
|
-
"version": "
|
|
181
|
-
"x-prompt": "Do you want to update to TypeScript v5.5?",
|
|
182
|
-
"requires": {
|
|
183
|
-
"typescript": ">=5.4.0 <5.5.0"
|
|
184
|
-
},
|
|
78
|
+
"20.7.1-beta.0": {
|
|
79
|
+
"version": "20.7.1-beta.0",
|
|
185
80
|
"packages": {
|
|
186
|
-
"
|
|
187
|
-
"version": "~
|
|
81
|
+
"@swc/cli": {
|
|
82
|
+
"version": "~0.6.0",
|
|
188
83
|
"alwaysAddToPackageJson": false
|
|
189
84
|
}
|
|
190
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-31313-387cdca",
|
|
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": {
|
|
@@ -39,32 +39,31 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "0.0.0-pr-
|
|
43
|
-
"@nx/workspace": "0.0.0-pr-
|
|
42
|
+
"@nx/devkit": "0.0.0-pr-31313-387cdca",
|
|
43
|
+
"@nx/workspace": "0.0.0-pr-31313-387cdca",
|
|
44
|
+
"@zkochan/js-yaml": "0.0.7",
|
|
44
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
45
|
-
"babel-plugin-macros": "^
|
|
46
|
+
"babel-plugin-macros": "^3.1.0",
|
|
46
47
|
"babel-plugin-transform-typescript-metadata": "^0.3.1",
|
|
47
48
|
"chalk": "^4.1.0",
|
|
48
49
|
"columnify": "^1.6.0",
|
|
49
50
|
"detect-port": "^1.5.1",
|
|
50
51
|
"enquirer": "~2.3.6",
|
|
51
|
-
"fast-glob": "3.2.7",
|
|
52
52
|
"ignore": "^5.0.4",
|
|
53
53
|
"js-tokens": "^4.0.0",
|
|
54
54
|
"jsonc-parser": "3.2.0",
|
|
55
|
-
"minimatch": "9.0.3",
|
|
56
55
|
"npm-package-arg": "11.0.1",
|
|
57
56
|
"npm-run-path": "^4.0.1",
|
|
58
57
|
"ora": "5.3.0",
|
|
58
|
+
"picocolors": "^1.1.0",
|
|
59
|
+
"picomatch": "4.0.2",
|
|
59
60
|
"semver": "^7.5.3",
|
|
60
61
|
"source-map-support": "0.5.19",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"tslib": "^2.3.0",
|
|
64
|
-
"@nrwl/js": "0.0.0-pr-31222-862e973"
|
|
62
|
+
"tinyglobby": "^0.2.12",
|
|
63
|
+
"tslib": "^2.3.0"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
|
-
"verdaccio": "^
|
|
66
|
+
"verdaccio": "^6.0.5"
|
|
68
67
|
},
|
|
69
68
|
"peerDependenciesMeta": {
|
|
70
69
|
"verdaccio": {
|
|
@@ -74,6 +73,6 @@
|
|
|
74
73
|
"publishConfig": {
|
|
75
74
|
"access": "public"
|
|
76
75
|
},
|
|
77
|
-
"
|
|
78
|
-
"
|
|
76
|
+
"types": "./src/index.d.ts",
|
|
77
|
+
"type": "commonjs"
|
|
79
78
|
}
|
|
@@ -20,7 +20,7 @@ async function killTree(pid, signal) {
|
|
|
20
20
|
switch (process.platform) {
|
|
21
21
|
case 'win32':
|
|
22
22
|
(0, child_process_1.exec)('taskkill /pid ' + pid + ' /T /F', {
|
|
23
|
-
windowsHide:
|
|
23
|
+
windowsHide: false,
|
|
24
24
|
}, (error) => {
|
|
25
25
|
// Ignore Fatal errors (128) because it might be due to the process already being killed.
|
|
26
26
|
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
|
|
@@ -30,7 +30,7 @@ async function killTree(pid, signal) {
|
|
|
30
30
|
case 'darwin':
|
|
31
31
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
32
32
|
return (0, child_process_1.spawn)('pgrep', ['-P', parentPid], {
|
|
33
|
-
windowsHide:
|
|
33
|
+
windowsHide: false,
|
|
34
34
|
});
|
|
35
35
|
}, function () {
|
|
36
36
|
killAll(tree, signal, callback);
|
|
@@ -39,7 +39,7 @@ async function killTree(pid, signal) {
|
|
|
39
39
|
default: // Linux
|
|
40
40
|
buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
|
|
41
41
|
return (0, child_process_1.spawn)('ps', ['-o', 'pid', '--no-headers', '--ppid', parentPid], {
|
|
42
|
-
windowsHide:
|
|
42
|
+
windowsHide: false,
|
|
43
43
|
});
|
|
44
44
|
}, function () {
|
|
45
45
|
killAll(tree, signal, callback);
|
|
@@ -3,5 +3,5 @@ import { NodeExecutorOptions } from './schema';
|
|
|
3
3
|
export declare function nodeExecutor(options: NodeExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
4
4
|
success: boolean;
|
|
5
5
|
options?: Record<string, any>;
|
|
6
|
-
}, void,
|
|
6
|
+
}, void, any>;
|
|
7
7
|
export default nodeExecutor;
|
|
@@ -16,9 +16,25 @@ const get_main_file_dir_1 = require("../../utils/get-main-file-dir");
|
|
|
16
16
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
17
17
|
function debounce(fn, wait) {
|
|
18
18
|
let timeoutId;
|
|
19
|
+
let pendingPromise = null;
|
|
19
20
|
return () => {
|
|
20
21
|
clearTimeout(timeoutId);
|
|
21
|
-
|
|
22
|
+
if (!pendingPromise) {
|
|
23
|
+
pendingPromise = new Promise((resolve, reject) => {
|
|
24
|
+
timeoutId = setTimeout(() => {
|
|
25
|
+
fn()
|
|
26
|
+
.then((result) => {
|
|
27
|
+
pendingPromise = null;
|
|
28
|
+
resolve(result);
|
|
29
|
+
})
|
|
30
|
+
.catch((error) => {
|
|
31
|
+
pendingPromise = null;
|
|
32
|
+
reject(error);
|
|
33
|
+
});
|
|
34
|
+
}, wait);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return pendingPromise;
|
|
22
38
|
};
|
|
23
39
|
}
|
|
24
40
|
async function* nodeExecutor(options, context) {
|
|
@@ -29,8 +45,7 @@ async function* nodeExecutor(options, context) {
|
|
|
29
45
|
throw new Error(`Cannot find build target ${chalk.bold(options.buildTarget)} for project ${chalk.bold(context.projectName)}`);
|
|
30
46
|
}
|
|
31
47
|
const buildTargetExecutor = project.data.targets[buildTarget.target]?.executor;
|
|
32
|
-
if (buildTargetExecutor === 'nx:run-commands'
|
|
33
|
-
buildTargetExecutor === '@nrwl/workspace:run-commands') {
|
|
48
|
+
if (buildTargetExecutor === 'nx:run-commands') {
|
|
34
49
|
// Run commands does not emit build event, so we have to switch to run entire build through Nx CLI.
|
|
35
50
|
options.runBuildTargetDependencies = true;
|
|
36
51
|
}
|
|
@@ -53,7 +68,7 @@ async function* nodeExecutor(options, context) {
|
|
|
53
68
|
let additionalExitHandler = null;
|
|
54
69
|
let currentTask = null;
|
|
55
70
|
const tasks = [];
|
|
56
|
-
yield* (0, async_iterable_1.createAsyncIterable)(async ({ done, next, error }) => {
|
|
71
|
+
yield* (0, async_iterable_1.createAsyncIterable)(async ({ done, next, error, registerCleanup }) => {
|
|
57
72
|
const processQueue = async () => {
|
|
58
73
|
if (tasks.length === 0)
|
|
59
74
|
return;
|
|
@@ -73,7 +88,7 @@ async function* nodeExecutor(options, context) {
|
|
|
73
88
|
start: async () => {
|
|
74
89
|
// Wait for build to finish.
|
|
75
90
|
const result = await buildResult;
|
|
76
|
-
if (!result.success) {
|
|
91
|
+
if (result && !result.success) {
|
|
77
92
|
// If in watch-mode, don't throw or else the process exits.
|
|
78
93
|
if (options.watch) {
|
|
79
94
|
if (!task.killed) {
|
|
@@ -164,6 +179,9 @@ async function* nodeExecutor(options, context) {
|
|
|
164
179
|
await stopAllTasks('SIGHUP');
|
|
165
180
|
process.exit(128 + 1);
|
|
166
181
|
});
|
|
182
|
+
registerCleanup(async () => {
|
|
183
|
+
await stopAllTasks('SIGTERM');
|
|
184
|
+
});
|
|
167
185
|
if (options.runBuildTargetDependencies) {
|
|
168
186
|
// If a all dependencies need to be rebuild on changes, then register with watcher
|
|
169
187
|
// and run through CLI, otherwise only the current project will rebuild.
|
|
@@ -280,7 +298,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
280
298
|
const outputFilePath = (0, utils_1.interpolate)(outputPath, {
|
|
281
299
|
projectName: project.name,
|
|
282
300
|
projectRoot: project.data.root,
|
|
283
|
-
workspaceRoot:
|
|
301
|
+
workspaceRoot: context.root,
|
|
284
302
|
});
|
|
285
303
|
return path.join(outputFilePath, 'main.js');
|
|
286
304
|
}
|
|
@@ -34,19 +34,37 @@ async function runExecutor(options, context) {
|
|
|
34
34
|
const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
|
|
35
35
|
const packageName = packageJson.name;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* Whether or not dynamically replacing local dependency protocols (such as "workspace:*") is supported during `nx release publish` is
|
|
38
|
+
* dependent on the package manager the user is using.
|
|
39
|
+
*
|
|
40
|
+
* npm does not support the workspace protocol at all, and `npm publish` does not support dynamically updating locally linked packages
|
|
41
|
+
* during its packing phase, so we give the user a clear error message informing them of that.
|
|
42
|
+
*
|
|
43
|
+
* - `pnpm publish` provides ideal support, it has the possibility of providing JSON output consistent with npm
|
|
44
|
+
* - `bun publish`, provides very good support, including all the flags we need apart from the JSON output, so we just have to accept that
|
|
45
|
+
* it will look and feel different and print what it gives us and perform one bit of string manipulation for the dry-run case.
|
|
46
|
+
* - `yarn npm publish`, IS NOT YET SUPPORTED, and will be tricky because it does not support the majority of the flags we need. However, it
|
|
47
|
+
* does support replacing local dependency protocols with the correct version during its packing phase.
|
|
39
48
|
*/
|
|
40
|
-
if (pm
|
|
49
|
+
if (pm === 'npm' || pm === 'yarn') {
|
|
41
50
|
const depTypes = ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
42
51
|
for (const depType of depTypes) {
|
|
43
52
|
const deps = packageJson[depType];
|
|
44
53
|
if (deps) {
|
|
45
54
|
for (const depName in deps) {
|
|
46
55
|
if ((0, is_locally_linked_package_version_1.isLocallyLinkedPackageVersion)(deps[depName])) {
|
|
47
|
-
|
|
56
|
+
if (pm === 'npm') {
|
|
57
|
+
console.error(`Error: Cannot publish package "${packageName}" because it contains a local dependency protocol in its "${depType}", and your package manager is npm.
|
|
58
|
+
|
|
59
|
+
Please update the local dependency on "${depName}" to be a valid semantic version (e.g. using \`nx release\`) before publishing, or switch to pnpm or bun as a package manager, which support dynamically replacing these protocols during publishing.`);
|
|
60
|
+
}
|
|
61
|
+
else if (pm === 'yarn') {
|
|
62
|
+
console.error(`Error: Cannot publish package "${packageName}" because it contains a local dependency protocol in its "${depType}", and your package manager is yarn.
|
|
63
|
+
|
|
64
|
+
Currently, yarn is not supported for this use case because its \`yarn npm publish\` command does not support the customization needed.
|
|
48
65
|
|
|
49
|
-
Please update the local dependency on "${depName}" to be a valid semantic version (e.g. using \`nx release\`) before publishing, or switch to pnpm as a package manager, which
|
|
66
|
+
Please update the local dependency on "${depName}" to be a valid semantic version (e.g. using \`nx release\`) before publishing, or switch to pnpm or bun as a package manager, which support dynamically replacing these protocols during publishing.`);
|
|
67
|
+
}
|
|
50
68
|
return {
|
|
51
69
|
success: false,
|
|
52
70
|
};
|
|
@@ -96,7 +114,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
96
114
|
env: processEnv(true),
|
|
97
115
|
cwd: context.root,
|
|
98
116
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
-
windowsHide:
|
|
117
|
+
windowsHide: false,
|
|
100
118
|
});
|
|
101
119
|
const resultJson = JSON.parse(result.toString());
|
|
102
120
|
const distTags = resultJson['dist-tags'] || {};
|
|
@@ -117,7 +135,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
117
135
|
env: processEnv(true),
|
|
118
136
|
cwd: context.root,
|
|
119
137
|
stdio: 'ignore',
|
|
120
|
-
windowsHide:
|
|
138
|
+
windowsHide: false,
|
|
121
139
|
});
|
|
122
140
|
console.log(`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`);
|
|
123
141
|
}
|
|
@@ -184,10 +202,13 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
184
202
|
* JSON output under the name of the package in that case (and it would need to be handled below).
|
|
185
203
|
*/
|
|
186
204
|
const publishCommandSegments = [
|
|
187
|
-
pm === '
|
|
188
|
-
? // Unlike npm,
|
|
189
|
-
`
|
|
190
|
-
:
|
|
205
|
+
pm === 'bun'
|
|
206
|
+
? // Unlike npm, bun publish does not support a custom registryConfigKey option
|
|
207
|
+
`bun publish --cwd="${packageRoot}" --json --registry="${registry}" --tag=${tag}`
|
|
208
|
+
: pm === 'pnpm'
|
|
209
|
+
? // Unlike npm, pnpm publish does not support a custom registryConfigKey option, and will error on uncommitted changes by default if --no-git-checks is not set
|
|
210
|
+
`pnpm publish "${packageRoot}" --json --registry="${registry}" --tag=${tag} --no-git-checks`
|
|
211
|
+
: `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
|
|
191
212
|
];
|
|
192
213
|
if (options.otp) {
|
|
193
214
|
publishCommandSegments.push(`--otp=${options.otp}`);
|
|
@@ -204,8 +225,25 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
204
225
|
env: processEnv(true),
|
|
205
226
|
cwd: context.root,
|
|
206
227
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
207
|
-
windowsHide:
|
|
228
|
+
windowsHide: false,
|
|
208
229
|
});
|
|
230
|
+
// If in dry-run mode, the version on disk will not represent the version that would be published, so we scrub it from the output to avoid confusion.
|
|
231
|
+
const dryRunVersionPlaceholder = 'X.X.X-dry-run';
|
|
232
|
+
const publishSummaryMessage = isDryRun
|
|
233
|
+
? `Would publish to ${registry} with tag "${tag}", but ${chalk.keyword('orange')('[dry-run]')} was set`
|
|
234
|
+
: `Published to ${registry} with tag "${tag}"`;
|
|
235
|
+
// bun publish does not support outputting JSON, so we need to modify and print the output string directly
|
|
236
|
+
if (pm === 'bun') {
|
|
237
|
+
let outputStr = output.toString();
|
|
238
|
+
if (isDryRun) {
|
|
239
|
+
outputStr = outputStr.replace(new RegExp(`${packageJson.name}@${packageJson.version}`, 'g'), `${packageJson.name}@${dryRunVersionPlaceholder}`);
|
|
240
|
+
}
|
|
241
|
+
console.log(outputStr);
|
|
242
|
+
console.log(publishSummaryMessage);
|
|
243
|
+
return {
|
|
244
|
+
success: true,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
209
247
|
/**
|
|
210
248
|
* We cannot JSON.parse the output directly because if the user is using lifecycle scripts, npm/pnpm will mix its publish output with the JSON output all on stdout.
|
|
211
249
|
* Additionally, we want to capture and show the lifecycle script outputs as beforeJsonData and afterJsonData and print them accordingly below.
|
|
@@ -217,8 +255,6 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
217
255
|
success: false,
|
|
218
256
|
};
|
|
219
257
|
}
|
|
220
|
-
// If in dry-run mode, the version on disk will not represent the version that would be published, so we scrub it from the output to avoid confusion.
|
|
221
|
-
const dryRunVersionPlaceholder = 'X.X.X-dry-run';
|
|
222
258
|
if (isDryRun) {
|
|
223
259
|
for (const [key, val] of Object.entries(jsonData)) {
|
|
224
260
|
if (typeof val !== 'string') {
|
|
@@ -235,18 +271,23 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
235
271
|
if (typeof afterJsonData === 'string' && afterJsonData.trim().length > 0) {
|
|
236
272
|
console.log(afterJsonData);
|
|
237
273
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
console.log(`Published to ${registry} with tag "${tag}"`);
|
|
243
|
-
}
|
|
274
|
+
// Print the summary message after the JSON data has been printed
|
|
275
|
+
console.log(publishSummaryMessage);
|
|
244
276
|
return {
|
|
245
277
|
success: true,
|
|
246
278
|
};
|
|
247
279
|
}
|
|
248
280
|
catch (err) {
|
|
249
281
|
try {
|
|
282
|
+
// bun publish does not support outputting JSON, so we cannot perform any further processing
|
|
283
|
+
if (pm === 'bun') {
|
|
284
|
+
console.error(`bun publish error:`);
|
|
285
|
+
console.error(err.stderr?.toString() || '');
|
|
286
|
+
console.error(err.stdout?.toString() || '');
|
|
287
|
+
return {
|
|
288
|
+
success: false,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
250
291
|
const stdoutData = JSON.parse(err.stdout?.toString() || '{}');
|
|
251
292
|
console.error(`${pm} publish error:`);
|
|
252
293
|
if (stdoutData.error?.summary) {
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
"description": "Generate a lockfile (e.g. package-lock.json) that matches the workspace lockfile to ensure package versions match.",
|
|
114
114
|
"default": false,
|
|
115
115
|
"x-priority": "internal"
|
|
116
|
+
},
|
|
117
|
+
"stripLeadingPaths": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"description": "Remove leading directory from output (e.g. src). See: https://swc.rs/docs/usage/cli#--strip-leading-paths",
|
|
120
|
+
"default": false
|
|
116
121
|
}
|
|
117
122
|
},
|
|
118
|
-
"stripLeadingPaths": {
|
|
119
|
-
"type": "boolean",
|
|
120
|
-
"description": "Remove leading directory from output (e.g. src). See: https://swc.rs/docs/usage/cli#--strip-leading-paths",
|
|
121
|
-
"default": false
|
|
122
|
-
},
|
|
123
123
|
"required": ["main", "outputPath", "tsConfig"],
|
|
124
124
|
"definitions": {
|
|
125
125
|
"assetPattern": {
|