@dallay/cli-template 0.1.7 → 0.1.8
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/package.json +13 -12
- package/src/index.ts +0 -56
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/index.js +0 -0
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dallay/cli-template",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "A Rust CLI template project",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"cli-template": "
|
|
8
|
+
"cli-template": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"package-lock.json"
|
|
11
|
+
"dist"
|
|
13
12
|
],
|
|
14
13
|
"scripts": {
|
|
15
|
-
"build": "tsc"
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"check:package": "node scripts/check-package.mjs",
|
|
16
|
+
"prepublishOnly": "npm run build && npm run check:package"
|
|
16
17
|
},
|
|
17
18
|
"optionalDependencies": {
|
|
18
|
-
"@dallay/cli-template-
|
|
19
|
-
"@dallay/cli-template-
|
|
20
|
-
"@dallay/cli-template-
|
|
21
|
-
"@dallay/cli-template-
|
|
22
|
-
"@dallay/cli-template-win32-x64": "0.1.
|
|
19
|
+
"@dallay/cli-template-darwin-arm64": "0.1.8",
|
|
20
|
+
"@dallay/cli-template-darwin-x64": "0.1.8",
|
|
21
|
+
"@dallay/cli-template-linux-arm64": "0.1.8",
|
|
22
|
+
"@dallay/cli-template-linux-x64": "0.1.8",
|
|
23
|
+
"@dallay/cli-template-win32-x64": "0.1.8"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/node": "26.6.6",
|
package/src/index.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {spawnSync} from "node:child_process";
|
|
4
|
-
import {join, dirname} from "node:path";
|
|
5
|
-
import {arch, platform} from "node:os";
|
|
6
|
-
|
|
7
|
-
function getBinaryPath(): string {
|
|
8
|
-
const platformMap: Record<string, string> = {
|
|
9
|
-
linux: "linux",
|
|
10
|
-
darwin: "darwin",
|
|
11
|
-
win32: "win32",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const archMap: Record<string, string> = {
|
|
15
|
-
x64: "x64",
|
|
16
|
-
arm64: "arm64",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const os = platformMap[platform()];
|
|
20
|
-
const cpu = archMap[arch()];
|
|
21
|
-
|
|
22
|
-
if (!os || !cpu) {
|
|
23
|
-
throw new Error(`Unsupported platform: ${platform()} ${arch()}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const binaryName = process.platform === "win32" ? "cli-template.exe" : "cli-template";
|
|
27
|
-
const packageName = `@dallay/cli-template-${os}-${cpu}`;
|
|
28
|
-
|
|
29
|
-
// Try to resolve the binary from the platform-specific npm package
|
|
30
|
-
try {
|
|
31
|
-
const pkgPath = require.resolve(`${packageName}/package.json`, {paths: [__dirname]});
|
|
32
|
-
const pkgDir = dirname(pkgPath);
|
|
33
|
-
return join(pkgDir, "bin", binaryName);
|
|
34
|
-
} catch {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`Cannot find binary for ${packageName}. ` +
|
|
37
|
-
`Please ensure the platform-specific package is installed.`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function main() {
|
|
43
|
-
const binaryPath = getBinaryPath();
|
|
44
|
-
const args = process.argv.slice(2);
|
|
45
|
-
|
|
46
|
-
const result = spawnSync(binaryPath, args, {
|
|
47
|
-
stdio: "inherit",
|
|
48
|
-
encoding: "utf-8",
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Propagate the exit code from the binary
|
|
52
|
-
const exitCode = result.status ?? 1;
|
|
53
|
-
process.exit(exitCode);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
main();
|
/package/{src → dist}/index.d.ts
RENAMED
|
File without changes
|
/package/{src → dist}/index.js
RENAMED
|
File without changes
|