pubm 0.2.12 → 0.3.3

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.
Files changed (95) hide show
  1. package/LICENSE +191 -21
  2. package/README.md +126 -63
  3. package/bin/cli.js +53 -8346
  4. package/dist/changeset/bump-utils.d.ts +3 -0
  5. package/dist/changeset/changelog.d.ts +11 -0
  6. package/dist/changeset/index.d.ts +8 -0
  7. package/dist/changeset/migrate.d.ts +7 -0
  8. package/dist/changeset/parser.d.ts +11 -0
  9. package/dist/changeset/reader.d.ts +2 -0
  10. package/dist/changeset/status.d.ts +12 -0
  11. package/dist/changeset/version.d.ts +7 -0
  12. package/dist/changeset/writer.d.ts +4 -0
  13. package/dist/commands/add.d.ts +2 -0
  14. package/dist/commands/changesets.d.ts +2 -0
  15. package/dist/commands/init.d.ts +2 -0
  16. package/dist/commands/migrate.d.ts +2 -0
  17. package/dist/commands/pre.d.ts +2 -0
  18. package/dist/commands/secrets.d.ts +2 -0
  19. package/dist/commands/snapshot.d.ts +2 -0
  20. package/dist/commands/status.d.ts +2 -0
  21. package/dist/commands/sync.d.ts +10 -0
  22. package/dist/commands/update.d.ts +2 -0
  23. package/dist/commands/version-cmd.d.ts +6 -0
  24. package/dist/config/defaults.d.ts +2 -0
  25. package/dist/config/index.d.ts +4 -0
  26. package/dist/config/loader.d.ts +2 -0
  27. package/dist/config/types.d.ts +47 -0
  28. package/dist/ecosystem/ecosystem.d.ts +12 -0
  29. package/dist/ecosystem/index.d.ts +6 -0
  30. package/dist/ecosystem/js.d.ts +13 -0
  31. package/dist/ecosystem/rust.d.ts +21 -0
  32. package/dist/error.d.ts +7 -0
  33. package/dist/git.d.ts +32 -0
  34. package/dist/index.cjs +24063 -4017
  35. package/dist/index.d.ts +20 -281
  36. package/dist/index.js +23976 -3934
  37. package/dist/monorepo/dependency-graph.d.ts +17 -0
  38. package/dist/monorepo/discover.d.ts +15 -0
  39. package/dist/monorepo/groups.d.ts +17 -0
  40. package/dist/monorepo/index.d.ts +4 -0
  41. package/dist/monorepo/workspace.d.ts +5 -0
  42. package/dist/options.d.ts +3 -0
  43. package/dist/plugin/index.d.ts +2 -0
  44. package/dist/plugin/runner.d.ts +14 -0
  45. package/dist/plugin/types.d.ts +47 -0
  46. package/dist/plugins/external-version-sync/index.d.ts +4 -0
  47. package/dist/plugins/external-version-sync/sync.d.ts +2 -0
  48. package/dist/plugins/external-version-sync/types.d.ts +14 -0
  49. package/dist/prerelease/index.d.ts +2 -0
  50. package/dist/prerelease/pre.d.ts +11 -0
  51. package/dist/prerelease/snapshot.d.ts +8 -0
  52. package/dist/registry/crates.d.ts +17 -0
  53. package/dist/registry/custom-registry.d.ts +5 -0
  54. package/dist/registry/index.d.ts +3 -0
  55. package/dist/registry/jsr.d.ts +36 -0
  56. package/dist/registry/npm.d.ts +25 -0
  57. package/dist/registry/registry.d.ts +20 -0
  58. package/dist/tasks/crates.d.ts +6 -0
  59. package/dist/tasks/custom-registry.d.ts +0 -0
  60. package/dist/tasks/dry-run-publish.d.ts +6 -0
  61. package/dist/tasks/github-release.d.ts +19 -0
  62. package/dist/tasks/jsr.d.ts +9 -0
  63. package/dist/tasks/npm.d.ts +4 -0
  64. package/dist/tasks/preflight.d.ts +3 -0
  65. package/dist/tasks/prerequisites-check.d.ts +3 -0
  66. package/dist/tasks/required-conditions-check.d.ts +3 -0
  67. package/dist/tasks/required-missing-information.d.ts +7 -0
  68. package/dist/tasks/runner.d.ts +10 -0
  69. package/dist/types/jsr-api.d.ts +91 -0
  70. package/dist/types/jsr-json.d.ts +10 -0
  71. package/dist/types/options.d.ts +115 -0
  72. package/dist/types/package-json.d.ts +84 -0
  73. package/dist/utils/cli.d.ts +2 -0
  74. package/dist/utils/crate-graph.d.ts +1 -0
  75. package/dist/utils/db.d.ts +6 -0
  76. package/dist/utils/engine-version.d.ts +2 -0
  77. package/dist/utils/exec.d.ts +23 -0
  78. package/dist/utils/listr.d.ts +2 -0
  79. package/dist/utils/notify-new-version.d.ts +1 -0
  80. package/dist/utils/open-url.d.ts +1 -0
  81. package/dist/utils/package-manager.d.ts +3 -0
  82. package/dist/utils/package-name.d.ts +4 -0
  83. package/dist/utils/package.d.ts +23 -0
  84. package/dist/utils/registries.d.ts +8 -0
  85. package/dist/utils/rollback.d.ts +6 -0
  86. package/dist/utils/runtime.d.ts +3 -0
  87. package/dist/utils/secure-store.d.ts +6 -0
  88. package/dist/utils/spawn-interactive.d.ts +10 -0
  89. package/dist/utils/token.d.ts +12 -0
  90. package/dist/validate/entry-points.d.ts +5 -0
  91. package/dist/validate/extraneous-files.d.ts +5 -0
  92. package/dist/validate/index.d.ts +2 -0
  93. package/package.json +30 -23
  94. package/postinstall.cjs +42 -0
  95. package/dist/index.d.cts +0 -291
