pubm 0.0.2-1 → 0.0.2-12
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/bin/cli.js +42 -6
- package/dist/index.cjs +14 -3
- package/dist/index.js +14 -3
- package/package.json +3 -2
package/bin/cli.js
CHANGED
|
@@ -5364,7 +5364,13 @@ var NpmRegistry = class extends Registry {
|
|
|
5364
5364
|
}
|
|
5365
5365
|
async publishProvenance() {
|
|
5366
5366
|
try {
|
|
5367
|
-
|
|
5367
|
+
try {
|
|
5368
|
+
await this.npm(["publish", "--provenance", "--access", "public"]);
|
|
5369
|
+
} catch (error) {
|
|
5370
|
+
if (`${error}`.includes("EOTP")) {
|
|
5371
|
+
return false;
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5368
5374
|
return true;
|
|
5369
5375
|
} catch (error) {
|
|
5370
5376
|
throw new NpmError(
|
|
@@ -5381,7 +5387,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5381
5387
|
try {
|
|
5382
5388
|
await this.npm(args);
|
|
5383
5389
|
} catch (error) {
|
|
5384
|
-
if (`${error}`.includes("
|
|
5390
|
+
if (`${error}`.includes("EOTP")) {
|
|
5385
5391
|
return false;
|
|
5386
5392
|
}
|
|
5387
5393
|
}
|
|
@@ -5630,7 +5636,12 @@ var npmPublishTasks = {
|
|
|
5630
5636
|
"NODE_AUTH_TOKEN not found in the environment variables. Please set the token and try again."
|
|
5631
5637
|
);
|
|
5632
5638
|
}
|
|
5633
|
-
await npm.publishProvenance();
|
|
5639
|
+
const result = await npm.publishProvenance();
|
|
5640
|
+
if (!result) {
|
|
5641
|
+
throw new NpmAvailableError(
|
|
5642
|
+
`In CI environment, publishing with 2FA is not allowed. Please disable 2FA when accessing with a token from ${link2("npm", `https://www.npmjs.com/package/${npm.packageName}/access`)}.`
|
|
5643
|
+
);
|
|
5644
|
+
}
|
|
5634
5645
|
}
|
|
5635
5646
|
}
|
|
5636
5647
|
};
|
|
@@ -6268,7 +6279,8 @@ Update available! \`${name}\` ${color.red(currentVersion)} \u2192 ${color.green(
|
|
|
6268
6279
|
}
|
|
6269
6280
|
|
|
6270
6281
|
// src/cli.ts
|
|
6271
|
-
|
|
6282
|
+
import { isCI as isCI3 } from "std-env";
|
|
6283
|
+
var { RELEASE_TYPES: RELEASE_TYPES2, valid } = semver2;
|
|
6272
6284
|
var options = [
|
|
6273
6285
|
{
|
|
6274
6286
|
rawName: "--test-script <script>",
|
|
@@ -6369,13 +6381,37 @@ function resolveCliOptions(options2) {
|
|
|
6369
6381
|
}
|
|
6370
6382
|
cli.command("[version]").action(async (nextVersion, options2) => {
|
|
6371
6383
|
console.clear();
|
|
6372
|
-
|
|
6384
|
+
if (!isCI3) {
|
|
6385
|
+
await notifyNewVersion();
|
|
6386
|
+
}
|
|
6373
6387
|
const context = {
|
|
6374
6388
|
version: nextVersion,
|
|
6375
6389
|
tag: options2.tag
|
|
6376
6390
|
};
|
|
6377
6391
|
try {
|
|
6378
|
-
|
|
6392
|
+
if (isCI3) {
|
|
6393
|
+
if (options2.publishOnly) {
|
|
6394
|
+
const git = new Git();
|
|
6395
|
+
const latestVersion = (await git.latestTag())?.slice(1);
|
|
6396
|
+
if (!latestVersion) {
|
|
6397
|
+
throw new Error(
|
|
6398
|
+
"Cannot find the latest tag. Please ensure tags exist in the repository."
|
|
6399
|
+
);
|
|
6400
|
+
}
|
|
6401
|
+
if (!valid(latestVersion)) {
|
|
6402
|
+
throw new Error(
|
|
6403
|
+
"Cannot parse the latest tag to a valid SemVer version. Please check the tag format."
|
|
6404
|
+
);
|
|
6405
|
+
}
|
|
6406
|
+
context.version = latestVersion;
|
|
6407
|
+
} else {
|
|
6408
|
+
throw new Error(
|
|
6409
|
+
"Version must be set in the CI environment. Please define the version before proceeding."
|
|
6410
|
+
);
|
|
6411
|
+
}
|
|
6412
|
+
} else {
|
|
6413
|
+
await requiredMissingInformationTasks().run(context);
|
|
6414
|
+
}
|
|
6379
6415
|
await pubm(
|
|
6380
6416
|
resolveCliOptions({
|
|
6381
6417
|
...options2,
|
package/dist/index.cjs
CHANGED
|
@@ -5371,7 +5371,13 @@ var NpmRegistry = class extends Registry {
|
|
|
5371
5371
|
}
|
|
5372
5372
|
async publishProvenance() {
|
|
5373
5373
|
try {
|
|
5374
|
-
|
|
5374
|
+
try {
|
|
5375
|
+
await this.npm(["publish", "--provenance", "--access", "public"]);
|
|
5376
|
+
} catch (error) {
|
|
5377
|
+
if (`${error}`.includes("EOTP")) {
|
|
5378
|
+
return false;
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5375
5381
|
return true;
|
|
5376
5382
|
} catch (error) {
|
|
5377
5383
|
throw new NpmError(
|
|
@@ -5388,7 +5394,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5388
5394
|
try {
|
|
5389
5395
|
await this.npm(args);
|
|
5390
5396
|
} catch (error) {
|
|
5391
|
-
if (`${error}`.includes("
|
|
5397
|
+
if (`${error}`.includes("EOTP")) {
|
|
5392
5398
|
return false;
|
|
5393
5399
|
}
|
|
5394
5400
|
}
|
|
@@ -5637,7 +5643,12 @@ var npmPublishTasks = {
|
|
|
5637
5643
|
"NODE_AUTH_TOKEN not found in the environment variables. Please set the token and try again."
|
|
5638
5644
|
);
|
|
5639
5645
|
}
|
|
5640
|
-
await npm.publishProvenance();
|
|
5646
|
+
const result = await npm.publishProvenance();
|
|
5647
|
+
if (!result) {
|
|
5648
|
+
throw new NpmAvailableError(
|
|
5649
|
+
`In CI environment, publishing with 2FA is not allowed. Please disable 2FA when accessing with a token from ${link2("npm", `https://www.npmjs.com/package/${npm.packageName}/access`)}.`
|
|
5650
|
+
);
|
|
5651
|
+
}
|
|
5641
5652
|
}
|
|
5642
5653
|
}
|
|
5643
5654
|
};
|
package/dist/index.js
CHANGED
|
@@ -5360,7 +5360,13 @@ var NpmRegistry = class extends Registry {
|
|
|
5360
5360
|
}
|
|
5361
5361
|
async publishProvenance() {
|
|
5362
5362
|
try {
|
|
5363
|
-
|
|
5363
|
+
try {
|
|
5364
|
+
await this.npm(["publish", "--provenance", "--access", "public"]);
|
|
5365
|
+
} catch (error) {
|
|
5366
|
+
if (`${error}`.includes("EOTP")) {
|
|
5367
|
+
return false;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5364
5370
|
return true;
|
|
5365
5371
|
} catch (error) {
|
|
5366
5372
|
throw new NpmError(
|
|
@@ -5377,7 +5383,7 @@ var NpmRegistry = class extends Registry {
|
|
|
5377
5383
|
try {
|
|
5378
5384
|
await this.npm(args);
|
|
5379
5385
|
} catch (error) {
|
|
5380
|
-
if (`${error}`.includes("
|
|
5386
|
+
if (`${error}`.includes("EOTP")) {
|
|
5381
5387
|
return false;
|
|
5382
5388
|
}
|
|
5383
5389
|
}
|
|
@@ -5626,7 +5632,12 @@ var npmPublishTasks = {
|
|
|
5626
5632
|
"NODE_AUTH_TOKEN not found in the environment variables. Please set the token and try again."
|
|
5627
5633
|
);
|
|
5628
5634
|
}
|
|
5629
|
-
await npm.publishProvenance();
|
|
5635
|
+
const result = await npm.publishProvenance();
|
|
5636
|
+
if (!result) {
|
|
5637
|
+
throw new NpmAvailableError(
|
|
5638
|
+
`In CI environment, publishing with 2FA is not allowed. Please disable 2FA when accessing with a token from ${link2("npm", `https://www.npmjs.com/package/${npm.packageName}/access`)}.`
|
|
5639
|
+
);
|
|
5640
|
+
}
|
|
5630
5641
|
}
|
|
5631
5642
|
}
|
|
5632
5643
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubm",
|
|
3
|
-
"version": "0.0.2-
|
|
3
|
+
"version": "0.0.2-12",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18",
|
|
6
6
|
"git": ">=2.11.0"
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"@types/npmcli__promise-spawn": "^6.0.3",
|
|
51
51
|
"@types/semver": "^7.5.8",
|
|
52
52
|
"@vitest/coverage-v8": "^2.1.1",
|
|
53
|
-
"
|
|
53
|
+
"jsr": "^0.13.2",
|
|
54
|
+
"pubm": "^0.0.2-9",
|
|
54
55
|
"tsup": "^8.3.0",
|
|
55
56
|
"typescript": "^5.6.2",
|
|
56
57
|
"vitest": "^2.1.1"
|