@dallay/cli-template 0.0.0-stage → 0.1.7

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 CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@dallay/cli-template",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.7",
4
+ "description": "A Rust CLI template project",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "bin": {
8
+ "cli-template": "src/index.js"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "package-lock.json"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc"
16
+ },
17
+ "optionalDependencies": {
18
+ "@dallay/cli-template-linux-x64": "0.1.7",
19
+ "@dallay/cli-template-linux-arm64": "0.1.7",
20
+ "@dallay/cli-template-darwin-x64": "0.1.7",
21
+ "@dallay/cli-template-darwin-arm64": "0.1.7",
22
+ "@dallay/cli-template-win32-x64": "0.1.7"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "26.6.6",
26
+ "typescript": "7.0.2"
27
+ },
28
+ "license": "MIT"
29
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/src/index.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const node_child_process_1 = require("node:child_process");
5
+ const node_path_1 = require("node:path");
6
+ const node_os_1 = require("node:os");
7
+ function getBinaryPath() {
8
+ const platformMap = {
9
+ linux: "linux",
10
+ darwin: "darwin",
11
+ win32: "win32",
12
+ };
13
+ const archMap = {
14
+ x64: "x64",
15
+ arm64: "arm64",
16
+ };
17
+ const os = platformMap[(0, node_os_1.platform)()];
18
+ const cpu = archMap[(0, node_os_1.arch)()];
19
+ if (!os || !cpu) {
20
+ throw new Error(`Unsupported platform: ${(0, node_os_1.platform)()} ${(0, node_os_1.arch)()}`);
21
+ }
22
+ const binaryName = process.platform === "win32" ? "cli-template.exe" : "cli-template";
23
+ const packageName = `@dallay/cli-template-${os}-${cpu}`;
24
+ // Try to resolve the binary from the platform-specific npm package
25
+ try {
26
+ const pkgPath = require.resolve(`${packageName}/package.json`, { paths: [__dirname] });
27
+ const pkgDir = (0, node_path_1.dirname)(pkgPath);
28
+ return (0, node_path_1.join)(pkgDir, "bin", binaryName);
29
+ }
30
+ catch {
31
+ throw new Error(`Cannot find binary for ${packageName}. ` +
32
+ `Please ensure the platform-specific package is installed.`);
33
+ }
34
+ }
35
+ function main() {
36
+ const binaryPath = getBinaryPath();
37
+ const args = process.argv.slice(2);
38
+ const result = (0, node_child_process_1.spawnSync)(binaryPath, args, {
39
+ stdio: "inherit",
40
+ encoding: "utf-8",
41
+ });
42
+ // Propagate the exit code from the binary
43
+ const exitCode = result.status ?? 1;
44
+ process.exit(exitCode);
45
+ }
46
+ main();
package/src/index.ts ADDED
@@ -0,0 +1,56 @@
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/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.