pubm 0.0.0-alpha.14 → 0.0.0-alpha.16
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 +88 -35
- package/bin/cli.js +16 -14
- package/dist/index.cjs +10 -13
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -13
- package/package.json +1 -1
- package/bin/.pubm/NjcyMGM5OTA3Yzk3MWMyZjEwYTYxOTQwMGZmOWM0ZTA= +0 -1
package/README.md
CHANGED
|
@@ -10,24 +10,65 @@ pubm
|
|
|
10
10
|
publish manager for multiple registry (jsr, npm and private registries)
|
|
11
11
|
<p>
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Features
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- Publish package to npm and jsr at once
|
|
16
|
+
- Customize (Soon)
|
|
16
17
|
- GitHub release draft format
|
|
17
|
-
- Adjust tasks (Add, Remove, Sorting)
|
|
18
|
+
- Adjust tasks (Add, Remove, Sorting tasks)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node.js 18 or later
|
|
23
|
+
- npm 9 or later
|
|
24
|
+
- Git 2.11 or later
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i -g pubm
|
|
30
|
+
```
|
|
20
31
|
|
|
21
32
|
## Usage
|
|
22
33
|
|
|
23
34
|
```bash
|
|
24
|
-
|
|
35
|
+
Usage:
|
|
36
|
+
$ pubm [version]
|
|
37
|
+
|
|
38
|
+
Version can be:
|
|
39
|
+
major | premajor | minor | preminor | patch | prepatch | prerelease | 1.2.3
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
--test-script <script> The npm script to run tests before publishing (default: test)
|
|
43
|
+
--build-script <script> The npm script to run build before publishing (default: build)
|
|
44
|
+
-p, --preview Show tasks without actually executing publish
|
|
45
|
+
-b, --branch <name> Name of the release branch (default: main)
|
|
46
|
+
-a, --any-branch Show tasks without actually executing publish
|
|
47
|
+
--no-pre-check Skip prerequisites check task (default: true)
|
|
48
|
+
--no-condition-check Skip required conditions check task (default: true)
|
|
49
|
+
--no-cleanup Skip cleaning the `node_modules` directory (default: true)
|
|
50
|
+
--no-tests Skip running tests before publishing (default: true)
|
|
51
|
+
--no-build Skip build before publishing (default: true)
|
|
52
|
+
--no-publish Skip publishing task (default: true)
|
|
53
|
+
--no-release-draft Skip creating a GitHub release draft (default: true)
|
|
54
|
+
-y, --yolo Skip both cleanup and tests
|
|
55
|
+
-t, --tag <name> Publish under a specific dist-tag (default: latest)
|
|
56
|
+
--package-manager <name> Use a specific package manager 'packageManager' field in package.json or package manager configuration file
|
|
57
|
+
-c, --contents <path> Subdirectory to publish
|
|
58
|
+
-h, --help Display this message
|
|
59
|
+
-v, --version Display version number
|
|
60
|
+
--registry <...registries> Target registries for publish
|
|
61
|
+
registry can be npm | jsr | https://url.for.private-registries (default: npm,jsr)
|
|
25
62
|
```
|
|
26
63
|
|
|
27
|
-
## Config
|
|
64
|
+
## Config for publish
|
|
28
65
|
|
|
29
66
|
You can have either package.json or jsr.json.
|
|
30
67
|
|
|
68
|
+
### Configuration file (Soon)
|
|
69
|
+
|
|
70
|
+
`pubm.js` or `pubm.mjs`
|
|
71
|
+
|
|
31
72
|
|
|
32
73
|
## Tasks
|
|
33
74
|
|
|
@@ -36,35 +77,35 @@ You can have either package.json or jsr.json.
|
|
|
36
77
|
pubm tasks
|
|
37
78
|
</summary>
|
|
38
79
|
|
|
39
|
-
- Notify new version
|
|
40
|
-
- Checking required information
|
|
41
|
-
- Select SemVer increment or specify new version
|
|
42
|
-
- Select the tag for this pre-release version in npm: (if version is prerelease)
|
|
43
|
-
- checking for the existence of either package.json or jsr.json
|
|
44
|
-
- Prerequisite checks = skip-pre (for deployment reliability)
|
|
45
|
-
- Checking if remote history is clean...
|
|
46
|
-
- Checking if the local working tree is clean...
|
|
47
|
-
- Checking if commits exist since the last release...
|
|
48
|
-
- Verifying current branch is a release branch...
|
|
49
|
-
- Checking git tag existence...
|
|
50
|
-
- Required conditions checks (concurrently) = skip-required (for pubm tasks)
|
|
51
|
-
- Verifying if npm CLI and jsr CLI are installed...
|
|
52
|
-
- Ping registries...
|
|
53
|
-
- Checking if test and build scripts exist...
|
|
54
|
-
- Checking git version...
|
|
55
|
-
- Checking available registries for publishing...
|
|
56
|
-
- in jsr permission check token exist and ask token
|
|
57
|
-
- if first time -> Checking package name availability...
|
|
58
|
-
- if scoped package and scope reserved contact message
|
|
59
|
-
- Running tests...
|
|
60
|
-
- Building the project...
|
|
61
|
-
- Bumping version...
|
|
62
|
-
- Publishing... (concurrently)
|
|
63
|
-
- npm
|
|
64
|
-
- Running npm publish...
|
|
65
|
-
- Verifying two-factor authentication...
|
|
66
|
-
- jsr
|
|
67
|
-
- Running jsr publish...
|
|
80
|
+
- Notify new version
|
|
81
|
+
- Checking required information
|
|
82
|
+
- Select SemVer increment or specify new version
|
|
83
|
+
- Select the tag for this pre-release version in npm: (if version is prerelease)
|
|
84
|
+
- checking for the existence of either package.json or jsr.json
|
|
85
|
+
- Prerequisite checks = skip-pre (for deployment reliability)
|
|
86
|
+
- Checking if remote history is clean...
|
|
87
|
+
- Checking if the local working tree is clean...
|
|
88
|
+
- Checking if commits exist since the last release...
|
|
89
|
+
- Verifying current branch is a release branch...
|
|
90
|
+
- Checking git tag existence...
|
|
91
|
+
- Required conditions checks (concurrently) = skip-required (for pubm tasks)
|
|
92
|
+
- Verifying if npm CLI and jsr CLI are installed...
|
|
93
|
+
- Ping registries...
|
|
94
|
+
- Checking if test and build scripts exist...
|
|
95
|
+
- Checking git version...
|
|
96
|
+
- Checking available registries for publishing...
|
|
97
|
+
- in jsr permission check token exist and ask token
|
|
98
|
+
- if first time -> Checking package name availability...
|
|
99
|
+
- if scoped package and scope reserved contact message
|
|
100
|
+
- Running tests...
|
|
101
|
+
- Building the project...
|
|
102
|
+
- Bumping version...
|
|
103
|
+
- Publishing... (concurrently)
|
|
104
|
+
- npm
|
|
105
|
+
- Running npm publish...
|
|
106
|
+
- Verifying two-factor authentication...
|
|
107
|
+
- jsr
|
|
108
|
+
- Running jsr publish...
|
|
68
109
|
- Pushing tags to GitHub...
|
|
69
110
|
- Creating release draft on GitHub...
|
|
70
111
|
</details>
|
|
@@ -103,3 +144,15 @@ np tasks
|
|
|
103
144
|
- Push tags
|
|
104
145
|
- Release draft
|
|
105
146
|
</details>
|
|
147
|
+
|
|
148
|
+
## FAQ
|
|
149
|
+
|
|
150
|
+
### Why is jsr only asking for tokens?
|
|
151
|
+
|
|
152
|
+
The only way to access the certified environment for jsr is to request api directly with token.
|
|
153
|
+
|
|
154
|
+
### How is jsr token saved? Is it safe?
|
|
155
|
+
|
|
156
|
+
jsr token is encrypted and stored through various pieces of information, and unless you have complete control of the local computer that ran pubm, I think it is difficult for token to be taken over.
|
|
157
|
+
|
|
158
|
+
If desired, the --no-save-token option allows you to run tokens without saving them.
|
package/bin/cli.js
CHANGED
|
@@ -718,7 +718,7 @@ var JsrRegisry = class extends Registry {
|
|
|
718
718
|
try {
|
|
719
719
|
await exec2(
|
|
720
720
|
"jsr",
|
|
721
|
-
["publish", "--allow-dirty", "--token", `${
|
|
721
|
+
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
722
722
|
{
|
|
723
723
|
throwOnError: true
|
|
724
724
|
}
|
|
@@ -754,14 +754,9 @@ var JsrRegisry = class extends Registry {
|
|
|
754
754
|
return isValidPackageName(this.packageName);
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
|
-
var
|
|
758
|
-
constructor(apiEndpoint
|
|
757
|
+
var _JsrClient = class _JsrClient {
|
|
758
|
+
constructor(apiEndpoint) {
|
|
759
759
|
this.apiEndpoint = apiEndpoint;
|
|
760
|
-
this.token = token;
|
|
761
|
-
if (!this.token) {
|
|
762
|
-
const token2 = new Db().get("jsr-token");
|
|
763
|
-
if (token2) this.token = token2;
|
|
764
|
-
}
|
|
765
760
|
}
|
|
766
761
|
async fetch(endpoint, init) {
|
|
767
762
|
const pubmVersion = await version({ cwd: import.meta.dirname });
|
|
@@ -769,7 +764,7 @@ var JsrClient = class {
|
|
|
769
764
|
...init,
|
|
770
765
|
headers: {
|
|
771
766
|
...init?.headers,
|
|
772
|
-
Authorization: `Bearer ${
|
|
767
|
+
Authorization: `Bearer ${_JsrClient.token}`,
|
|
773
768
|
"User-Agent": `pubm/${pubmVersion}; https://github.com/syi0808/pubm`
|
|
774
769
|
}
|
|
775
770
|
});
|
|
@@ -904,6 +899,8 @@ var JsrClient = class {
|
|
|
904
899
|
}
|
|
905
900
|
}
|
|
906
901
|
};
|
|
902
|
+
__publicField(_JsrClient, "token", new Db().get("jsr-token"));
|
|
903
|
+
var JsrClient = _JsrClient;
|
|
907
904
|
async function jsrRegistry() {
|
|
908
905
|
const jsrJson = await getJsrJson();
|
|
909
906
|
return new JsrRegisry(jsrJson.name);
|
|
@@ -1063,14 +1060,14 @@ var jsrAvailableCheckTasks = {
|
|
|
1063
1060
|
await jsr.client.deleteScope(`${getScope(jsr.packageName)}`);
|
|
1064
1061
|
}
|
|
1065
1062
|
}, ctx);
|
|
1066
|
-
if (!
|
|
1063
|
+
if (!JsrClient.token) {
|
|
1067
1064
|
task.output = "Retrieving jsr API token";
|
|
1068
1065
|
while (true) {
|
|
1069
|
-
|
|
1066
|
+
JsrClient.token = await task.prompt(ListrEnquirerPromptAdapter).run({
|
|
1070
1067
|
type: "password",
|
|
1071
1068
|
message: `Please enter the jsr ${color3.bold("API token")}`,
|
|
1072
1069
|
footer: `
|
|
1073
|
-
Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/tokens/create"))}. ${color3.red("You should select")} ${color3.bold("'Interact with the JSR API'")}.`
|
|
1070
|
+
Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/tokens/create/"))}. ${color3.red("You should select")} ${color3.bold("'Interact with the JSR API'")}.`
|
|
1074
1071
|
});
|
|
1075
1072
|
try {
|
|
1076
1073
|
if (await jsr.client.user()) break;
|
|
@@ -1078,7 +1075,7 @@ Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/token
|
|
|
1078
1075
|
} catch {
|
|
1079
1076
|
}
|
|
1080
1077
|
}
|
|
1081
|
-
new Db().set("jsr-token",
|
|
1078
|
+
if (ctx.saveToken) new Db().set("jsr-token", JsrClient.token);
|
|
1082
1079
|
}
|
|
1083
1080
|
if (!isScopedPackage(jsr.packageName)) {
|
|
1084
1081
|
let jsrName = new Db().get(jsr.packageName);
|
|
@@ -1937,9 +1934,14 @@ var options = [
|
|
|
1937
1934
|
description: "Subdirectory to publish",
|
|
1938
1935
|
options: { type: String }
|
|
1939
1936
|
},
|
|
1937
|
+
{
|
|
1938
|
+
rawName: "--no-save-token",
|
|
1939
|
+
description: "Do not save jsr tokens (requested for every run)",
|
|
1940
|
+
options: { type: Boolean }
|
|
1941
|
+
},
|
|
1940
1942
|
{
|
|
1941
1943
|
rawName: "--registry <...registries>",
|
|
1942
|
-
description: "Target registries for publish\
|
|
1944
|
+
description: "Target registries for publish\n registry can be npm | jsr | https://url.for.private-registries\n",
|
|
1943
1945
|
options: { type: String, default: "npm,jsr" }
|
|
1944
1946
|
}
|
|
1945
1947
|
];
|
package/dist/index.cjs
CHANGED
|
@@ -748,7 +748,7 @@ var JsrRegisry = class extends Registry {
|
|
|
748
748
|
try {
|
|
749
749
|
await (0, import_tinyexec2.exec)(
|
|
750
750
|
"jsr",
|
|
751
|
-
["publish", "--allow-dirty", "--token", `${
|
|
751
|
+
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
752
752
|
{
|
|
753
753
|
throwOnError: true
|
|
754
754
|
}
|
|
@@ -784,14 +784,9 @@ var JsrRegisry = class extends Registry {
|
|
|
784
784
|
return isValidPackageName(this.packageName);
|
|
785
785
|
}
|
|
786
786
|
};
|
|
787
|
-
var
|
|
788
|
-
constructor(apiEndpoint
|
|
787
|
+
var _JsrClient = class _JsrClient {
|
|
788
|
+
constructor(apiEndpoint) {
|
|
789
789
|
this.apiEndpoint = apiEndpoint;
|
|
790
|
-
this.token = token;
|
|
791
|
-
if (!this.token) {
|
|
792
|
-
const token2 = new Db().get("jsr-token");
|
|
793
|
-
if (token2) this.token = token2;
|
|
794
|
-
}
|
|
795
790
|
}
|
|
796
791
|
async fetch(endpoint, init) {
|
|
797
792
|
const pubmVersion = await version({ cwd: import_meta2.dirname });
|
|
@@ -799,7 +794,7 @@ var JsrClient = class {
|
|
|
799
794
|
...init,
|
|
800
795
|
headers: {
|
|
801
796
|
...init?.headers,
|
|
802
|
-
Authorization: `Bearer ${
|
|
797
|
+
Authorization: `Bearer ${_JsrClient.token}`,
|
|
803
798
|
"User-Agent": `pubm/${pubmVersion}; https://github.com/syi0808/pubm`
|
|
804
799
|
}
|
|
805
800
|
});
|
|
@@ -934,6 +929,8 @@ var JsrClient = class {
|
|
|
934
929
|
}
|
|
935
930
|
}
|
|
936
931
|
};
|
|
932
|
+
__publicField(_JsrClient, "token", new Db().get("jsr-token"));
|
|
933
|
+
var JsrClient = _JsrClient;
|
|
937
934
|
async function jsrRegistry() {
|
|
938
935
|
const jsrJson = await getJsrJson();
|
|
939
936
|
return new JsrRegisry(jsrJson.name);
|
|
@@ -1093,14 +1090,14 @@ var jsrAvailableCheckTasks = {
|
|
|
1093
1090
|
await jsr.client.deleteScope(`${getScope(jsr.packageName)}`);
|
|
1094
1091
|
}
|
|
1095
1092
|
}, ctx);
|
|
1096
|
-
if (!
|
|
1093
|
+
if (!JsrClient.token) {
|
|
1097
1094
|
task.output = "Retrieving jsr API token";
|
|
1098
1095
|
while (true) {
|
|
1099
|
-
|
|
1096
|
+
JsrClient.token = await task.prompt(import_prompt_adapter_enquirer.ListrEnquirerPromptAdapter).run({
|
|
1100
1097
|
type: "password",
|
|
1101
1098
|
message: `Please enter the jsr ${import_listr24.color.bold("API token")}`,
|
|
1102
1099
|
footer: `
|
|
1103
|
-
Generate a token from ${import_listr24.color.bold(link("jsr.io", "https://jsr.io/account/tokens/create"))}. ${import_listr24.color.red("You should select")} ${import_listr24.color.bold("'Interact with the JSR API'")}.`
|
|
1100
|
+
Generate a token from ${import_listr24.color.bold(link("jsr.io", "https://jsr.io/account/tokens/create/"))}. ${import_listr24.color.red("You should select")} ${import_listr24.color.bold("'Interact with the JSR API'")}.`
|
|
1104
1101
|
});
|
|
1105
1102
|
try {
|
|
1106
1103
|
if (await jsr.client.user()) break;
|
|
@@ -1108,7 +1105,7 @@ Generate a token from ${import_listr24.color.bold(link("jsr.io", "https://jsr.io
|
|
|
1108
1105
|
} catch {
|
|
1109
1106
|
}
|
|
1110
1107
|
}
|
|
1111
|
-
new Db().set("jsr-token",
|
|
1108
|
+
if (ctx.saveToken) new Db().set("jsr-token", JsrClient.token);
|
|
1112
1109
|
}
|
|
1113
1110
|
if (!isScopedPackage(jsr.packageName)) {
|
|
1114
1111
|
let jsrName = new Db().get(jsr.packageName);
|
package/dist/index.d.cts
CHANGED
|
@@ -83,6 +83,11 @@ interface Options {
|
|
|
83
83
|
* @description Subdirectory to publish
|
|
84
84
|
*/
|
|
85
85
|
contents?: string;
|
|
86
|
+
/**
|
|
87
|
+
* @description Do not save jsr tokens (requested for every run)
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
saveToken?: boolean;
|
|
86
91
|
/**
|
|
87
92
|
* @description Target registries for publish
|
|
88
93
|
* @default ['npm', 'jsr']
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,11 @@ interface Options {
|
|
|
83
83
|
* @description Subdirectory to publish
|
|
84
84
|
*/
|
|
85
85
|
contents?: string;
|
|
86
|
+
/**
|
|
87
|
+
* @description Do not save jsr tokens (requested for every run)
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
saveToken?: boolean;
|
|
86
91
|
/**
|
|
87
92
|
* @description Target registries for publish
|
|
88
93
|
* @default ['npm', 'jsr']
|
package/dist/index.js
CHANGED
|
@@ -712,7 +712,7 @@ var JsrRegisry = class extends Registry {
|
|
|
712
712
|
try {
|
|
713
713
|
await exec2(
|
|
714
714
|
"jsr",
|
|
715
|
-
["publish", "--allow-dirty", "--token", `${
|
|
715
|
+
["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
|
|
716
716
|
{
|
|
717
717
|
throwOnError: true
|
|
718
718
|
}
|
|
@@ -748,14 +748,9 @@ var JsrRegisry = class extends Registry {
|
|
|
748
748
|
return isValidPackageName(this.packageName);
|
|
749
749
|
}
|
|
750
750
|
};
|
|
751
|
-
var
|
|
752
|
-
constructor(apiEndpoint
|
|
751
|
+
var _JsrClient = class _JsrClient {
|
|
752
|
+
constructor(apiEndpoint) {
|
|
753
753
|
this.apiEndpoint = apiEndpoint;
|
|
754
|
-
this.token = token;
|
|
755
|
-
if (!this.token) {
|
|
756
|
-
const token2 = new Db().get("jsr-token");
|
|
757
|
-
if (token2) this.token = token2;
|
|
758
|
-
}
|
|
759
754
|
}
|
|
760
755
|
async fetch(endpoint, init) {
|
|
761
756
|
const pubmVersion = await version({ cwd: import.meta.dirname });
|
|
@@ -763,7 +758,7 @@ var JsrClient = class {
|
|
|
763
758
|
...init,
|
|
764
759
|
headers: {
|
|
765
760
|
...init?.headers,
|
|
766
|
-
Authorization: `Bearer ${
|
|
761
|
+
Authorization: `Bearer ${_JsrClient.token}`,
|
|
767
762
|
"User-Agent": `pubm/${pubmVersion}; https://github.com/syi0808/pubm`
|
|
768
763
|
}
|
|
769
764
|
});
|
|
@@ -898,6 +893,8 @@ var JsrClient = class {
|
|
|
898
893
|
}
|
|
899
894
|
}
|
|
900
895
|
};
|
|
896
|
+
__publicField(_JsrClient, "token", new Db().get("jsr-token"));
|
|
897
|
+
var JsrClient = _JsrClient;
|
|
901
898
|
async function jsrRegistry() {
|
|
902
899
|
const jsrJson = await getJsrJson();
|
|
903
900
|
return new JsrRegisry(jsrJson.name);
|
|
@@ -1057,14 +1054,14 @@ var jsrAvailableCheckTasks = {
|
|
|
1057
1054
|
await jsr.client.deleteScope(`${getScope(jsr.packageName)}`);
|
|
1058
1055
|
}
|
|
1059
1056
|
}, ctx);
|
|
1060
|
-
if (!
|
|
1057
|
+
if (!JsrClient.token) {
|
|
1061
1058
|
task.output = "Retrieving jsr API token";
|
|
1062
1059
|
while (true) {
|
|
1063
|
-
|
|
1060
|
+
JsrClient.token = await task.prompt(ListrEnquirerPromptAdapter).run({
|
|
1064
1061
|
type: "password",
|
|
1065
1062
|
message: `Please enter the jsr ${color3.bold("API token")}`,
|
|
1066
1063
|
footer: `
|
|
1067
|
-
Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/tokens/create"))}. ${color3.red("You should select")} ${color3.bold("'Interact with the JSR API'")}.`
|
|
1064
|
+
Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/tokens/create/"))}. ${color3.red("You should select")} ${color3.bold("'Interact with the JSR API'")}.`
|
|
1068
1065
|
});
|
|
1069
1066
|
try {
|
|
1070
1067
|
if (await jsr.client.user()) break;
|
|
@@ -1072,7 +1069,7 @@ Generate a token from ${color3.bold(link("jsr.io", "https://jsr.io/account/token
|
|
|
1072
1069
|
} catch {
|
|
1073
1070
|
}
|
|
1074
1071
|
}
|
|
1075
|
-
new Db().set("jsr-token",
|
|
1072
|
+
if (ctx.saveToken) new Db().set("jsr-token", JsrClient.token);
|
|
1076
1073
|
}
|
|
1077
1074
|
if (!isScopedPackage(jsr.packageName)) {
|
|
1078
1075
|
let jsrName = new Db().get(jsr.packageName);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2c2abf8d3c256c379227aa11b4fd4fa9135c8a95045eea658710f7f8b9fb142ad31c524b5a440994494d785cd19991a9
|