trustci 0.3.1 → 0.4.1
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 +5 -1
- package/dist/cli.js +37 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ it has no effect when `--pipeline-definition-id` is given explicitly.
|
|
|
98
98
|
|
|
99
99
|
| Flag | Description |
|
|
100
100
|
| ------------------------ | --------------------------------------------------- |
|
|
101
|
-
| `--dry-run` | Print the `npm trust` commands without executing.
|
|
101
|
+
| `--dry-run` | Print the `npm trust` commands without executing, then the `trustci` command for the real run (the flags you passed, without `--dry-run`, plus `-y`). |
|
|
102
102
|
| `--only <name-glob>` | Only include packages matching (repeatable). |
|
|
103
103
|
| `--exclude <name-glob>` | Exclude packages matching (repeatable). |
|
|
104
104
|
| `-y`, `--yes` | Skip the confirmation prompt (and npm's). |
|
|
@@ -140,6 +140,10 @@ bun run typecheck
|
|
|
140
140
|
bun run build # -> dist/cli.js (npx entry point), via `bun build --target node`
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
+
Optionally, `nix develop` (flakes enabled) opens a shell with the pinned Bun and
|
|
144
|
+
Node 24 (bundling npm 11, which `trustci` requires) from `flake.lock`. Bun's version
|
|
145
|
+
is also declared in `package.json` `packageManager`.
|
|
146
|
+
|
|
143
147
|
The documentation site lives in `docs/` ([Astro Starlight](https://starlight.astro.build/)):
|
|
144
148
|
|
|
145
149
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -521,6 +521,28 @@ function shellQuote(s) {
|
|
|
521
521
|
function displayCommand(args) {
|
|
522
522
|
return ["npm", ...args].map(shellQuote).join(" ");
|
|
523
523
|
}
|
|
524
|
+
function realRunCommand(argv, yes) {
|
|
525
|
+
const out = [];
|
|
526
|
+
let tokenOmitted = false;
|
|
527
|
+
for (let i = 0;i < argv.length; i++) {
|
|
528
|
+
const a = argv[i];
|
|
529
|
+
if (a === "--dry-run")
|
|
530
|
+
continue;
|
|
531
|
+
if (a === "--circle-token") {
|
|
532
|
+
tokenOmitted = true;
|
|
533
|
+
i++;
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
if (a.startsWith("--circle-token=")) {
|
|
537
|
+
tokenOmitted = true;
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
out.push(a);
|
|
541
|
+
}
|
|
542
|
+
if (!yes)
|
|
543
|
+
out.push("-y");
|
|
544
|
+
return { command: ["npx", "trustci", ...out].map(shellQuote).join(" "), tokenOmitted };
|
|
545
|
+
}
|
|
524
546
|
|
|
525
547
|
// src/workspace.ts
|
|
526
548
|
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
@@ -753,7 +775,7 @@ function filterPackages(all, only, exclude) {
|
|
|
753
775
|
});
|
|
754
776
|
}
|
|
755
777
|
// package.json
|
|
756
|
-
var version = "0.
|
|
778
|
+
var version = "0.4.1";
|
|
757
779
|
|
|
758
780
|
// src/cli.ts
|
|
759
781
|
var VERSION = version;
|
|
@@ -789,7 +811,9 @@ Permissions (at least one required):
|
|
|
789
811
|
--allow-stage-publish allow npm stage publish
|
|
790
812
|
|
|
791
813
|
Options:
|
|
792
|
-
--dry-run print the npm commands without executing them
|
|
814
|
+
--dry-run print the npm commands without executing them, then the
|
|
815
|
+
trustci command for the real run (trust only; your
|
|
816
|
+
flags, -y added)
|
|
793
817
|
--only <name-glob> only include packages matching (repeatable)
|
|
794
818
|
--exclude <name-glob> exclude packages matching (repeatable)
|
|
795
819
|
globs match the whole name; * also matches "/"
|
|
@@ -851,7 +875,7 @@ $ ${displayCommand(args)}`);
|
|
|
851
875
|
}
|
|
852
876
|
return failures > 0 ? 1 : 0;
|
|
853
877
|
}
|
|
854
|
-
async function runTrust(parsed) {
|
|
878
|
+
async function runTrust(parsed, argv) {
|
|
855
879
|
const root = process2.cwd();
|
|
856
880
|
const { all, source } = discoverPackages(root);
|
|
857
881
|
if (all.length === 0) {
|
|
@@ -877,6 +901,13 @@ async function runTrust(parsed) {
|
|
|
877
901
|
}
|
|
878
902
|
console.error(`
|
|
879
903
|
(dry run — registry publish-state was not checked and nothing was executed)`);
|
|
904
|
+
const real = realRunCommand(argv, parsed.options.yes);
|
|
905
|
+
console.log(`
|
|
906
|
+
# To register, run (flags as given, without --dry-run):
|
|
907
|
+
${real.command}`);
|
|
908
|
+
if (real.tokenOmitted) {
|
|
909
|
+
console.error("note: --circle-token is left out of that command; pass it again or set CIRCLE_TOKEN.");
|
|
910
|
+
}
|
|
880
911
|
return 0;
|
|
881
912
|
}
|
|
882
913
|
const targets = [];
|
|
@@ -927,9 +958,10 @@ Done. ${targets.length - failures} succeeded, ${failures} failed.`);
|
|
|
927
958
|
return failures > 0 ? 1 : 0;
|
|
928
959
|
}
|
|
929
960
|
async function main() {
|
|
961
|
+
const argv = process2.argv.slice(2);
|
|
930
962
|
let parsed;
|
|
931
963
|
try {
|
|
932
|
-
parsed = parseCliArgs(
|
|
964
|
+
parsed = parseCliArgs(argv);
|
|
933
965
|
} catch (err) {
|
|
934
966
|
if (err instanceof ArgError) {
|
|
935
967
|
console.error(`error: ${err.message}
|
|
@@ -966,7 +998,7 @@ async function main() {
|
|
|
966
998
|
console.error(`error: ${err.message}`);
|
|
967
999
|
return 1;
|
|
968
1000
|
}
|
|
969
|
-
return runTrust(parsed);
|
|
1001
|
+
return runTrust(parsed, argv);
|
|
970
1002
|
}
|
|
971
1003
|
main().then((code) => {
|
|
972
1004
|
process2.exitCode = code;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trustci",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Bulk-register npm Trusted Publishers (npm trust) across all public packages in a monorepo. Supports GitHub, GitLab and CircleCI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"test": "bun test",
|
|
19
19
|
"typecheck": "tsc --noEmit",
|
|
20
20
|
"prepublishOnly": "bun run build",
|
|
21
|
-
"prepare": "husky"
|
|
21
|
+
"prepare": "node .husky/install.mjs"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"npm",
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
"url": "https://github.com/hideokamoto/trustci/issues"
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
|
+
"packageManager": "bun@1.4.2",
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@commitlint/cli": "^21.2.3",
|
|
50
51
|
"@commitlint/config-conventional": "^21.2.3",
|
|
51
|
-
"@types/bun": "
|
|
52
|
+
"@types/bun": "1.4.2",
|
|
52
53
|
"husky": "^9.1.7",
|
|
53
54
|
"typescript": "^5"
|
|
54
55
|
}
|