@byteplus/ark-cli 1.0.46-prerelease.f14389c2f21a → 1.0.46

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/manifest.json CHANGED
@@ -1,43 +1,72 @@
1
1
  {
2
2
  "package": "@byteplus/ark-cli",
3
- "version": "1.0.46-prerelease.f14389c2f21a",
3
+ "version": "1.0.46",
4
4
  "platforms": {
5
5
  "darwin-amd64": {
6
6
  "kind": "cdn",
7
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-darwin-amd64",
8
- "sha256": "fdd30aa5ba3ac474cc963e6de19d5a41ad0901db4f4275273d9cf764988d1f19"
7
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-darwin-amd64",
8
+ "sha256": "a5f64639f105381688087f585c851870f75d555f9d5fcbaf446d9718e7862da9",
9
+ "fallback": {
10
+ "kind": "github-release",
11
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-darwin-amd64"
12
+ }
9
13
  },
10
14
  "darwin-arm64": {
11
15
  "kind": "cdn",
12
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-darwin-arm64",
13
- "sha256": "f5a01597c48fbd0d67ed5faab504238db0d81980666b0720557b9f6f66ccc290"
16
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-darwin-arm64",
17
+ "sha256": "07fcaf13790cc8312aeec01592508cbbc2ff60e8856a6d9dadcb9c1efaeefeb2",
18
+ "fallback": {
19
+ "kind": "github-release",
20
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-darwin-arm64"
21
+ }
14
22
  },
15
23
  "linux-amd64": {
16
24
  "kind": "cdn",
17
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-linux-amd64",
18
- "sha256": "f33c081d378f9e0c241d00ee7613fe2d4dd2d3a059f00d0ef32cd9544db51ad8"
25
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-linux-amd64",
26
+ "sha256": "56c517fcccb7dfe26aba6139b48a39d9fa7048584e76c476b4bf1a2d46076467",
27
+ "fallback": {
28
+ "kind": "github-release",
29
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-linux-amd64"
30
+ }
19
31
  },
20
32
  "linux-arm64": {
21
33
  "kind": "cdn",
22
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-linux-arm64",
23
- "sha256": "5eda7f8cc2afea50151154f593a7c7832d2a5d1b6e98ff54462928dd9ea5eaae"
34
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-linux-arm64",
35
+ "sha256": "ebbccdcd718544f477af6f7edb281f674aaecdc2e0b43be2410218dff18f9584",
36
+ "fallback": {
37
+ "kind": "github-release",
38
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-linux-arm64"
39
+ }
24
40
  },
25
41
  "windows-amd64": {
26
42
  "kind": "cdn",
27
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-windows-amd64.exe",
28
- "sha256": "c65d30e1c5da7a112f70479b8d0f497f72529acba529d42607da34947b68d231"
43
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-windows-amd64.exe",
44
+ "sha256": "5b2206a8485cf361aabd0d35a5413dbd5c18f40e6aa756ea52c1b17bbad1363b",
45
+ "fallback": {
46
+ "kind": "github-release",
47
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-windows-amd64.exe"
48
+ }
29
49
  },
30
50
  "windows-arm64": {
31
51
  "kind": "cdn",
32
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/arkcli-1.0.46-prerelease.f14389c2f21a-windows-arm64.exe",
33
- "sha256": "ecd9763ca73502e1d4d8ed78c2a27c1e6f5ec85de550b7b61554bd7486ffce0d"
52
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/arkcli-1.0.46-windows-arm64.exe",
53
+ "sha256": "6b48662a567527dacef3059888b2b707b2102ded4bd51196500f2079c7de296d",
54
+ "fallback": {
55
+ "kind": "github-release",
56
+ "url": "https://github.com/byteplus-sdk/ark-cli/releases/download/v1.0.46/arkcli-1.0.46-windows-arm64.exe"
57
+ }
34
58
  }
35
59
  },
36
60
  "skills": {
37
61
  "primary": {
38
62
  "kind": "cdn",
39
- "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prerelease/1.0.46-prerelease.f14389c2f21a/skills.tar.gz",
40
- "sha256": "df2b8cbee67cc294fd1441034cefd39d89b13e0997ae973e6668083d11fe892b"
63
+ "url": "https://sf16-sg.tiktokcdn.com/obj/eden-sg/psjryh/ljhwZthlaukjlkulzlp/prod/1.0.46/skills.tar.gz",
64
+ "sha256": "c23d1e0e3c4b420fa4d8f758a4e4e6f4e72bf06cdee39fcc45d036892ef34e04"
65
+ },
66
+ "tag": "v1.0.46",
67
+ "fallback": {
68
+ "kind": "github",
69
+ "url": "https://github.com/byteplus-sdk/ark-cli/archive/refs/tags/v1.0.46.tar.gz"
41
70
  }
42
71
  }
43
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/ark-cli",
3
- "version": "1.0.46-prerelease.f14389c2f21a",
3
+ "version": "1.0.46",
4
4
  "description": "BytePlus Ark command-line interface",
5
5
  "bin": {
6
6
  "arkcli": "scripts/run.js"
@@ -44,5 +44,13 @@
44
44
  "homepage": "https://github.com/byteplus-sdk/ark-cli#readme",
45
45
  "bugs": {
46
46
  "url": "https://github.com/byteplus-sdk/ark-cli/issues"
47
+ },
48
+ "optionalDependencies": {
49
+ "@byteplus/ark-cli-darwin-x64": "1.0.46",
50
+ "@byteplus/ark-cli-darwin-arm64": "1.0.46",
51
+ "@byteplus/ark-cli-linux-x64": "1.0.46",
52
+ "@byteplus/ark-cli-linux-arm64": "1.0.46",
53
+ "@byteplus/ark-cli-win32-x64": "1.0.46",
54
+ "@byteplus/ark-cli-win32-arm64": "1.0.46"
47
55
  }
48
56
  }
package/scripts/run.js CHANGED
@@ -1,41 +1,63 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
3
+ // npm installs the matching optional platform package without lifecycle scripts.
4
+ // Keep the historical bin/ layout for already installed and composite-updated CLI.
4
5
  const fs = require("fs");
5
6
  const path = require("path");
6
7
  const { execFileSync } = require("child_process");
7
-
8
8
  const PACKAGE_NAME = "@byteplus/ark-cli";
9
- const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" };
10
- const archMap = { x64: "amd64", arm64: "arm64" };
11
- const platform = platformMap[process.platform];
12
- const arch = archMap[process.arch];
13
-
9
+ const root = path.resolve(__dirname, "..");
10
+ const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[process.platform];
11
+ const arch = { x64: "amd64", arm64: "arm64" }[process.arch];
14
12
  if (!platform || !arch) {
15
13
  console.error(`${PACKAGE_NAME}: unsupported platform ${process.platform}-${process.arch}`);
16
14
  process.exit(1);
17
15
  }
18
-
19
16
  const ext = platform === "windows" ? ".exe" : "";
20
- const binary = path.join(__dirname, "..", "bin", `arkcli-${platform}-${arch}${ext}`);
17
+ let binary = path.join(root, "bin", `arkcli-${platform}-${arch}${ext}`);
21
18
 
22
- let binaryReady = false;
23
- try {
24
- const info = fs.lstatSync(binary);
25
- binaryReady = info.isFile() && !info.isSymbolicLink();
26
- } catch (_) {
27
- // The repair guidance below covers missing and unreadable binaries.
19
+ function regularFile(file, maxBytes) {
20
+ for (let current = file; ; current = path.dirname(current)) {
21
+ const stat = fs.lstatSync(current);
22
+ if (stat.isSymbolicLink()) throw new Error(`refuse symlink: ${current}`);
23
+ if (current === file) {
24
+ if (!stat.isFile() || stat.size <= 0 || (maxBytes && stat.size > maxBytes)) throw new Error(`invalid file: ${file}`);
25
+ } else if (!stat.isDirectory()) throw new Error(`invalid directory: ${current}`);
26
+ if (current === root) break;
27
+ if (current === path.dirname(current)) throw new Error("platform package escapes its owner");
28
+ }
28
29
  }
29
-
30
- if (!binaryReady) {
31
- console.error(
32
- `${PACKAGE_NAME}: binary not found at ${binary}\n` +
33
- `Reinstall the package with:\n npm install -g ${PACKAGE_NAME}\n` +
34
- `or retry the install step with:\n node ${path.join(__dirname, "postinstall.js")}`,
35
- );
30
+ function metadata(file) {
31
+ regularFile(file, 1024 * 1024);
32
+ return JSON.parse(fs.readFileSync(file, "utf8"));
33
+ }
34
+ try {
35
+ let legacy = true;
36
+ try { fs.lstatSync(binary); } catch (err) {
37
+ if (err.code !== "ENOENT") throw err;
38
+ legacy = false;
39
+ }
40
+ if (!legacy) {
41
+ const parent = metadata(path.join(root, "package.json"));
42
+ const name = `${PACKAGE_NAME}-${process.platform}-${process.arch}`;
43
+ if (parent.name !== PACKAGE_NAME || !parent.version || parent.optionalDependencies?.[name] !== parent.version) {
44
+ throw new Error("missing exact-version platform dependency declaration");
45
+ }
46
+ const childRoot = path.join(root, "node_modules", name);
47
+ const child = metadata(path.join(childRoot, "package.json"));
48
+ if (child.name !== name || child.version !== parent.version ||
49
+ !Array.isArray(child.os) || child.os.length !== 1 || child.os[0] !== process.platform ||
50
+ !Array.isArray(child.cpu) || child.cpu.length !== 1 || child.cpu[0] !== process.arch) {
51
+ throw new Error("platform package identity/version mismatch");
52
+ }
53
+ binary = path.join(childRoot, "bin", `arkcli-${platform}-${arch}${ext}`);
54
+ }
55
+ regularFile(binary);
56
+ } catch (err) {
57
+ console.error(`${PACKAGE_NAME}: platform binary unavailable: ${err.message}\n` +
58
+ `Reinstall with optional dependencies enabled:\n npm install -g ${PACKAGE_NAME} --include=optional`);
36
59
  process.exit(1);
37
60
  }
38
-
39
61
  try {
40
62
  execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
41
63
  } catch (err) {