@linxiraos/pi-utils 1.2.0 → 1.2.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/dist/types/index.d.ts +1 -0
- package/dist/types/release-assets.d.ts +22 -0
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/release-assets.ts +40 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * as procmgr from "./procmgr.js";
|
|
|
29
29
|
export * as prompt from "./prompt.js";
|
|
30
30
|
export * as ptree from "./ptree.js";
|
|
31
31
|
export { AbortError, ChildProcess, Exception, NonZeroExitError } from "./ptree.js";
|
|
32
|
+
export * from "./release-assets.js";
|
|
32
33
|
export * from "./runtime-install.js";
|
|
33
34
|
export * from "./sanitize-text.js";
|
|
34
35
|
export * from "./snowflake.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Published CLI release-asset naming — the one contract shared by the release
|
|
3
|
+
* build (`scripts/ci-release-build-binaries.ts` outfiles), the CI upload matrix
|
|
4
|
+
* (`.github/workflows/ci.yml` `release_binary.binary_path`), the installers
|
|
5
|
+
* (`scripts/install.sh` / `install.ps1`) and the updater's binary fallback.
|
|
6
|
+
*
|
|
7
|
+
* Assets are `zeta-cli-<os>-<arch>[.exe]`. `zeta-cli` is the *file-name* face
|
|
8
|
+
* of the package and deliberately does NOT follow {@link CLI_BIN_NAME}
|
|
9
|
+
* (`zetacode`, the user-visible command face): the brand cutover moved the
|
|
10
|
+
* command name, and the updater's asset name drifted with it, so every binary
|
|
11
|
+
* fallback asked GitHub for `zetacode-*` assets no release carries (v1.1.27 /
|
|
12
|
+
* main). `scripts/check-release-asset-names.ts` pins both sides together.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Leading token of every published CLI binary asset, separator included:
|
|
16
|
+
* assets are `<prefix><os>[-musl]-<arch>[.exe]`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const RELEASE_CLI_ASSET_PREFIX = "zeta-cli-";
|
|
19
|
+
/** Release asset for a CLI binary, e.g. `zeta-cli-windows-x64.exe`. */
|
|
20
|
+
export declare function releaseCliAssetName(platform: NodeJS.Platform, arch: string, options?: {
|
|
21
|
+
musl?: boolean;
|
|
22
|
+
}): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxiraos/pi-utils",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Shared utilities for pi packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utilities",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@linxiraos/pi-natives": "1.2.
|
|
57
|
+
"@linxiraos/pi-natives": "1.2.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/bun": "
|
|
60
|
+
"@types/bun": "1.4.3"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"bun": ">=1.3.14"
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * as procmgr from "./procmgr";
|
|
|
29
29
|
export * as prompt from "./prompt";
|
|
30
30
|
export * as ptree from "./ptree";
|
|
31
31
|
export { AbortError, ChildProcess, Exception, NonZeroExitError } from "./ptree";
|
|
32
|
+
export * from "./release-assets";
|
|
32
33
|
export * from "./runtime-install";
|
|
33
34
|
export * from "./sanitize-text";
|
|
34
35
|
export * from "./snowflake";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Published CLI release-asset naming — the one contract shared by the release
|
|
3
|
+
* build (`scripts/ci-release-build-binaries.ts` outfiles), the CI upload matrix
|
|
4
|
+
* (`.github/workflows/ci.yml` `release_binary.binary_path`), the installers
|
|
5
|
+
* (`scripts/install.sh` / `install.ps1`) and the updater's binary fallback.
|
|
6
|
+
*
|
|
7
|
+
* Assets are `zeta-cli-<os>-<arch>[.exe]`. `zeta-cli` is the *file-name* face
|
|
8
|
+
* of the package and deliberately does NOT follow {@link CLI_BIN_NAME}
|
|
9
|
+
* (`zetacode`, the user-visible command face): the brand cutover moved the
|
|
10
|
+
* command name, and the updater's asset name drifted with it, so every binary
|
|
11
|
+
* fallback asked GitHub for `zetacode-*` assets no release carries (v1.1.27 /
|
|
12
|
+
* main). `scripts/check-release-asset-names.ts` pins both sides together.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Leading token of every published CLI binary asset, separator included:
|
|
17
|
+
* assets are `<prefix><os>[-musl]-<arch>[.exe]`.
|
|
18
|
+
*/
|
|
19
|
+
export const RELEASE_CLI_ASSET_PREFIX = "zeta-cli-";
|
|
20
|
+
|
|
21
|
+
/** Asset-name OS token per platform; Linux additionally has a musl build. */
|
|
22
|
+
const RELEASE_OS: Partial<Record<NodeJS.Platform, string>> = {
|
|
23
|
+
darwin: "darwin",
|
|
24
|
+
linux: "linux",
|
|
25
|
+
win32: "windows",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const RELEASE_ARCH: Record<string, string> = { x64: "x64", arm64: "arm64" };
|
|
29
|
+
|
|
30
|
+
/** Release asset for a CLI binary, e.g. `zeta-cli-windows-x64.exe`. */
|
|
31
|
+
export function releaseCliAssetName(platform: NodeJS.Platform, arch: string, options: { musl?: boolean } = {}): string {
|
|
32
|
+
const os = RELEASE_OS[platform];
|
|
33
|
+
if (!os) throw new Error(`Unsupported platform: ${platform}`);
|
|
34
|
+
if (options.musl && platform !== "linux") throw new Error(`musl builds exist on linux only: ${platform}`);
|
|
35
|
+
const archName = RELEASE_ARCH[arch];
|
|
36
|
+
if (!archName) throw new Error(`Unsupported architecture: ${arch}`);
|
|
37
|
+
const libc = options.musl ? "-musl" : "";
|
|
38
|
+
const suffix = platform === "win32" ? ".exe" : "";
|
|
39
|
+
return `${RELEASE_CLI_ASSET_PREFIX}${os}${libc}-${archName}${suffix}`;
|
|
40
|
+
}
|