pubz 0.1.0 → 0.2.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/README.md +102 -0
- package/dist/cli.js +60 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,4 +14,106 @@ bunx pubz
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
bunx pubz
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pubz - npm package publisher
|
|
21
|
+
=============================
|
|
22
|
+
|
|
23
|
+
Discovering packages...
|
|
24
|
+
|
|
25
|
+
Found 1 publishable package(s):
|
|
26
|
+
|
|
27
|
+
- pubz@0.1.0
|
|
28
|
+
|
|
29
|
+
Step 1: Version Management
|
|
30
|
+
--------------------------
|
|
31
|
+
|
|
32
|
+
Current version: 0.1.0
|
|
33
|
+
|
|
34
|
+
Bump version before publishing? [y/N] n
|
|
35
|
+
Select publish target:
|
|
36
|
+
|
|
37
|
+
> 1) Public npm registry (https://registry.npmjs.org)
|
|
38
|
+
2) GitHub Packages (https://npm.pkg.github.com)
|
|
39
|
+
|
|
40
|
+
Enter choice [1-2] (default: 1): 1
|
|
41
|
+
|
|
42
|
+
Publishing to: https://registry.npmjs.org
|
|
43
|
+
|
|
44
|
+
Step 2: Building Packages
|
|
45
|
+
-------------------------
|
|
46
|
+
|
|
47
|
+
Running build...
|
|
48
|
+
|
|
49
|
+
$ bun build src/cli.ts --outdir dist --target node
|
|
50
|
+
Bundled 6 modules in 4ms
|
|
51
|
+
|
|
52
|
+
cli.js 20.0 KB (entry point)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Build completed successfully
|
|
56
|
+
|
|
57
|
+
Verifying builds...
|
|
58
|
+
|
|
59
|
+
pubz build verified
|
|
60
|
+
|
|
61
|
+
Step 3: Publishing to npm
|
|
62
|
+
-------------------------
|
|
63
|
+
|
|
64
|
+
About to publish the following packages:
|
|
65
|
+
|
|
66
|
+
pubz@0.1.0
|
|
67
|
+
|
|
68
|
+
Registry: https://registry.npmjs.org
|
|
69
|
+
|
|
70
|
+
Continue? [y/N] y
|
|
71
|
+
|
|
72
|
+
Publishing packages...
|
|
73
|
+
|
|
74
|
+
Publishing pubz@0.1.0...
|
|
75
|
+
bun publish v1.3.2 (b131639c)
|
|
76
|
+
|
|
77
|
+
packed 0.70KB package.json
|
|
78
|
+
packed 322B README.md
|
|
79
|
+
packed 20.0KB dist/cli.js
|
|
80
|
+
|
|
81
|
+
Total files: 3
|
|
82
|
+
Shasum: 0494617a65c8a92d8a2c43d115dea0f94919102f
|
|
83
|
+
Integrity: sha512-KLEM/H7EOadzz[...]c1up2JcHW9gcQ==
|
|
84
|
+
Unpacked size: 21.1KB
|
|
85
|
+
Packed size: 5.73KB
|
|
86
|
+
Tag: latest
|
|
87
|
+
Access: public
|
|
88
|
+
Registry: https://registry.npmjs.org
|
|
89
|
+
|
|
90
|
+
+ pubz@0.1.0
|
|
91
|
+
pubz published successfully
|
|
92
|
+
|
|
93
|
+
==================================
|
|
94
|
+
Publishing complete!
|
|
95
|
+
|
|
96
|
+
Published version: 0.1.0
|
|
97
|
+
|
|
98
|
+
Create a git tag for v0.1.0? [y/N] y
|
|
99
|
+
|
|
100
|
+
A .npmrc
|
|
101
|
+
M README.md
|
|
102
|
+
M package.json
|
|
103
|
+
M src/cli.ts
|
|
104
|
+
M src/publish.ts
|
|
105
|
+
M src/types.ts
|
|
106
|
+
Uncommitted changes detected. Committing...
|
|
107
|
+
error: pathspec 'release' did not match any file(s) known to git
|
|
108
|
+
error: pathspec 'v0.1.0' did not match any file(s) known to git
|
|
109
|
+
Changes committed
|
|
110
|
+
Tag v0.1.0 created
|
|
111
|
+
Push tag to origin? [y/N] y
|
|
112
|
+
fatal: 'origin' does not appear to be a git repository
|
|
113
|
+
fatal: Could not read from remote repository.
|
|
114
|
+
|
|
115
|
+
Please make sure you have the correct access rights
|
|
116
|
+
and the repository exists.
|
|
117
|
+
|
|
118
|
+
Done!
|
|
17
119
|
```
|
package/dist/cli.js
CHANGED
|
@@ -191,6 +191,53 @@ async function select(message, options, defaultIndex = 0) {
|
|
|
191
191
|
console.log(`Invalid choice. Using default: ${options[defaultIndex].label}`);
|
|
192
192
|
return options[defaultIndex].value;
|
|
193
193
|
}
|
|
194
|
+
async function multiSelect(message, options, allSelectedByDefault = true) {
|
|
195
|
+
const selected = new Set(allSelectedByDefault ? options.map((_, i) => i) : []);
|
|
196
|
+
const printOptions = () => {
|
|
197
|
+
console.log(message);
|
|
198
|
+
console.log("");
|
|
199
|
+
for (let i = 0;i < options.length; i++) {
|
|
200
|
+
const checkbox = selected.has(i) ? "[x]" : "[ ]";
|
|
201
|
+
console.log(` ${checkbox} ${i + 1}) ${options[i].label}`);
|
|
202
|
+
}
|
|
203
|
+
console.log("");
|
|
204
|
+
console.log('Enter number to toggle, "a" to select all, "n" to select none, or press Enter to confirm:');
|
|
205
|
+
};
|
|
206
|
+
printOptions();
|
|
207
|
+
while (true) {
|
|
208
|
+
const answer = await prompt("> ");
|
|
209
|
+
if (answer === "") {
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
if (answer.toLowerCase() === "a") {
|
|
213
|
+
for (let i = 0;i < options.length; i++) {
|
|
214
|
+
selected.add(i);
|
|
215
|
+
}
|
|
216
|
+
console.log("");
|
|
217
|
+
printOptions();
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (answer.toLowerCase() === "n") {
|
|
221
|
+
selected.clear();
|
|
222
|
+
console.log("");
|
|
223
|
+
printOptions();
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const index = Number.parseInt(answer, 10) - 1;
|
|
227
|
+
if (index >= 0 && index < options.length) {
|
|
228
|
+
if (selected.has(index)) {
|
|
229
|
+
selected.delete(index);
|
|
230
|
+
} else {
|
|
231
|
+
selected.add(index);
|
|
232
|
+
}
|
|
233
|
+
console.log("");
|
|
234
|
+
printOptions();
|
|
235
|
+
} else {
|
|
236
|
+
console.log("Invalid input. Try again.");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return options.filter((_, i) => selected.has(i)).map((o) => o.value);
|
|
240
|
+
}
|
|
194
241
|
|
|
195
242
|
// src/publish.ts
|
|
196
243
|
import { spawn } from "node:child_process";
|
|
@@ -484,6 +531,19 @@ async function main() {
|
|
|
484
531
|
console.log(` - ${pkg.name}@${pkg.version}${deps}`);
|
|
485
532
|
}
|
|
486
533
|
console.log("");
|
|
534
|
+
if (packages.length > 1 && !options.skipPrompts) {
|
|
535
|
+
const selectedPackages = await multiSelect("Select packages to publish:", packages.map((pkg) => ({
|
|
536
|
+
label: `${pkg.name}@${pkg.version}`,
|
|
537
|
+
value: pkg
|
|
538
|
+
})));
|
|
539
|
+
if (selectedPackages.length === 0) {
|
|
540
|
+
console.log("No packages selected. Exiting.");
|
|
541
|
+
closePrompt();
|
|
542
|
+
process.exit(0);
|
|
543
|
+
}
|
|
544
|
+
packages = sortByDependencyOrder(selectedPackages);
|
|
545
|
+
console.log("");
|
|
546
|
+
}
|
|
487
547
|
const currentVersion = packages[0].version;
|
|
488
548
|
console.log("Step 1: Version Management");
|
|
489
549
|
console.log("--------------------------");
|