@deveco-test/deveco-cli 0.1.2
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/cli.js +36 -0
- package/package.json +26 -0
package/cli.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Shell entry: map process.platform to an implementation package, resolve its
|
|
3
|
+
// absolute cli.js path, and spawnSync-exec it with all argv forwarded.
|
|
4
|
+
// Command parsing, error handling, and exit code are all owned by the impl pkg.
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const IMPL_PKG = process.platform === 'openharmony'
|
|
10
|
+
? '@deveco-test/deveco-cli-openharmony-arm64'
|
|
11
|
+
: '@deveco-test/deveco-cli-common';
|
|
12
|
+
|
|
13
|
+
let cliPath;
|
|
14
|
+
try {
|
|
15
|
+
cliPath = createRequire(import.meta.url).resolve(IMPL_PKG + '/dist/cli.js');
|
|
16
|
+
} catch (err) {
|
|
17
|
+
process.stderr.write(
|
|
18
|
+
`devecocli: implementation package "${IMPL_PKG}" is not installed for this platform.\n` +
|
|
19
|
+
` platform: ${process.platform}\n` +
|
|
20
|
+
` expected: ${IMPL_PKG}\n` +
|
|
21
|
+
` hint: reinstall with "npm install -g @zacktt131/deveco-cli-shell" (do not use --omit=optional)\n` +
|
|
22
|
+
` cause: ${err && err.message ? err.message : err}\n`
|
|
23
|
+
);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const result = spawnSync(process.execPath, [cliPath, ...process.argv.slice(2)], {
|
|
28
|
+
stdio: 'inherit',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if (result.error) {
|
|
33
|
+
process.stderr.write(`devecocli: failed to spawn implementation: ${result.error.message}\n`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deveco-test/deveco-cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "HarmonyOS application development command line tool",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"devecocli": "cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"cli.js"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"harmonyos",
|
|
18
|
+
"deveco",
|
|
19
|
+
"cli",
|
|
20
|
+
"openharmony"
|
|
21
|
+
],
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@deveco-test/deveco-cli-openharmony-arm64": "0.1.2",
|
|
24
|
+
"@deveco-test/deveco-cli-common": "0.1.2"
|
|
25
|
+
}
|
|
26
|
+
}
|