@@ -0,0 +1,84 @@
1
+ interface Dependency {
2
+ [k: string]: string;
3
+ }
4
+ type Person = {
5
+ name: string;
6
+ url?: string;
7
+ email?: string;
8
+ } & Record<string, unknown>;
9
+ export type PackageExportsEntryObject = {
10
+ require?: PackageExportsEntry | PackageExportsFallback;
11
+ import?: PackageExportsEntry | PackageExportsFallback;
12
+ node?: PackageExportsEntry | PackageExportsFallback;
13
+ default?: PackageExportsEntry | PackageExportsFallback;
14
+ types?: PackageExportsEntry | PackageExportsFallback;
15
+ };
16
+ type PackageExportsEntry = PackageExportsEntryPath | PackageExportsEntryObject;
17
+ type PackageExportsEntryPath = string | null;
18
+ type PackageExportsFallback = PackageExportsEntry[];
19
+ export type Engine = "node" | "git" | "npm" | "pnpm" | "yarn";
20
+ export interface PackageJson {
21
+ name: string;
22
+ version: string;
23
+ description?: string;
24
+ keywords?: string[];
25
+ homepage?: string;
26
+ bugs?: {
27
+ url?: string;
28
+ email?: string;
29
+ [k: string]: unknown;
30
+ } | string;
31
+ license?: string;
32
+ author?: Person;
33
+ contributors?: Person[];
34
+ maintainers?: Person[];
35
+ files?: string[];
36
+ main?: string;
37
+ exports?: string | ({
38
+ "."?: PackageExportsEntry | PackageExportsFallback;
39
+ } & Record<string, PackageExportsEntry | PackageExportsFallback>);
40
+ bin?: string | {
41
+ [k: string]: string;
42
+ };
43
+ type?: "commonjs" | "module";
44
+ types?: string;
45
+ typings?: string;
46
+ typesVersions?: {
47
+ [k: string]: {
48
+ "*"?: string[];
49
+ };
50
+ };
51
+ repository?: {
52
+ type?: string;
53
+ url?: string;
54
+ directory?: string;
55
+ [k: string]: unknown;
56
+ } | string;
57
+ scripts?: Record<string, string>;
58
+ config?: {
59
+ [k: string]: unknown;
60
+ };
61
+ dependencies?: Dependency;
62
+ devDependencies?: Dependency;
63
+ optionalDependencies?: Dependency;
64
+ peerDependencies?: Dependency;
65
+ packageManager?: string;
66
+ engines?: Record<Engine, string>;
67
+ preferGlobal?: boolean;
68
+ private?: boolean | ("false" | "true");
69
+ publishConfig?: {
70
+ access?: "public" | "restricted";
71
+ tag?: string;
72
+ registry?: string;
73
+ [k: string]: unknown;
74
+ };
75
+ dist?: {
76
+ shasum?: string;
77
+ tarball?: string;
78
+ [k: string]: unknown;
79
+ };
80
+ readme?: string;
81
+ module?: string;
82
+ [k: string]: unknown;
83
+ }
84
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const warningBadge: string;
2
+ export declare function link(text: string, url: string): string;
@@ -0,0 +1 @@
1
+ export declare function sortCratesByDependencyOrder(cratePaths: string[]): Promise<string[]>;
@@ -0,0 +1,6 @@
1
+ export declare class Db {
2
+ path: string;
3
+ constructor();
4
+ set(field: string, value: unknown): void;
5
+ get(field: string): string | null;
6
+ }
@@ -0,0 +1,2 @@
1
+ import type { Engine } from "../types/package-json.js";
2
+ export declare function validateEngineVersion(engine: Engine, version: string): Promise<boolean>;
@@ -0,0 +1,23 @@
1
+ export declare class NonZeroExitError extends Error {
2
+ output: {
3
+ stdout: string;
4
+ stderr: string;
5
+ };
6
+ constructor(command: string, exitCode: number, output: {
7
+ stdout: string;
8
+ stderr: string;
9
+ });
10
+ }
11
+ export interface ExecOptions {
12
+ throwOnError?: boolean;
13
+ nodeOptions?: {
14
+ env?: Record<string, string | undefined>;
15
+ cwd?: string;
16
+ };
17
+ }
18
+ export interface ExecResult {
19
+ stdout: string;
20
+ stderr: string;
21
+ exitCode: number;
22
+ }
23
+ export declare function exec(command: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
@@ -0,0 +1,2 @@
1
+ import { Listr } from "listr2";
2
+ export declare function createListr<Context extends {}>(...args: ConstructorParameters<typeof Listr<Context>>): Listr<Context>;
@@ -0,0 +1 @@
1
+ export declare function notifyNewVersion(): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function openUrl(url: string): Promise<void>;
@@ -0,0 +1,3 @@
1
+ type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
2
+ export declare function getPackageManager(): Promise<PackageManager>;
3
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function isScopedPackage(packageName: string): boolean;
2
+ export declare function getScope(packageName: string): string | null;
3
+ export declare function getScopeAndName(packageName: string): [string, string];
4
+ export declare function isValidPackageName(packageName: string): boolean;
@@ -0,0 +1,23 @@
1
+ import type { PackageConfig } from "../config/types.js";
2
+ import type { JsrJson } from "../types/jsr-json.js";
3
+ import type { PackageJson } from "../types/package-json.js";
4
+ export declare function patchCachedJsrJson(contents: Partial<JsrJson>, { cwd }?: {
5
+ cwd?: string | undefined;
6
+ }): void;
7
+ export declare function findOutFile(file: string, { cwd }?: {
8
+ cwd?: string | undefined;
9
+ }): Promise<string | null>;
10
+ export declare function getPackageJson({ cwd, fallbackJsr, }?: {
11
+ cwd?: string | undefined;
12
+ fallbackJsr?: boolean | undefined;
13
+ }): Promise<PackageJson>;
14
+ export declare function getJsrJson({ cwd, fallbackPackage, }?: {
15
+ cwd?: string | undefined;
16
+ fallbackPackage?: boolean | undefined;
17
+ }): Promise<JsrJson>;
18
+ export declare function packageJsonToJsrJson(packageJson: PackageJson): Promise<JsrJson>;
19
+ export declare function jsrJsonToPackageJson(jsrJson: JsrJson): PackageJson;
20
+ export declare function version({ cwd }?: {
21
+ cwd?: string | undefined;
22
+ }): Promise<string>;
23
+ export declare function replaceVersion(version: string, packages?: PackageConfig[]): Promise<string[]>;
@@ -0,0 +1,8 @@
1
+ import type { PackageConfig } from "../config/types.js";
2
+ import type { RegistryType } from "../types/options.js";
3
+ interface RegistrySource {
4
+ packages?: PackageConfig[];
5
+ registries: RegistryType[];
6
+ }
7
+ export declare function collectRegistries(ctx: RegistrySource): RegistryType[];
8
+ export {};
@@ -0,0 +1,6 @@
1
+ type Rollback<Ctx extends {}> = (ctx: Ctx) => Promise<unknown>;
2
+ export declare function addRollback<Ctx extends {}>(rollback: Rollback<Ctx>, context: Ctx): void;
3
+ export declare function rollbackLog(message: string): void;
4
+ export declare function rollbackError(message: string): void;
5
+ export declare function rollback(): Promise<void>;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ export type Runtime = "node" | "bun";
2
+ export declare function detectRuntime(): Runtime;
3
+ export declare function isBun(): boolean;
@@ -0,0 +1,6 @@
1
+ export declare class SecureStore {
2
+ private db;
3
+ private getDb;
4
+ get(field: string): string | null;
5
+ set(field: string, value: unknown): void;
6
+ }
@@ -0,0 +1,10 @@
1
+ export interface InteractiveChild {
2
+ stdout: ReadableStream<Uint8Array>;
3
+ stderr: ReadableStream<Uint8Array>;
4
+ stdin: {
5
+ write(data: string | ArrayBufferView | ArrayBuffer): number;
6
+ flush(): number | Promise<number>;
7
+ };
8
+ exited: Promise<number>;
9
+ }
10
+ export declare function spawnInteractive(command: string[]): InteractiveChild;
@@ -0,0 +1,12 @@
1
+ export interface TokenEntry {
2
+ envVar: string;
3
+ dbKey: string;
4
+ ghSecretName: string;
5
+ promptLabel: string;
6
+ tokenUrl: string;
7
+ tokenUrlLabel: string;
8
+ }
9
+ export declare const TOKEN_CONFIG: Record<string, TokenEntry>;
10
+ export declare function loadTokens(registries: string[]): Record<string, string>;
11
+ export declare const loadTokensFromDb: typeof loadTokens;
12
+ export declare function injectTokensToEnv(tokens: Record<string, string>): () => void;
@@ -0,0 +1,5 @@
1
+ export interface EntryPointError {
2
+ field: string;
3
+ path: string;
4
+ }
5
+ export declare function validateEntryPoints(pkg: Record<string, unknown>, cwd: string): EntryPointError[];
@@ -0,0 +1,5 @@
1
+ export interface ExtraneousFile {
2
+ file: string;
3
+ reason: string;
4
+ }
5
+ export declare function detectExtraneousFiles(files: string[]): ExtraneousFile[];
@@ -0,0 +1,2 @@
1
+ export { type EntryPointError, validateEntryPoints, } from "./entry-points.js";
2
+ export { detectExtraneousFiles, type ExtraneousFile, } from "./extraneous-files.js";
package/package.json CHANGED
@@ -1,22 +1,26 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.2.12",
3
+ "version": "0.3.3",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"
7
7
  },
