@iotwork/scadactl 2.8.3 → 2.9.2-linux-amd64

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/bin/scadactl ADDED
Binary file
package/package.json CHANGED
@@ -1,36 +1,22 @@
1
1
  {
2
2
  "name": "@iotwork/scadactl",
3
- "version": "2.8.3",
4
- "description": "Command-line client for Shenkong SCADA",
3
+ "version": "2.9.2-linux-amd64",
4
+ "description": "scadactl binary for Linux x64",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://www.shenkong.cc",
7
- "type": "module",
8
- "bin": {
9
- "scadactl": "bin/scadactl.js"
10
- },
7
+ "os": [
8
+ "linux"
9
+ ],
10
+ "cpu": [
11
+ "x64"
12
+ ],
11
13
  "files": [
12
- "bin",
13
- "lib",
14
- "README.md"
14
+ "bin/scadactl"
15
15
  ],
16
16
  "engines": {
17
17
  "node": ">=18"
18
18
  },
19
19
  "publishConfig": {
20
20
  "access": "public"
21
- },
22
- "scripts": {
23
- "build": "node scripts/build.mjs",
24
- "check": "node scripts/check.mjs",
25
- "pack:all": "node scripts/pack.mjs",
26
- "publish:all": "node scripts/publish.mjs",
27
- "set-version": "node scripts/set-version.mjs"
28
- },
29
- "optionalDependencies": {
30
- "@iotwork/scadactl-windows-amd64": "npm:@iotwork/scadactl@2.8.3-windows-amd64",
31
- "@iotwork/scadactl-windows-arm64": "npm:@iotwork/scadactl@2.8.3-windows-arm64",
32
- "@iotwork/scadactl-linux-amd64": "npm:@iotwork/scadactl@2.8.3-linux-amd64",
33
- "@iotwork/scadactl-linux-arm64": "npm:@iotwork/scadactl@2.8.3-linux-arm64",
34
- "@iotwork/scadactl-darwin-arm64": "npm:@iotwork/scadactl@2.8.3-darwin-arm64"
35
21
  }
36
22
  }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # scadactl npm packages
