@comet/cli 9.0.0-canary-20260121091644 → 9.0.0-canary-20260121104514
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.
|
@@ -75,7 +75,6 @@ var child_process_1 = require("child_process");
|
|
|
75
75
|
var commander_1 = require("commander");
|
|
76
76
|
var fs = __importStar(require("fs"));
|
|
77
77
|
var os = __importStar(require("os"));
|
|
78
|
-
var semver = __importStar(require("semver"));
|
|
79
78
|
function getPlatform() {
|
|
80
79
|
var platform = os.platform();
|
|
81
80
|
switch (platform) {
|
|
@@ -100,86 +99,43 @@ function getArchitecture() {
|
|
|
100
99
|
throw new Error("Unsupported architecture: ".concat(arch));
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
function fetchJson(url) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var res;
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, fetch(url, {
|
|
109
|
-
headers: { "User-Agent": "Node.js" },
|
|
110
|
-
})];
|
|
111
|
-
case 1:
|
|
112
|
-
res = _a.sent();
|
|
113
|
-
if (!res.ok) {
|
|
114
|
-
throw new Error("Failed to fetch ".concat(url, ": ").concat(res.status, " ").concat(res.statusText));
|
|
115
|
-
}
|
|
116
|
-
return [2 /*return*/, res.json()];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
102
|
exports.downloadMitmproxyCommand = new commander_1.Command("download-mitmproxy")
|
|
122
103
|
.description("Download the Mitmproxy binary")
|
|
123
|
-
.requiredOption("-v, --version <version>", "Specify the version of the Mitmproxy to download (
|
|
104
|
+
.requiredOption("-v, --version <version>", "Specify the version of the Mitmproxy to download (e.g. v12.2.0).")
|
|
124
105
|
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
-
var
|
|
106
|
+
var version, platform, architecture, downloadUrl, baseDir, dirname, existingFiles, _i, existingFiles_1, file, filename;
|
|
126
107
|
return __generator(this, function (_a) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
baseDir = "".concat(process.cwd(), "/node_modules");
|
|
157
|
-
dirname = "mitmproxy-".concat(version, ".").concat(platform, "-").concat(architecture);
|
|
158
|
-
existingFiles = fs.readdirSync(baseDir).filter(function (f) { return f.startsWith("mitmproxy-") && f !== dirname; });
|
|
159
|
-
for (_i = 0, existingFiles_1 = existingFiles; _i < existingFiles_1.length; _i++) {
|
|
160
|
-
file = existingFiles_1[_i];
|
|
161
|
-
console.log("Deleting old version: ".concat(file));
|
|
162
|
-
fs.rmSync("".concat(baseDir, "/").concat(file), { recursive: true, force: true });
|
|
163
|
-
}
|
|
164
|
-
filename = "".concat(baseDir, "/").concat(dirname);
|
|
165
|
-
if (fs.existsSync(filename)) {
|
|
166
|
-
console.log("Mitmproxy version ".concat(version, " already installed."));
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
console.log("Downloading and extracting Mitmproxy version ".concat(version, "..."));
|
|
170
|
-
fs.mkdirSync("".concat(baseDir, "/").concat(dirname), { recursive: true });
|
|
171
|
-
(0, child_process_1.execSync)("curl -s -L ".concat(downloadUrl, " | tar xvfz - -C ").concat(baseDir, "/").concat(dirname), { stdio: "inherit" });
|
|
172
|
-
}
|
|
173
|
-
// Create symlink to have a consistent name
|
|
174
|
-
console.log("Create symlink to mitmweb binary on ".concat(baseDir, "/.bin/mitmweb"));
|
|
175
|
-
if (os.platform() === "darwin") {
|
|
176
|
-
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/mitmproxy.app/Contents/MacOS/mitmweb ").concat(baseDir, "/.bin/mitmweb"));
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/mitmweb ").concat(baseDir, "/.bin/mitmweb"));
|
|
180
|
-
}
|
|
181
|
-
console.log("=== Finished installing Mitmproxy ===");
|
|
182
|
-
return [2 /*return*/];
|
|
108
|
+
console.log("=== Installing mitmproxy ===");
|
|
109
|
+
version = options.version;
|
|
110
|
+
platform = getPlatform();
|
|
111
|
+
architecture = getArchitecture();
|
|
112
|
+
downloadUrl = "https://downloads.mitmproxy.org/".concat(version, "/mitmproxy-").concat(version, "-").concat(platform, "-").concat(architecture, ".").concat(platform == "windows" ? "zip" : "tar.gz");
|
|
113
|
+
baseDir = "".concat(process.cwd(), "/node_modules");
|
|
114
|
+
dirname = "mitmproxy-".concat(version, ".").concat(platform, "-").concat(architecture);
|
|
115
|
+
existingFiles = fs.readdirSync(baseDir).filter(function (f) { return f.startsWith("mitmproxy-") && f !== dirname; });
|
|
116
|
+
for (_i = 0, existingFiles_1 = existingFiles; _i < existingFiles_1.length; _i++) {
|
|
117
|
+
file = existingFiles_1[_i];
|
|
118
|
+
console.log("Deleting old version: ".concat(file));
|
|
119
|
+
fs.rmSync("".concat(baseDir, "/").concat(file), { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
filename = "".concat(baseDir, "/").concat(dirname);
|
|
122
|
+
if (fs.existsSync(filename)) {
|
|
123
|
+
console.log("Mitmproxy version ".concat(version, " already installed."));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log("Downloading and extracting Mitmproxy version ".concat(version, "..."));
|
|
127
|
+
fs.mkdirSync("".concat(baseDir, "/").concat(dirname), { recursive: true });
|
|
128
|
+
(0, child_process_1.execSync)("curl -s -L ".concat(downloadUrl, " | tar xvfz - -C ").concat(baseDir, "/").concat(dirname), { stdio: "inherit" });
|
|
129
|
+
}
|
|
130
|
+
// Create symlink to have a consistent name
|
|
131
|
+
console.log("Create symlink to mitmweb binary on ".concat(baseDir, "/.bin/mitmweb"));
|
|
132
|
+
if (os.platform() === "darwin") {
|
|
133
|
+
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/mitmproxy.app/Contents/MacOS/mitmweb ").concat(baseDir, "/.bin/mitmweb"));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/mitmweb ").concat(baseDir, "/.bin/mitmweb"));
|
|
183
137
|
}
|
|
138
|
+
console.log("=== Finished installing Mitmproxy ===");
|
|
139
|
+
return [2 /*return*/];
|
|
184
140
|
});
|
|
185
141
|
}); });
|
|
@@ -75,7 +75,6 @@ var child_process_1 = require("child_process");
|
|
|
75
75
|
var commander_1 = require("commander");
|
|
76
76
|
var fs = __importStar(require("fs"));
|
|
77
77
|
var os = __importStar(require("os"));
|
|
78
|
-
var semver = __importStar(require("semver"));
|
|
79
78
|
function getPlatform() {
|
|
80
79
|
var platform = os.platform();
|
|
81
80
|
switch (platform) {
|
|
@@ -100,83 +99,36 @@ function getArchitecture() {
|
|
|
100
99
|
throw new Error("Unsupported architecture: ".concat(arch));
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
function fetchJson(url) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var res;
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, fetch(url, {
|
|
109
|
-
headers: { "User-Agent": "Node.js" },
|
|
110
|
-
})];
|
|
111
|
-
case 1:
|
|
112
|
-
res = _a.sent();
|
|
113
|
-
if (!res.ok) {
|
|
114
|
-
throw new Error("Failed to fetch ".concat(url, ": ").concat(res.status, " ").concat(res.statusText));
|
|
115
|
-
}
|
|
116
|
-
return [2 /*return*/, res.json()];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
102
|
exports.downloadOAuth2ProxyCommand = new commander_1.Command("download-oauth2-proxy")
|
|
122
103
|
.description("Download the OAuth2 Proxy binary")
|
|
123
|
-
.requiredOption("-v, --version <version>", "Specify the version of the OAuth2 Proxy to download (
|
|
104
|
+
.requiredOption("-v, --version <version>", "Specify the version of the OAuth2 Proxy to download (e.g. v7.12.0).")
|
|
124
105
|
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
-
var
|
|
106
|
+
var version, platform, architecture, baseDir, dirname, existingFiles, _i, existingFiles_1, file, filename;
|
|
126
107
|
return __generator(this, function (_a) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return semver.rcompare(va, vb);
|
|
147
|
-
});
|
|
148
|
-
if (validReleases.length === 0) {
|
|
149
|
-
throw new Error("No releases found for version range ".concat(options.version));
|
|
150
|
-
}
|
|
151
|
-
latest = validReleases[0];
|
|
152
|
-
version = latest.tag_name;
|
|
153
|
-
platform = getPlatform();
|
|
154
|
-
architecture = getArchitecture();
|
|
155
|
-
asset = latest.assets.find(function (a) { return a.name.match(new RegExp("".concat(platform, "-").concat(architecture, ".*(tar\\.gz|zip)$"), "i")); });
|
|
156
|
-
if (!asset) {
|
|
157
|
-
throw new Error("No matching binary found for ".concat(platform, "-").concat(architecture, " in release ").concat(latest.tag_name));
|
|
158
|
-
}
|
|
159
|
-
baseDir = "".concat(process.cwd(), "/node_modules");
|
|
160
|
-
dirname = "oauth2-proxy-".concat(version, ".").concat(platform, "-").concat(architecture);
|
|
161
|
-
existingFiles = fs.readdirSync(baseDir).filter(function (f) { return f.startsWith("oauth2-proxy-v") && f !== dirname; });
|
|
162
|
-
for (_i = 0, existingFiles_1 = existingFiles; _i < existingFiles_1.length; _i++) {
|
|
163
|
-
file = existingFiles_1[_i];
|
|
164
|
-
console.log("Deleting old version: ".concat(file));
|
|
165
|
-
fs.rmSync("".concat(baseDir, "/").concat(file), { recursive: true, force: true });
|
|
166
|
-
}
|
|
167
|
-
filename = "".concat(baseDir, "/").concat(dirname, "/oauth2-proxy");
|
|
168
|
-
if (fs.existsSync(filename)) {
|
|
169
|
-
console.log("OAuth2-Proxy version ".concat(version, " already installed."));
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
console.log("Downloading and extracting OAuth2-Proxy version ".concat(version, "..."));
|
|
173
|
-
(0, child_process_1.execSync)("curl -s -L ".concat(asset.browser_download_url, " | tar xvfz - -C ").concat(baseDir), { stdio: "inherit" });
|
|
174
|
-
}
|
|
175
|
-
// Create symlink to have a consistent name
|
|
176
|
-
console.log("Create symlink to oauth2-proxy binary on ".concat(baseDir, "/.bin/oauth2-proxy"));
|
|
177
|
-
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/oauth2-proxy ").concat(baseDir, "/.bin/oauth2-proxy"));
|
|
178
|
-
console.log("=== Finished installing OAuth2-Proxy ===");
|
|
179
|
-
return [2 /*return*/];
|
|
108
|
+
console.log("=== Installing oauth2-proxy ===");
|
|
109
|
+
version = options.version;
|
|
110
|
+
platform = getPlatform();
|
|
111
|
+
architecture = getArchitecture();
|
|
112
|
+
baseDir = "".concat(process.cwd(), "/node_modules");
|
|
113
|
+
dirname = "oauth2-proxy-".concat(version, ".").concat(platform, "-").concat(architecture);
|
|
114
|
+
existingFiles = fs.readdirSync(baseDir).filter(function (f) { return f.startsWith("oauth2-proxy-v") && f !== dirname; });
|
|
115
|
+
for (_i = 0, existingFiles_1 = existingFiles; _i < existingFiles_1.length; _i++) {
|
|
116
|
+
file = existingFiles_1[_i];
|
|
117
|
+
console.log("Deleting old version: ".concat(file));
|
|
118
|
+
fs.rmSync("".concat(baseDir, "/").concat(file), { recursive: true, force: true });
|
|
119
|
+
}
|
|
120
|
+
filename = "".concat(baseDir, "/").concat(dirname, "/oauth2-proxy");
|
|
121
|
+
if (fs.existsSync(filename)) {
|
|
122
|
+
console.log("OAuth2-Proxy version ".concat(version, " already installed."));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
console.log("Downloading and extracting OAuth2-Proxy version ".concat(version, "..."));
|
|
126
|
+
(0, child_process_1.execSync)("curl -s -L https://github.com/oauth2-proxy/oauth2-proxy/releases/download/".concat(version, "/oauth2-proxy-").concat(version, ".").concat(platform, "-").concat(architecture, ".tar.gz | tar xvfz - -C ").concat(baseDir), { stdio: "inherit" });
|
|
180
127
|
}
|
|
128
|
+
// Create symlink to have a consistent name
|
|
129
|
+
console.log("Create symlink to oauth2-proxy binary on ".concat(baseDir, "/.bin/oauth2-proxy"));
|
|
130
|
+
(0, child_process_1.execSync)("ln -sf ../".concat(dirname, "/oauth2-proxy ").concat(baseDir, "/.bin/oauth2-proxy"));
|
|
131
|
+
console.log("=== Finished installing OAuth2-Proxy ===");
|
|
132
|
+
return [2 /*return*/];
|
|
181
133
|
});
|
|
182
134
|
}); });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/cli",
|
|
3
|
-
"version": "9.0.0-canary-
|
|
3
|
+
"version": "9.0.0-canary-20260121104514",
|
|
4
4
|
"description": "A collection of CLI tools for Comet projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/cli",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"commander": "^9.5.0",
|
|
23
23
|
"prettier": "^3.6.2",
|
|
24
|
-
"semver": "^7.7.3",
|
|
25
24
|
"ts-node": "^10.9.2"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
"npm-run-all2": "^8.0.4",
|
|
31
30
|
"rimraf": "^6.1.2",
|
|
32
31
|
"typescript": "5.9.3",
|
|
33
|
-
"@comet/eslint-config": "9.0.0-canary-
|
|
32
|
+
"@comet/eslint-config": "9.0.0-canary-20260121104514"
|
|
34
33
|
},
|
|
35
34
|
"engines": {
|
|
36
35
|
"node": ">=22.0.0"
|