smithue-cli 0.9.0 → 0.9.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/dist/cli.js +1 -1
- package/dist/output.d.ts +1 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +17 -3
- package/package.json +38 -38
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ const program = new Command();
|
|
|
15
15
|
const require = createRequire(import.meta.url);
|
|
16
16
|
const { version: cliVersion } = require('../package.json');
|
|
17
17
|
program
|
|
18
|
-
.name('smithue')
|
|
18
|
+
.name('smithue-cli')
|
|
19
19
|
.description('CLI for SmithUE Unreal Engine plugin')
|
|
20
20
|
.version(cliVersion)
|
|
21
21
|
.option('--pid <pid>', 'target SmithUE instance by PID', parseInt)
|
package/dist/output.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface OutputOptions {
|
|
|
2
2
|
terse?: boolean;
|
|
3
3
|
outPath?: string;
|
|
4
4
|
}
|
|
5
|
+
export declare function escapeNonAscii(s: string): string;
|
|
5
6
|
export declare function setOutputOptions(opts: OutputOptions): void;
|
|
6
7
|
export declare function printResult(data: unknown): void;
|
|
7
8
|
export declare function printError(err: unknown): void;
|
package/dist/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAE1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAE1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CA2B/C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiB7C"}
|
package/dist/output.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { SmithUEError } from './portfile.js';
|
|
3
3
|
let _opts = {};
|
|
4
|
+
export function escapeNonAscii(s) {
|
|
5
|
+
let out = '';
|
|
6
|
+
for (let i = 0; i < s.length; i++) {
|
|
7
|
+
const code = s.charCodeAt(i);
|
|
8
|
+
if (code < 0x80) {
|
|
9
|
+
out += s[i];
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
out += `\\u${code.toString(16).padStart(4, '0')}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
4
17
|
export function setOutputOptions(opts) {
|
|
5
18
|
_opts = { ..._opts, ...opts };
|
|
6
19
|
}
|
|
@@ -17,14 +30,15 @@ export function printResult(data) {
|
|
|
17
30
|
// path doesn't exist — fine, writeFileSync will create it
|
|
18
31
|
}
|
|
19
32
|
if (isDir) {
|
|
20
|
-
process.stderr.write(JSON.stringify({ error: `outPath is a directory: ${_opts.outPath}`, exit_code: 1 }) +
|
|
33
|
+
process.stderr.write(escapeNonAscii(JSON.stringify({ error: `outPath is a directory: ${_opts.outPath}`, exit_code: 1 })) +
|
|
34
|
+
'\n');
|
|
21
35
|
process.exit(1);
|
|
22
36
|
return;
|
|
23
37
|
}
|
|
24
38
|
fs.writeFileSync(_opts.outPath, json, 'utf8');
|
|
25
39
|
return;
|
|
26
40
|
}
|
|
27
|
-
process.stdout.write(json);
|
|
41
|
+
process.stdout.write(escapeNonAscii(json));
|
|
28
42
|
}
|
|
29
43
|
export function printError(err) {
|
|
30
44
|
let message;
|
|
@@ -41,6 +55,6 @@ export function printError(err) {
|
|
|
41
55
|
message = String(err);
|
|
42
56
|
exitCode = 4;
|
|
43
57
|
}
|
|
44
|
-
process.stderr.write(JSON.stringify({ error: message, exit_code: exitCode }) + '\n');
|
|
58
|
+
process.stderr.write(escapeNonAscii(JSON.stringify({ error: message, exit_code: exitCode })) + '\n');
|
|
45
59
|
process.exit(exitCode);
|
|
46
60
|
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name":
|
|
3
|
-
"version":
|
|
4
|
-
"type":
|
|
5
|
-
"main":
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"devDependencies":
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"dependencies":
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"bin":
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"engines":
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"publishConfig":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"license":
|
|
35
|
-
"description":
|
|
36
|
-
"repository":
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
"name": "smithue-cli",
|
|
3
|
+
"version": "0.9.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/cli.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.build.json",
|
|
8
|
+
"test": "vitest run",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"dev": "tsc -p tsconfig.build.json --watch"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/",
|
|
14
|
+
"package.json",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20.0.0",
|
|
19
|
+
"typescript": "^5.3.0",
|
|
20
|
+
"vitest": "^1.0.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"commander": "^15.0.0"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"smithue-cli": "dist/cli.js"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"description": "CLI tool for controlling Unreal Engine editor via SmithUE plugin",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/123dx-svg/smithue-cli.git"
|
|
39
|
+
}
|
|
40
40
|
}
|