@inplaysoft/cli 0.9.0 → 0.11.0
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/inplay.js +31 -19
- package/package.json +7 -7
package/inplay.js
CHANGED
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Thin Node wrapper that locates the matching native
|
|
2
|
+
// Thin Node wrapper that locates the matching native <wrapper>-<os>-<arch>
|
|
3
3
|
// package and execs its binary. The release workflow ships one binary per
|
|
4
4
|
// optional-platform package and npm only installs the one that matches the
|
|
5
5
|
// host's process.platform + process.arch — same pattern as esbuild, swc,
|
|
6
6
|
// biome, tailwindcss-oxide.
|
|
7
|
+
//
|
|
8
|
+
// One wrapper serves every release channel (#27756): the platform-package
|
|
9
|
+
// prefix is this package's OWN name, read from the package.json npm ships
|
|
10
|
+
// beside it — `@inplaysoft/cli` (prod) resolves `@inplaysoft/cli-linux-x64`,
|
|
11
|
+
// `@inplaysoft/cli-staging` resolves `@inplaysoft/cli-staging-linux-x64`.
|
|
12
|
+
// There is deliberately NO fallback to the prod prefix: a channel wrapper that
|
|
13
|
+
// cannot name itself must fail, never silently run another channel's binary.
|
|
7
14
|
|
|
8
15
|
const { spawnSync } = require('node:child_process');
|
|
9
16
|
|
|
10
|
-
const
|
|
11
|
-
'darwin-arm64': '@inplaysoft/cli-darwin-arm64',
|
|
12
|
-
'darwin-x64': '@inplaysoft/cli-darwin-x64',
|
|
13
|
-
'linux-arm64': '@inplaysoft/cli-linux-arm64',
|
|
14
|
-
'linux-x64': '@inplaysoft/cli-linux-x64',
|
|
15
|
-
'win32-arm64': '@inplaysoft/cli-win32-arm64',
|
|
16
|
-
'win32-x64': '@inplaysoft/cli-win32-x64',
|
|
17
|
-
};
|
|
17
|
+
const SUPPORTED = ['darwin-arm64', 'darwin-x64', 'linux-arm64', 'linux-x64', 'win32-arm64', 'win32-x64'];
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
let wrapper;
|
|
20
|
+
try {
|
|
21
|
+
wrapper = require('./package.json').name;
|
|
22
|
+
} catch (err) {
|
|
23
23
|
console.error(
|
|
24
|
-
|
|
25
|
-
`
|
|
24
|
+
`inplay: cannot read the wrapper's own package.json (${err.message}).\n` +
|
|
25
|
+
` Reinstall the inplay CLI package you installed (e.g. npm install -g @inplaysoft/cli).`,
|
|
26
26
|
);
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
|
+
if (typeof wrapper !== 'string' || !/^@inplaysoft\/cli(-[a-z]+)?$/.test(wrapper)) {
|
|
30
|
+
console.error(`inplay: the wrapper's package.json names '${wrapper}', not an @inplaysoft/cli package. Reinstall it.`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const key = `${process.platform}-${process.arch}`;
|
|
35
|
+
|
|
36
|
+
if (!SUPPORTED.includes(key)) {
|
|
37
|
+
console.error(`${wrapper}: unsupported platform ${key}. Supported: ${SUPPORTED.join(', ')}.`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
29
40
|
|
|
41
|
+
const pkg = `${wrapper}-${key}`;
|
|
30
42
|
const binName = process.platform === 'win32' ? 'inplay.exe' : 'inplay';
|
|
31
43
|
|
|
32
44
|
let binaryPath;
|
|
@@ -35,12 +47,12 @@ try {
|
|
|
35
47
|
} catch (err) {
|
|
36
48
|
// The matching optional-platform package isn't installed. This usually
|
|
37
49
|
// means npm skipped it because the host advertised a different
|
|
38
|
-
// platform/arch than the one running
|
|
50
|
+
// platform/arch than the one running the wrapper (e.g. installing in CI
|
|
39
51
|
// with --omit=optional, or using a tool that filters optional deps).
|
|
40
52
|
console.error(
|
|
41
|
-
|
|
53
|
+
`${wrapper}: native binary for ${key} is not installed.\n` +
|
|
42
54
|
` Try: npm install ${pkg}\n` +
|
|
43
|
-
` Or: reinstall
|
|
55
|
+
` Or: reinstall ${wrapper} without --omit=optional.`,
|
|
44
56
|
);
|
|
45
57
|
process.exit(1);
|
|
46
58
|
}
|
|
@@ -51,7 +63,7 @@ const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
|
51
63
|
});
|
|
52
64
|
|
|
53
65
|
if (result.error) {
|
|
54
|
-
console.error(
|
|
66
|
+
console.error(`${wrapper}: failed to spawn ${binaryPath}: ${result.error.message}`);
|
|
55
67
|
process.exit(1);
|
|
56
68
|
}
|
|
57
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inplaysoft/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Inplaysoft Platform command-line interface (inplay).",
|
|
5
5
|
"bin": {
|
|
6
6
|
"inplay": "./inplay.js"
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@inplaysoft/cli-darwin-arm64": "0.
|
|
17
|
-
"@inplaysoft/cli-darwin-x64": "0.
|
|
18
|
-
"@inplaysoft/cli-linux-arm64": "0.
|
|
19
|
-
"@inplaysoft/cli-linux-x64": "0.
|
|
20
|
-
"@inplaysoft/cli-win32-arm64": "0.
|
|
21
|
-
"@inplaysoft/cli-win32-x64": "0.
|
|
16
|
+
"@inplaysoft/cli-darwin-arm64": "0.11.0",
|
|
17
|
+
"@inplaysoft/cli-darwin-x64": "0.11.0",
|
|
18
|
+
"@inplaysoft/cli-linux-arm64": "0.11.0",
|
|
19
|
+
"@inplaysoft/cli-linux-x64": "0.11.0",
|
|
20
|
+
"@inplaysoft/cli-win32-arm64": "0.11.0",
|
|
21
|
+
"@inplaysoft/cli-win32-x64": "0.11.0"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|