8
8
  "description": "publish manager for multiple registry (jsr, npm and private registries)",
9
9
  "type": "module",
10
+ "workspaces": [
11
+ "npm/@pubm/*"
12
+ ],
13
+ "bin": {
14
+ "pubm": "./bin/cli.js"
15
+ },
10
16
  "author": "Yein Sung <syi778800@gmail.com>",
11
17
  "types": "./dist/index.d.ts",
12
18
  "main": "./dist/index.cjs",
13
19
  "module": "./dist/index.js",
14
- "bin": {
15
- "pubm": "bin/cli.js"
16
- },
17
20
  "files": [
18
- "dist",
19
- "bin"
21
+ "bin/",
22
+ "dist/",
23
+ "postinstall.cjs"
20
24
  ],
21
25
  "exports": {
22
26
  ".": {
@@ -26,20 +30,22 @@
26
30
  }
27
31
  },
28
32
  "scripts": {
29
- "watch": "tsup --watch",
30
- "build": "tsup",
33
+ "build": "bun run build.ts",
34
+ "postinstall": "node ./postinstall.cjs",
31
35
  "check": "biome check",
32
- "format": "pnpm check --write",
36
+ "format": "bun check --write",
33
37
  "typecheck": "tsc --noEmit",
34
38
  "test": "vitest --run",
35
39
  "coverage": "vitest --run --coverage",
36
- "release": "pnpm build && node bin/cli.js --preflight",
37
- "ci:release": "node bin/cli.js --publish-only"
40
+ "release": "bun run build && bun src/cli.ts --preflight",
41
+ "ci:release": "bun src/cli.ts --ci",
42
+ "dev:site": "cd website && pnpm dev",
43
+ "build:site": "cd website && pnpm build",
44
+ "preview:site": "cd website && pnpm preview"
38
45
  },
