@taskdn/cli 0.0.0 → 1.0.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/bin/tdn +79 -0
- package/package.json +24 -1
package/bin/tdn
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
const { join, dirname } = require("path");
|
|
7
|
+
|
|
8
|
+
const PLATFORMS = {
|
|
9
|
+
"darwin arm64": { pkg: "@taskdn/cli-darwin-arm64", exe: "tdn" },
|
|
10
|
+
"darwin x64": { pkg: "@taskdn/cli-darwin-x64", exe: "tdn" },
|
|
11
|
+
"linux arm64": { pkg: "@taskdn/cli-linux-arm64", exe: "tdn" },
|
|
12
|
+
"linux x64": { pkg: "@taskdn/cli-linux-x64", exe: "tdn" },
|
|
13
|
+
"win32 x64": { pkg: "@taskdn/cli-win32-x64", exe: "tdn.exe" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const key = `${process.platform} ${process.arch}`;
|
|
17
|
+
const platform = PLATFORMS[key];
|
|
18
|
+
|
|
19
|
+
if (!platform) {
|
|
20
|
+
console.error(
|
|
21
|
+
`Unsupported platform: ${process.platform} ${process.arch}\n` +
|
|
22
|
+
`tdn supports: ${Object.keys(PLATFORMS).join(", ")}`
|
|
23
|
+
);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let binPath;
|
|
28
|
+
try {
|
|
29
|
+
binPath = join(
|
|
30
|
+
dirname(require.resolve(`${platform.pkg}/package.json`)),
|
|
31
|
+
platform.exe
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
console.error(
|
|
35
|
+
`Could not find package ${platform.pkg}.\n` +
|
|
36
|
+
`The platform-specific binary package was not installed.\n` +
|
|
37
|
+
`Try reinstalling: npm install -g @taskdn/cli`
|
|
38
|
+
);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Warn if tdn is also installed via Homebrew (macOS only)
|
|
43
|
+
if (process.platform === "darwin" && !process.env.TDN_NO_DUAL_WARN) {
|
|
44
|
+
const { existsSync } = require("fs");
|
|
45
|
+
const brewPaths = ["/opt/homebrew/bin/tdn", "/usr/local/bin/tdn"];
|
|
46
|
+
const brewPath = brewPaths.find((p) => existsSync(p));
|
|
47
|
+
if (brewPath) {
|
|
48
|
+
console.error(
|
|
49
|
+
`Note: tdn is also installed via Homebrew at ${brewPath}\n` +
|
|
50
|
+
`You are running the npm-installed version. To suppress this warning:\n` +
|
|
51
|
+
` export TDN_NO_DUAL_WARN=1\n`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (result.error) {
|
|
61
|
+
if (result.error.code === "ENOENT") {
|
|
62
|
+
console.error(
|
|
63
|
+
`Binary not found at ${binPath}.\n` +
|
|
64
|
+
`Try reinstalling: npm install -g @taskdn/cli`
|
|
65
|
+
);
|
|
66
|
+
} else {
|
|
67
|
+
throw result.error;
|
|
68
|
+
}
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (result.status !== null) {
|
|
73
|
+
process.exit(result.status);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Process was killed by a signal — use conventional 128 + signal exit code
|
|
77
|
+
const os = require("os");
|
|
78
|
+
const signum = os.constants.signals[result.signal];
|
|
79
|
+
process.exit(signum ? 128 + signum : 1);
|
package/package.json
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskdn/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Taskdn CLI — task management from the command line",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dannysmith/taskdn.git",
|
|
9
|
+
"directory": "tdn-cli"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"tdn": "bin/tdn"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@taskdn/cli-darwin-arm64": "1.0.0",
|
|
19
|
+
"@taskdn/cli-darwin-x64": "1.0.0",
|
|
20
|
+
"@taskdn/cli-linux-arm64": "1.0.0",
|
|
21
|
+
"@taskdn/cli-linux-x64": "1.0.0",
|
|
22
|
+
"@taskdn/cli-win32-x64": "1.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|