@virmator/publish 14.28.0 → 14.29.0
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/dist/publish.js +26 -14
- package/package.json +4 -4
package/dist/publish.js
CHANGED
|
@@ -11,6 +11,14 @@ import { simpleGit } from 'simple-git';
|
|
|
11
11
|
import { isValidSpdxExpression } from 'spdx-vir';
|
|
12
12
|
import { buildUrl } from 'url-vir';
|
|
13
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;
|
|
14
22
|
/** A virmator plugin for publishing a package to npm. */
|
|
15
23
|
export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
16
24
|
name: 'Publish',
|
|
@@ -127,7 +135,7 @@ export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
127
135
|
const publishCommand = [
|
|
128
136
|
`${inVirmatorEnvKey}=true`,
|
|
129
137
|
'npm',
|
|
130
|
-
'stage',
|
|
138
|
+
useStagedPublishing && 'stage',
|
|
131
139
|
'publish',
|
|
132
140
|
...publishArgs,
|
|
133
141
|
]
|
|
@@ -197,17 +205,19 @@ export const virmatorPublishPlugin = defineVirmatorPlugin(import.meta.dirname, {
|
|
|
197
205
|
}));
|
|
198
206
|
if (!isDryRun) {
|
|
199
207
|
await updateGit(monoRepoRootPath);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
+
}
|
|
211
221
|
}
|
|
212
222
|
return;
|
|
213
223
|
}
|
|
@@ -298,10 +308,12 @@ export function parseCommitChangeMarker(commitMessage) {
|
|
|
298
308
|
if (!rawChangeMarker) {
|
|
299
309
|
return undefined;
|
|
300
310
|
}
|
|
301
|
-
else if (
|
|
311
|
+
else if (allowedVersionTags.includes(rawChangeMarker)) {
|
|
312
|
+
return check.isEnumValue(rawChangeMarker, ChangeMarker) ? rawChangeMarker : undefined;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
302
315
|
throw new VirmatorNoTraceError(`${rawChangeMarker} version tag not allowed`);
|
|
303
316
|
}
|
|
304
|
-
return check.isEnumValue(rawChangeMarker, ChangeMarker) ? rawChangeMarker : undefined;
|
|
305
317
|
}
|
|
306
318
|
async function getGitCommitVersion(decrement, git) {
|
|
307
319
|
const output = await git.raw(`show HEAD~${decrement} --pretty='%d${gitCommitFormatDelimiter}%s' -s`.split(' '));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virmator/publish",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.29.0",
|
|
4
4
|
"description": "Default publish plugin for virmator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"virmator",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"@augment-vir/assert": "^32.1.0",
|
|
38
38
|
"@augment-vir/common": "^32.1.0",
|
|
39
39
|
"@augment-vir/node": "^32.1.0",
|
|
40
|
-
"@virmator/core": "^14.
|
|
40
|
+
"@virmator/core": "^14.29.0",
|
|
41
41
|
"mri": "^1.2.0",
|
|
42
42
|
"semver": "^7.8.5",
|
|
43
43
|
"simple-git": "^3.36.0",
|
|
44
|
-
"spdx-vir": "^0.0.
|
|
45
|
-
"url-vir": "^2.1.
|
|
44
|
+
"spdx-vir": "^0.0.2",
|
|
45
|
+
"url-vir": "^2.1.10"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@augment-vir/test": "^32.1.0",
|