39
46
  "dependencies": {
40
47
  "@listr2/prompt-adapter-enquirer": "^2.0.12",
41
- "@npmcli/promise-spawn": "^8.0.1",
42
- "cac": "^6.7.14",
48
+ "commander": "^14.0.3",
43
49
  "enquirer": "^2.4.1",
44
50
  "jiti": "^2.6.1",
45
51
  "listr2": "^8.2.5",
@@ -47,28 +53,31 @@
47
53
  "semver": "^7.6.3",
48
54
  "smol-toml": "^1.6.0",
49
55
  "std-env": "^3.7.0",
50
- "tinyexec": "^0.3.0",
51
56
  "update-kit": "^0.1.1",
52
57
  "yaml": "^2.8.2"
53
58
  },
54
59
  "devDependencies": {
55
60
  "@biomejs/biome": "2.4.4",
61
+ "@types/bun": "^1.3.10",
56
62
  "@types/micromatch": "^4.0.10",
57
63
  "@types/node": "^22.7.4",
58
- "@types/npm": "^7.19.3",
59
- "@types/npmcli__promise-spawn": "^6.0.3",
60
64
  "@types/semver": "^7.5.8",
61
65
  "@vitest/coverage-v8": "^2.1.1",
62
66
  "jsr": "^0.13.2",
63
- "tsup": "^8.3.0",
64
67
  "typescript": "^5.6.2",
65
68
  "vitest": "^2.1.1"
66
69
  },