2
-
3
- 该目录用于将 Go 编写的 `scadactl` 发布为跨平台 npm 命令行工具。
4
-
5
- ## 安装
6
-
7
- ```sh
8
- npm install --global @iotwork/scadactl
9
- scadactl -h
10
- ```
11
-
12
- 入口包 `@iotwork/scadactl` 本身只包含 Node.js 启动器。npm 会根据平台包中的 `os` 和 `cpu` 字段,仅安装当前系统对应的 optional dependency:
13
-
14
- | 构建目标 | npm `os` | npm `cpu` | optional dependency alias |
15
- | --- | --- | --- | --- |
16
- | `windows_amd64` | `win32` | `x64` | `@iotwork/scadactl-windows-amd64` |
17
- | `windows_arm64` | `win32` | `arm64` | `@iotwork/scadactl-windows-arm64` |
18
- | `linux_amd64` | `linux` | `x64` | `@iotwork/scadactl-linux-amd64` |
19
- | `linux_arm64` | `linux` | `arm64` | `@iotwork/scadactl-linux-arm64` |
20
- | `darwin_arm64` | `darwin` | `arm64` | `@iotwork/scadactl-darwin-arm64` |
21
-
22
- 这些别名均指向同一个真实 npm 包名 `@iotwork/scadactl` 的平台预发布版本。例如 `@iotwork/scadactl-linux-amd64` 对应 `npm:@iotwork/scadactl@2.8.3-linux-amd64`。
23
-
24
- ## 发布
25
-
26
- 在本目录执行:
27
-
28
- ```sh
29
- npm run set-version -- 2.8.3
30
- npm run check
31
- npm run build
32
- npm run pack:all
33
- npm run publish:all -- --dry-run
34
- npm run publish:all
35
- ```
36
-
37
- `set-version` 只接受 `x.y.z` 格式,并同步更新入口包、五个平台包和所有 npm alias。`build` 使用 `CGO_ENABLED=0` 交叉编译五个平台,`pack:all` 将六个 tarball 写入 `dist/`。
38
-
39
- `publish:all` 先以 `platform` dist-tag 发布五个平台版本,最后以 `latest` 发布入口包。可以把 npm 参数继续传给脚本,例如:
40
-
41
- ```sh
42
- npm run publish:all -- --registry=https://registry.example.com
43
- ```
44
-
45
- 平台二进制生成在 `packages/<target>/bin/`,打包产物生成在 `dist/`;两者都不会提交到 Git。
package/bin/scadactl.js DELETED
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawn } from "node:child_process";
4
- import { existsSync } from "node:fs";
5
- import { createRequire } from "node:module";
6
- import path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
-
9
- import { findTarget } from "../lib/targets.js";
10
-
11
- const require = createRequire(import.meta.url);
12
- const currentDirectory = path.dirname(fileURLToPath(import.meta.url));
13
- const target = findTarget();
14
-
15
- if (!target) {
16
- throw new Error(`Unsupported platform: ${process.platform} (${process.arch})`);
17
- }
18
-
19
- function findExecutable() {
20
- let packageRoot;
21
- try {
22
- const manifest = require.resolve(`${target.alias}/package.json`);
23
- packageRoot = path.dirname(manifest);
24
- } catch {
25
- // Allow the launcher to run directly from this source tree after npm run build.
26
- packageRoot = path.resolve(
27
- currentDirectory,
28
- "..",
29
- "packages",
30
- target.id,
31
- );
32
- }
33
-
34
- const executable = path.join(packageRoot, "bin", target.executable);
35
- if (existsSync(executable)) {
36
- return executable;
37
- }
38
-
39
- throw new Error(
40
- `Missing optional dependency ${target.alias}. Reinstall with: npm install --global @iotwork/scadactl@latest`,
41
- );
42
- }
43
-
44
- const child = spawn(findExecutable(), process.argv.slice(2), {
45
- stdio: "inherit",
46
- });
47
-
48
- child.on("error", (error) => {
49
- console.error(error);
50
- process.exit(1);
51
- });
52
-
53
- for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
54
- process.on(signal, () => {
55
- if (!child.killed) {
56
- child.kill(signal);
57
- }
58
- });
59
- }
60
-
61
- child.on("exit", (code, signal) => {
62
- if (signal && process.platform !== "win32") {
63
- process.kill(process.pid, signal);
64
- return;
65
- }
66
- process.exit(code ?? 1);
67
- });
package/lib/targets.js DELETED
@@ -1,55 +0,0 @@
1
- export const targets = Object.freeze([
2
- Object.freeze({
3
- id: "windows_amd64",
4
- alias: "@iotwork/scadactl-windows-amd64",
5
- os: "win32",
6
- cpu: "x64",
7
- goos: "windows",
8
- goarch: "amd64",
9
- executable: "scadactl.exe",
10
- }),
11
- Object.freeze({
12
- id: "windows_arm64",
13
- alias: "@iotwork/scadactl-windows-arm64",
14
- os: "win32",
15
- cpu: "arm64",
16
- goos: "windows",
17
- goarch: "arm64",
18
- executable: "scadactl.exe",
19
- }),
20
- Object.freeze({
21
- id: "linux_amd64",
22
- alias: "@iotwork/scadactl-linux-amd64",
23
- os: "linux",
24
- cpu: "x64",
25
- goos: "linux",
26
- goarch: "amd64",
27
- executable: "scadactl",
28
- }),
29
- Object.freeze({
30
- id: "linux_arm64",
31
- alias: "@iotwork/scadactl-linux-arm64",
32
- os: "linux",
33
- cpu: "arm64",
34
- goos: "linux",
35
- goarch: "arm64",
36
- executable: "scadactl",
37
- }),
38
- Object.freeze({
39
- id: "darwin_arm64",
40
- alias: "@iotwork/scadactl-darwin-arm64",
41
- os: "darwin",
42
- cpu: "arm64",
43
- goos: "darwin",
44
- goarch: "arm64",
45
- executable: "scadactl",
46
- }),
47
- ]);
48
-
49
- export function findTarget(platform = process.platform, arch = process.arch) {
50
- return targets.find((target) => target.os === platform && target.cpu === arch);
51
- }
52
-
53
- export function platformVersion(version, target) {
54
- return `${version}-${target.id.replaceAll("_", "-")}`;
55
- }