@cj-ways/orgclone 0.2.1 → 0.4.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 -2
- package/package.json +2 -2
package/install.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const https = require("https");
|
|
8
|
+
const http = require("http");
|
|
8
9
|
const fs = require("fs");
|
|
9
10
|
const path = require("path");
|
|
10
11
|
const os = require("os");
|
|
@@ -31,8 +32,9 @@ function getPlatformTarget() {
|
|
|
31
32
|
function download(url, dest) {
|
|
32
33
|
return new Promise((resolve, reject) => {
|
|
33
34
|
const follow = (u) => {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const client = u.startsWith("https") ? https : http;
|
|
36
|
+
client.get(u, { headers: { "User-Agent": "orgclone-installer" } }, (res) => {
|
|
37
|
+
if ([301, 302, 303].includes(res.statusCode)) return follow(res.headers.location);
|
|
36
38
|
if (res.statusCode !== 200) return reject(new Error(`HTTP ${res.statusCode}`));
|
|
37
39
|
const file = fs.createWriteStream(dest);
|
|
38
40
|
res.pipe(file);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-ways/orgclone",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"binaryVersion": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"binaryVersion": "0.4.0",
|
|
5
5
|
"description": "Clone entire GitHub organizations or GitLab groups with one command. Supports public and private repos, SSH, token auth, and config files.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "cj-ways",
|