67
- "license": "MIT",
70
+ "optionalDependencies": {
71
+ "@pubm/darwin-arm64": "0.2.12",
72
+ "@pubm/darwin-x64": "0.2.12",
73
+ "@pubm/linux-arm64": "0.2.12",
74
+ "@pubm/linux-x64": "0.2.12",
75
+ "@pubm/windows-x64": "0.2.12"
76
+ },
77
+ "license": "Apache-2.0",
68
78
  "publishConfig": {
69
79
  "access": "public"
70
80
  },
71
- "packageManager": "pnpm@9.11.0",
72
81
  "repository": {
73
82
  "type": "git",
74
83
  "url": "git+https://github.com/syi0808/pubm.git"
@@ -86,9 +95,7 @@
86
95
  "private registry",
87
96
  "multiple publish"
88
97
  ],
89
- "pnpm": {
90
- "patchedDependencies": {
91
- "listr2": "patches/listr2.patch"
92
- }
98
+ "patchedDependencies": {
99
+ "listr2@8.2.5": "patches/listr2.patch"
93
100
  }
94
101
  }
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const os = require("os");
6
+
7
+ function main() {
8
+ const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" };
9
+ const archMap = { x64: "x64", arm64: "arm64" };
10
+
11
+ const platform = platformMap[os.platform()] || os.platform();
12
+ const arch = archMap[os.arch()] || os.arch();
13
+ const packageName = "@pubm/" + platform + "-" + arch;
14
+ const binaryName = platform === "windows" ? "pubm.exe" : "pubm";
15
+
16
+ try {
17
+ const packageJsonPath = require.resolve(packageName + "/package.json");
18
+ const binaryPath = path.join(
19
+ path.dirname(packageJsonPath),
20
+ "bin",
21
+ binaryName,
22
+ );
23
+
24
+ if (!fs.existsSync(binaryPath)) {
25
+ console.error("pubm: binary not found at " + binaryPath);
26
+ process.exit(1);
27
+ }
28
+
29
+ console.log("pubm: platform binary verified (" + packageName + ")");
30
+ } catch {
31
+ console.error(
32
+ "pubm: could not find platform binary package. You may need to install it manually for your platform (" +
33
+ os.platform() +
34
+ "-" +
35
+ os.arch() +
36
+ ").",
37
+ );
38
+ process.exit(0);
39
+ }
40
+ }
41
+
42
+ main();