@atarek/ptt 0.1.0-beta
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/ptt +52 -0
- package/package.json +22 -0
package/bin/ptt
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const { resolve } = require('path');
|
|
5
|
+
|
|
6
|
+
// Map Node.js platform/arch to package names
|
|
7
|
+
const platformMap = {
|
|
8
|
+
'darwin-arm64': '@atarek/ptt-darwin-arm64',
|
|
9
|
+
'darwin-x64': '@atarek/ptt-darwin-amd64',
|
|
10
|
+
'linux-x64': '@atarek/ptt-linux-amd64',
|
|
11
|
+
'linux-arm64': '@atarek/ptt-linux-arm64',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
15
|
+
const packageName = platformMap[platformKey];
|
|
16
|
+
|
|
17
|
+
if (!packageName) {
|
|
18
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
19
|
+
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Resolve the platform-specific binary
|
|
24
|
+
let binaryPath;
|
|
25
|
+
try {
|
|
26
|
+
binaryPath = require.resolve(`${packageName}/bin/ptt`);
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error(`Failed to find binary for ${packageName}`);
|
|
29
|
+
console.error(`This usually means the optional dependency failed to install.`);
|
|
30
|
+
console.error(`Try running: npm install ${packageName}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Spawn the native binary with all arguments and I/O forwarded
|
|
35
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Forward exit code
|
|
40
|
+
child.on('exit', (code, signal) => {
|
|
41
|
+
if (signal) {
|
|
42
|
+
process.kill(process.pid, signal);
|
|
43
|
+
} else {
|
|
44
|
+
process.exit(code);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Handle errors
|
|
49
|
+
child.on('error', (err) => {
|
|
50
|
+
console.error(`Failed to execute ptt: ${err.message}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atarek/ptt",
|
|
3
|
+
"version": "0.1.0-beta",
|
|
4
|
+
"description": "ptt: a potato worktree manager - fast, intuitive git worktree management",
|
|
5
|
+
"repository": "github:a-tarek/ptt",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ptt": "bin/ptt"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/ptt"
|
|
12
|
+
],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@atarek/ptt-darwin-arm64": "0.1.0-beta",
|
|
15
|
+
"@atarek/ptt-darwin-amd64": "0.1.0-beta",
|
|
16
|
+
"@atarek/ptt-linux-amd64": "0.1.0-beta",
|
|
17
|
+
"@atarek/ptt-linux-arm64": "0.1.0-beta"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
}
|
|
22
|
+
}
|