christ-cli 0.1.0 → 0.2.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/install.js +4 -20
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -30,25 +30,9 @@ function getPlatform() {
|
|
|
30
30
|
return { target, isWindows: platform === "win32" };
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
`https://api.github.com/repos/${REPO}/releases/latest`,
|
|
37
|
-
{ headers: { "User-Agent": "christ-cli-npm" } },
|
|
38
|
-
(res) => {
|
|
39
|
-
let data = "";
|
|
40
|
-
res.on("data", (chunk) => (data += chunk));
|
|
41
|
-
res.on("end", () => {
|
|
42
|
-
try {
|
|
43
|
-
const json = JSON.parse(data);
|
|
44
|
-
resolve(json.tag_name.replace("v", ""));
|
|
45
|
-
} catch (e) {
|
|
46
|
-
reject(e);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
).on("error", reject);
|
|
51
|
-
});
|
|
33
|
+
function getVersion() {
|
|
34
|
+
const pkg = require(path.join(__dirname, "package.json"));
|
|
35
|
+
return pkg.version;
|
|
52
36
|
}
|
|
53
37
|
|
|
54
38
|
function download(url, dest) {
|
|
@@ -74,7 +58,7 @@ function download(url, dest) {
|
|
|
74
58
|
|
|
75
59
|
async function main() {
|
|
76
60
|
const { target, isWindows } = getPlatform();
|
|
77
|
-
const version =
|
|
61
|
+
const version = getVersion();
|
|
78
62
|
const ext = isWindows ? "zip" : "tar.gz";
|
|
79
63
|
const url = `https://github.com/${REPO}/releases/download/v${version}/${BINARY}-${target}.${ext}`;
|
|
80
64
|
|