pubz 0.2.3 → 0.2.5
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 +221 -57
- package/dist/cli.js +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,113 +6,277 @@ bunx pubz
|
|
|
6
6
|
|
|
7
7
|
`pubz` publishes multiple packages in one command, with some useful steps:
|
|
8
8
|
|
|
9
|
-
1.
|
|
10
|
-
2.
|
|
11
|
-
3. Prompts you to
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
1. Discovers all publishable packages (supports monorepos)
|
|
10
|
+
2. Sorts packages by dependency order
|
|
11
|
+
3. Prompts you to select which packages to publish
|
|
12
|
+
4. Prompts you to bump version number of packages
|
|
13
|
+
5. Updates inter-package dependency versions
|
|
14
|
+
6. Commits version changes
|
|
15
|
+
7. Prompts you for where you want to publish (e.g. `npm` or private registry)
|
|
16
|
+
8. Builds packages
|
|
17
|
+
9. Publishes to npm
|
|
18
|
+
10. Prompts you to create a `git tag` and push it
|
|
19
|
+
|
|
20
|
+
## Options
|
|
21
|
+
|
|
22
|
+
| Flag | Description |
|
|
23
|
+
| ---------------------- | ------------------------------------------------------------------------ |
|
|
24
|
+
| `--dry-run` | Show what would be published without actually publishing |
|
|
25
|
+
| `--registry <url>` | Specify npm registry URL (default: public npm) |
|
|
26
|
+
| `--otp <code>` | One-time password for 2FA |
|
|
27
|
+
| `--skip-build` | Skip the build step |
|
|
28
|
+
| `--yes`, `-y` | Skip yes/no confirmation prompts (still asks for choices) |
|
|
29
|
+
| `--ci` | CI mode: skip all prompts, auto-accept everything (requires `--version`) |
|
|
30
|
+
| `--version <value>` | Version bump type (`patch`, `minor`, `major`) or explicit version |
|
|
31
|
+
| `-h`, `--help` | Show help message |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Interactive publish
|
|
14
36
|
|
|
15
37
|
```bash
|
|
16
38
|
bunx pubz
|
|
17
39
|
```
|
|
18
40
|
|
|
41
|
+
### Preview changes (dry run)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bunx pubz --dry-run
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Quick publish with confirmations auto-accepted
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bunx pubz --yes
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Publish to GitHub Packages
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bunx pubz --registry https://npm.pkg.github.com
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### CI mode with version bump
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
bunx pubz --ci --version patch
|
|
63
|
+
bunx pubz --ci --version minor
|
|
64
|
+
bunx pubz --ci --version major
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### CI mode with explicit version
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bunx pubz --ci --version 1.2.3
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## GitHub Actions
|
|
74
|
+
|
|
75
|
+
Here's an example workflow for publishing with `pubz`, using an input selector for patch/minor/major version bump.
|
|
76
|
+
|
|
77
|
+
### Using NPM_TOKEN (classic)
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
name: Publish
|
|
81
|
+
|
|
82
|
+
on:
|
|
83
|
+
workflow_dispatch:
|
|
84
|
+
inputs:
|
|
85
|
+
version:
|
|
86
|
+
description: 'Version bump type or explicit version'
|
|
87
|
+
required: true
|
|
88
|
+
type: choice
|
|
89
|
+
options:
|
|
90
|
+
- patch
|
|
91
|
+
- minor
|
|
92
|
+
- major
|
|
93
|
+
|
|
94
|
+
jobs:
|
|
95
|
+
publish:
|
|
96
|
+
runs-on: ubuntu-latest
|
|
97
|
+
steps:
|
|
98
|
+
- uses: actions/checkout@v4
|
|
99
|
+
|
|
100
|
+
- uses: oven-sh/setup-bun@v2
|
|
101
|
+
|
|
102
|
+
- run: bun install
|
|
103
|
+
|
|
104
|
+
- name: Configure git
|
|
105
|
+
run: |
|
|
106
|
+
git config user.name "github-actions[bot]"
|
|
107
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
108
|
+
|
|
109
|
+
- name: Configure npm
|
|
110
|
+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
111
|
+
|
|
112
|
+
- name: Publish
|
|
113
|
+
run: bunx pubz --ci --version ${{ inputs.version }}
|
|
114
|
+
|
|
115
|
+
- name: Push changes
|
|
116
|
+
run: git push && git push --tags
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Using OIDC Trusted Publishing (recommended)
|
|
120
|
+
|
|
121
|
+
Trusted publishing uses OpenID Connect to authenticate with npm without storing long-lived tokens. First, configure your package on npmjs.com:
|
|
122
|
+
|
|
123
|
+
1. Go to your package → Settings → Trusted Publishers
|
|
124
|
+
2. Add your GitHub repository and workflow file name
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
name: Publish
|
|
128
|
+
|
|
129
|
+
on:
|
|
130
|
+
workflow_dispatch:
|
|
131
|
+
inputs:
|
|
132
|
+
version:
|
|
133
|
+
description: 'Version bump type or explicit version'
|
|
134
|
+
required: true
|
|
135
|
+
type: choice
|
|
136
|
+
options:
|
|
137
|
+
- patch
|
|
138
|
+
- minor
|
|
139
|
+
- major
|
|
140
|
+
|
|
141
|
+
jobs:
|
|
142
|
+
publish:
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
permissions:
|
|
145
|
+
contents: write
|
|
146
|
+
id-token: write
|
|
147
|
+
steps:
|
|
148
|
+
- uses: actions/checkout@v4
|
|
149
|
+
|
|
150
|
+
- uses: oven-sh/setup-bun@v2
|
|
151
|
+
|
|
152
|
+
- uses: actions/setup-node@v4
|
|
153
|
+
with:
|
|
154
|
+
registry-url: 'https://registry.npmjs.org'
|
|
155
|
+
|
|
156
|
+
- run: bun install
|
|
157
|
+
|
|
158
|
+
- name: Configure git
|
|
159
|
+
run: |
|
|
160
|
+
git config user.name "github-actions[bot]"
|
|
161
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
162
|
+
|
|
163
|
+
- name: Publish
|
|
164
|
+
run: bunx pubz --ci --version ${{ inputs.version }}
|
|
165
|
+
|
|
166
|
+
- name: Push changes
|
|
167
|
+
run: git push && git push --tags
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Example Output
|
|
171
|
+
|
|
19
172
|
```bash
|
|
173
|
+
bunx pubz
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```
|
|
20
177
|
pubz - npm package publisher
|
|
21
|
-
|
|
178
|
+
══════════════════════════════
|
|
22
179
|
|
|
23
180
|
Discovering packages...
|
|
24
181
|
|
|
25
182
|
Found 1 publishable package(s):
|
|
26
183
|
|
|
27
|
-
|
|
184
|
+
• pubz@0.2.2
|
|
28
185
|
|
|
29
186
|
Step 1: Version Management
|
|
30
|
-
|
|
187
|
+
──────────────────────────────
|
|
188
|
+
|
|
189
|
+
Current version: 0.2.2
|
|
190
|
+
|
|
191
|
+
? Bump version before publishing? [Y/n]
|
|
192
|
+
? Select version bump type:
|
|
31
193
|
|
|
32
|
-
|
|
194
|
+
> 1) patch (0.2.2 -> 0.2.3)
|
|
195
|
+
2) minor (0.2.2 -> 0.3.0)
|
|
196
|
+
3) major (0.2.2 -> 1.0.0)
|
|
197
|
+
|
|
198
|
+
Enter choice [1-3] (default: 1): 1
|
|
199
|
+
|
|
200
|
+
Updating version to 0.2.3 in all packages...
|
|
201
|
+
|
|
202
|
+
Updated pubz: 0.2.2 -> 0.2.3
|
|
203
|
+
M package.json
|
|
204
|
+
Committing version bump...
|
|
205
|
+
[main 945e1a3] chore: release v0.2.3
|
|
206
|
+
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
207
|
+
Changes committed
|
|
33
208
|
|
|
34
|
-
|
|
35
|
-
Select publish target:
|
|
209
|
+
? Select publish target:
|
|
36
210
|
|
|
37
211
|
> 1) Public npm registry (https://registry.npmjs.org)
|
|
38
212
|
2) GitHub Packages (https://npm.pkg.github.com)
|
|
39
213
|
|
|
40
|
-
Enter choice [1-2] (default: 1):
|
|
214
|
+
Enter choice [1-2] (default: 1):
|
|
41
215
|
|
|
42
216
|
Publishing to: https://registry.npmjs.org
|
|
43
217
|
|
|
44
218
|
Step 2: Building Packages
|
|
45
|
-
|
|
219
|
+
──────────────────────────────
|
|
46
220
|
|
|
47
221
|
Running build...
|
|
48
222
|
|
|
49
223
|
$ bun build src/cli.ts --outdir dist --target node
|
|
50
|
-
Bundled
|
|
224
|
+
Bundled 7 modules in 7ms
|
|
225
|
+
|
|
226
|
+
cli.js 28.65 KB (entry point)
|
|
51
227
|
|
|
52
|
-
cli.js 20.0 KB (entry point)
|
|
53
228
|
|
|
54
229
|
Build completed successfully
|
|
55
230
|
|
|
56
231
|
Verifying builds...
|
|
57
232
|
|
|
58
|
-
pubz build verified
|
|
233
|
+
✓ pubz build verified
|
|
59
234
|
|
|
60
235
|
Step 3: Publishing to npm
|
|
61
|
-
|
|
236
|
+
──────────────────────────────
|
|
62
237
|
|
|
63
238
|
About to publish the following packages:
|
|
64
239
|
|
|
65
|
-
pubz@0.
|
|
240
|
+
• pubz@0.2.3
|
|
66
241
|
|
|
67
242
|
Registry: https://registry.npmjs.org
|
|
68
243
|
|
|
69
|
-
Continue? [
|
|
244
|
+
? Continue? [Y/n]
|
|
70
245
|
|
|
71
246
|
Publishing packages...
|
|
72
247
|
|
|
73
|
-
Publishing pubz@0.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
248
|
+
Publishing pubz@0.2.3...
|
|
249
|
+
npm notice
|
|
250
|
+
npm notice 📦 pubz@0.2.3
|
|
251
|
+
npm notice Tarball Contents
|
|
252
|
+
npm notice 717B package.json
|
|
253
|
+
npm notice 2.3kB README.md
|
|
254
|
+
npm notice 28.7kB dist/cli.js
|
|
255
|
+
npm notice Tarball Details
|
|
256
|
+
npm notice name: pubz
|
|
257
|
+
npm notice version: 0.2.3
|
|
258
|
+
npm notice filename: pubz-0.2.3.tgz
|
|
259
|
+
npm notice package size: 8.3 kB
|
|
260
|
+
npm notice unpacked size: 31.6 kB
|
|
261
|
+
npm notice shasum: b8cd25d62b05d5cd6a4ecc8ff6ef6e522e7b2aa5
|
|
262
|
+
npm notice integrity: sha512-jihTMvUxMeXNX[...]2+gtHJexETkWA==
|
|
263
|
+
npm notice total files: 3
|
|
264
|
+
npm notice
|
|
265
|
+
+ pubz@0.2.3
|
|
90
266
|
pubz published successfully
|
|
91
267
|
|
|
92
|
-
|
|
268
|
+
══════════════════════════════
|
|
93
269
|
Publishing complete!
|
|
94
270
|
|
|
95
|
-
Published version: 0.
|
|
96
|
-
|
|
97
|
-
Create a git tag for v0.1.0? [y/N] y
|
|
271
|
+
Published version: 0.2.3
|
|
98
272
|
|
|
99
|
-
|
|
100
|
-
M README.md
|
|
101
|
-
M package.json
|
|
102
|
-
M src/cli.ts
|
|
103
|
-
M src/publish.ts
|
|
104
|
-
M src/types.ts
|
|
105
|
-
Uncommitted changes detected. Committing...
|
|
106
|
-
error: pathspec 'release' did not match any file(s) known to git
|
|
107
|
-
error: pathspec 'v0.1.0' did not match any file(s) known to git
|
|
108
|
-
Changes committed
|
|
109
|
-
Tag v0.1.0 created
|
|
110
|
-
Push tag to origin? [y/N] y
|
|
111
|
-
fatal: 'origin' does not appear to be a git repository
|
|
112
|
-
fatal: Could not read from remote repository.
|
|
273
|
+
? Create a git tag for v0.2.3? [Y/n]
|
|
113
274
|
|
|
114
|
-
|
|
115
|
-
|
|
275
|
+
Tag v0.2.3 created
|
|
276
|
+
? Push tag to origin? [Y/n]
|
|
277
|
+
To github.com:mm-zacharydavison/pubz.git
|
|
278
|
+
* [new tag] v0.2.3 -> v0.2.3
|
|
279
|
+
Tag v0.2.3 pushed to origin
|
|
116
280
|
|
|
117
281
|
Done!
|
|
118
|
-
```
|
|
282
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
+
// src/cli.ts
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join as join4 } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
5
10
|
// src/colors.ts
|
|
6
11
|
var isColorSupported = process.env.FORCE_COLOR !== "0" && (process.env.FORCE_COLOR !== undefined || process.stdout.isTTY && process.env.TERM !== "dumb");
|
|
7
12
|
var fmt = (open, close) => {
|
|
@@ -386,7 +391,7 @@ async function publishPackage(pkg, registry, otp, dryRun) {
|
|
|
386
391
|
if (otp) {
|
|
387
392
|
args.push("--otp", otp);
|
|
388
393
|
}
|
|
389
|
-
const result = await run("
|
|
394
|
+
const result = await run("npm", args, pkg.path);
|
|
390
395
|
if (result.code !== 0) {
|
|
391
396
|
return { success: false, error: `Failed to publish ${pkg.name}` };
|
|
392
397
|
}
|
|
@@ -528,11 +533,20 @@ var REGISTRIES = {
|
|
|
528
533
|
npm: "https://registry.npmjs.org",
|
|
529
534
|
github: "https://npm.pkg.github.com"
|
|
530
535
|
};
|
|
536
|
+
function getVersion() {
|
|
537
|
+
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
538
|
+
const pkgPath = join4(__dirname2, "..", "package.json");
|
|
539
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
540
|
+
return pkg.version;
|
|
541
|
+
}
|
|
531
542
|
function printUsage() {
|
|
532
543
|
console.log(`
|
|
533
544
|
pubz - Interactive npm package publisher
|
|
534
545
|
|
|
535
|
-
Usage: pubz [options]
|
|
546
|
+
Usage: pubz [command] [options]
|
|
547
|
+
|
|
548
|
+
Commands:
|
|
549
|
+
version Show version number
|
|
536
550
|
|
|
537
551
|
Options:
|
|
538
552
|
--dry-run Show what would be published without actually publishing
|
|
@@ -597,6 +611,10 @@ function parseArgs(args) {
|
|
|
597
611
|
return options;
|
|
598
612
|
}
|
|
599
613
|
async function main() {
|
|
614
|
+
if (process.argv[2] === "version") {
|
|
615
|
+
console.log(getVersion());
|
|
616
|
+
process.exit(0);
|
|
617
|
+
}
|
|
600
618
|
const options = parseArgs(process.argv.slice(2));
|
|
601
619
|
if (options.help) {
|
|
602
620
|
printUsage();
|