zonepm 0.0.1 → 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/zpm +39 -0
- package/package.json +15 -9
package/bin/zpm
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
const PLATFORMS = {
|
|
7
|
+
"darwin-arm64": "@zonepm/darwin-arm64",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
11
|
+
const pkgName = PLATFORMS[platformKey];
|
|
12
|
+
|
|
13
|
+
if (!pkgName) {
|
|
14
|
+
console.error(`Unsupported platform: ${platformKey}`);
|
|
15
|
+
console.error(`Supported: ${Object.keys(PLATFORMS).join(", ")}`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let binPath;
|
|
20
|
+
try {
|
|
21
|
+
const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
22
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
23
|
+
binPath = path.join(pkgDir, `zpm${ext}`);
|
|
24
|
+
} catch {
|
|
25
|
+
console.error(`Could not find package ${pkgName}.`);
|
|
26
|
+
console.error(`Make sure it was installed — try reinstalling zonepm.`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!fs.existsSync(binPath)) {
|
|
31
|
+
console.error(`Binary not found at ${binPath}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const result = require("child_process").spawnSync(binPath, process.argv.slice(2), {
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zonepm",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A minimal npm package manager written in Rust",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/yangshun/zonepm.git"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bin": {
|
|
11
|
+
"zpm": "bin/zpm"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@zonepm/darwin-arm64": "0.1.0"
|
|
18
|
+
}
|
|
13
19
|
}
|