amae-cli 0.1.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/amae +58 -0
- package/package.json +21 -0
package/bin/amae
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const spawn = require('child_process').spawnSync;
|
|
6
|
+
|
|
7
|
+
const platform = process.platform;
|
|
8
|
+
const arch = process.arch;
|
|
9
|
+
|
|
10
|
+
const packageMap = {
|
|
11
|
+
'darwin-arm64': 'amae-darwin-arm64',
|
|
12
|
+
'darwin-x64': 'amae-darwin-x64',
|
|
13
|
+
'linux-x64': 'amae-linux-x64',
|
|
14
|
+
'win32-x64': 'amae-win32-x64'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const key = `${platform}-${arch}`;
|
|
18
|
+
const pkgName = packageMap[key];
|
|
19
|
+
|
|
20
|
+
if (!pkgName) {
|
|
21
|
+
console.error(`Unsupported platform/architecture: ${key}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let binName = platform === 'win32' ? 'amae.exe' : 'amae';
|
|
26
|
+
let binPath = '';
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
binPath = require.resolve(`${pkgName}/bin/${binName}`);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
const localPaths = [
|
|
32
|
+
path.join(__dirname, '..', 'node_modules', pkgName, 'bin', binName),
|
|
33
|
+
path.join(__dirname, '..', '..', pkgName, 'bin', binName)
|
|
34
|
+
];
|
|
35
|
+
for (const p of localPaths) {
|
|
36
|
+
if (fs.existsSync(p)) {
|
|
37
|
+
binPath = p;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!binPath || !fs.existsSync(binPath)) {
|
|
44
|
+
console.error(`Binary not found for ${pkgName}. Try reinstalling.`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const result = spawn(binPath, process.argv.slice(2), {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
windowsHide: true
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (result.error) {
|
|
54
|
+
console.error('Failed to run binary:', result.error);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
process.exit(result.status ?? 0);
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "amae-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Ultra-fast package manager for JS/TS written in Rust",
|
|
5
|
+
"bin": {
|
|
6
|
+
"amae": "bin/amae"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"package-manager",
|
|
10
|
+
"npm",
|
|
11
|
+
"rust",
|
|
12
|
+
"fast"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"optionalDependencies": {
|
|
16
|
+
"amae-darwin-arm64": "0.1.0",
|
|
17
|
+
"amae-darwin-x64": "0.1.0",
|
|
18
|
+
"amae-linux-x64": "0.1.0",
|
|
19
|
+
"amae-win32-x64": "0.1.0"
|
|
20
|
+
}
|
|
21
|
+
}
|