@virmator/publish 14.27.4 → 14.28.1
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/README.md +3 -1
- package/dist/publish.d.ts +2 -2
- package/dist/publish.js +27 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@ A default plugin for [virmator](https://www.npmjs.com/package/virmator).
|
|
|
6
6
|
|
|
7
7
|
- **publish**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Stage a package or mono-repo for publishing to NPM (via npm's staged publishing) with an optional test script and auto-incrementing package version.
|
|
10
|
+
|
|
11
|
+
Staged versions are not live on NPM until they are approved on the npm website or via 'npm stage approve' (both require 2FA). Requires npm >= 11.15.0.
|
|
10
12
|
|
|
11
13
|
- Examples
|
|
12
14
|
- With tests: `virmator publish npm test`
|
package/dist/publish.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const virmatorPublishPlugin: Readonly<Readonly<{
|
|
|
6
6
|
cliCommands: NoInfer<{
|
|
7
7
|
readonly publish: {
|
|
8
8
|
readonly doc: {
|
|
9
|
-
readonly sections: readonly ["\n
|
|
9
|
+
readonly sections: readonly ["\n Stage a package or mono-repo for publishing to NPM (via npm's staged publishing) with an optional test script and auto-incrementing package version.\n ", "\n Staged versions are not live on NPM until they are approved on the npm website or via 'npm stage approve' (both require 2FA). Requires npm >= 11.15.0.\n "];
|
|
10
10
|
readonly examples: readonly [{
|
|
11
11
|
readonly title: "With tests";
|
|
12
12
|
readonly content: "virmator publish npm test";
|
|
@@ -22,7 +22,7 @@ export declare const virmatorPublishPlugin: Readonly<Readonly<{
|
|
|
22
22
|
executor: import("@virmator/core").VirmatorPluginExecutor<NoInfer<{
|
|
23
23
|
readonly publish: {
|
|
24
24
|
readonly doc: {
|
|
25
|
-
readonly sections: readonly ["\n
|
|
25
|
+
readonly sections: readonly ["\n Stage a package or mono-repo for publishing to NPM (via npm's staged publishing) with an optional test script and auto-incrementing package version.\n ", "\n Staged versions are not live on NPM until they are approved on the npm website or via 'npm stage approve' (both require 2FA). Requires npm >= 11.15.0.\n "];
|
|
26
26
|
readonly examples: readonly [{
|
|
27
27
|
readonly title: "With tests";
|
|
28
28
|
readonly content: "virmator publish npm test";
|
package/dist/publish.js
CHANGED
|
@@ -9,7 +9,16 @@ import { join, relative, resolve } from 'node:path';
|
|
|
9
9
|
import semver from 'semver';
|
|
10
10
|
import { simpleGit } from 'simple-git';
|
|
11
11
|
import { isValidSpdxExpression } from 'spdx-vir';
|
|
12
|
+
import { buildUrl } from 'url-vir';
|
|
12
13
|
const inVirmatorEnvKey = 'IN_VIRMATOR';
|
|
14
|
+
/**
|
|
15
|
+
* When true, publish through npm's staged publishing (`npm stage publish`), which requires later
|
|
16
|
+
* approval before packages go live. When false, publish directly (`npm publish`).
|
|
17
|
+
*
|
|
18
|
+
* Ideally, this would always use staged publishing. However, npm's current approval process for
|
|
19
|
+
* staged publishes is terrible. If they fix that, then we can flip this back to `true`.
|
|
20
|
+
*/
|
|
21
|
+
const useStagedPublishing = false;
|
|
13
22
|
/** A virmator plugin for publishing a package to npm. */
|
|
14
23
|
export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
15
24
|
name: 'Publish',
|
|
@@ -18,7 +27,10 @@ export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
18
27
|
doc: {
|
|
19
28
|
sections: [
|
|
20
29
|
`
|
|
21
|
-
|
|
30
|
+
Stage a package or mono-repo for publishing to NPM (via npm's staged publishing) with an optional test script and auto-incrementing package version.
|
|
31
|
+
`,
|
|
32
|
+
`
|
|
33
|
+
Staged versions are not live on NPM until they are approved on the npm website or via 'npm stage approve' (both require 2FA). Requires npm >= 11.15.0.
|
|
22
34
|
`,
|
|
23
35
|
],
|
|
24
36
|
examples: [
|
|
@@ -123,6 +135,7 @@ export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
123
135
|
const publishCommand = [
|
|
124
136
|
`${inVirmatorEnvKey}=true`,
|
|
125
137
|
'npm',
|
|
138
|
+
useStagedPublishing && 'stage',
|
|
126
139
|
'publish',
|
|
127
140
|
...publishArgs,
|
|
128
141
|
]
|
|
@@ -192,6 +205,19 @@ export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
192
205
|
}));
|
|
193
206
|
if (!isDryRun) {
|
|
194
207
|
await updateGit(monoRepoRootPath);
|
|
208
|
+
if (useStagedPublishing) {
|
|
209
|
+
const npmUsername = (await runHiddenShellCommand('npm whoami')).stdout.trim();
|
|
210
|
+
log.info([
|
|
211
|
+
'Staged packages must be approved before they go live. Approve them here:',
|
|
212
|
+
buildUrl('https://www.npmjs.com', {
|
|
213
|
+
paths: [
|
|
214
|
+
'settings',
|
|
215
|
+
npmUsername,
|
|
216
|
+
'staged-packages',
|
|
217
|
+
],
|
|
218
|
+
}).href,
|
|
219
|
+
].join(' '));
|
|
220
|
+
}
|
|
195
221
|
}
|
|
196
222
|
return;
|
|
197
223
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/publish",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.28.1",
|
|
4
4
|
"description": "Default publish plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"test:update": "npm test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@augment-vir/assert": "^32.
|
|
38
|
-
"@augment-vir/common": "^32.
|
|
39
|
-
"@augment-vir/node": "^32.
|
|
40
|
-
"@virmator/core": "^14.
|
|
37
|
+
"@augment-vir/assert": "^32.1.0",
|
|
38
|
+
"@augment-vir/common": "^32.1.0",
|
|
39
|
+
"@augment-vir/node": "^32.1.0",
|
|
40
|
+
"@virmator/core": "^14.28.1",
|
|
41
41
|
"mri": "^1.2.0",
|
|
42
42
|
"semver": "^7.8.5",
|
|
43
43
|
"simple-git": "^3.36.0",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"url-vir": "^2.1.9"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@augment-vir/test": "^32.
|
|
49
|
-
"@types/node": "^26.
|
|
48
|
+
"@augment-vir/test": "^32.1.0",
|
|
49
|
+
"@types/node": "^26.1.1",
|
|
50
50
|
"@types/semver": "^7.7.1",
|
|
51
51
|
"markdown-code-example-inserter": "^3.0.6",
|
|
52
|
-
"type-fest": "^5.
|
|
53
|
-
"typedoc": "^0.28.
|
|
52
|
+
"type-fest": "^5.8.0",
|
|
53
|
+
"typedoc": "^0.28.20"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=22"
|