@comet/cli 9.0.0-canary-20251002124333 → 9.0.0-canary-20251113142723
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/lib/BlockMeta.d.ts +1 -0
- package/lib/comet.js +4 -0
- package/lib/commands/download-mitmproxy.d.ts +2 -0
- package/lib/commands/download-mitmproxy.js +185 -0
- package/lib/commands/download-oauth2-proxy.d.ts +2 -0
- package/lib/commands/download-oauth2-proxy.js +182 -0
- package/lib/commands/generate-block-types.js +2 -1
- package/package.json +6 -5
package/lib/BlockMeta.d.ts
CHANGED
package/lib/comet.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var commander_1 = require("commander");
|
|
4
|
+
var download_mitmproxy_1 = require("./commands/download-mitmproxy");
|
|
5
|
+
var download_oauth2_proxy_1 = require("./commands/download-oauth2-proxy");
|
|
4
6
|
var generate_block_types_1 = require("./commands/generate-block-types");
|
|
5
7
|
var site_configs_1 = require("./commands/site-configs");
|
|
6
8
|
var program = new commander_1.Command();
|
|
7
9
|
program.addCommand(generate_block_types_1.generateBlockTypes);
|
|
8
10
|
program.addCommand(site_configs_1.injectSiteConfigsCommand);
|
|
11
|
+
program.addCommand(download_oauth2_proxy_1.downloadOAuth2ProxyCommand);
|
|
12
|
+
program.addCommand(download_mitmproxy_1.downloadMitmproxyCommand);
|
|
9
13
|
program.parse();
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
+
function step(op) {
|
|
49
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
+
switch (op[0]) {
|
|
54
|
+
case 0: case 1: t = op; break;
|
|
55
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
+
default:
|
|
59
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
+
if (t[2]) _.ops.pop();
|
|
64
|
+
_.trys.pop(); continue;
|
|
65
|
+
}
|
|
66
|
+
op = body.call(thisArg, _);
|
|
67
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
+
exports.downloadMitmproxyCommand = void 0;
|
|
73
|
+
/* eslint-disable no-console */
|
|
74
|
+
var child_process_1 = require("child_process");
|
|
75
|
+
var commander_1 = require("commander");
|
|
76
|
+
var fs = __importStar(require("fs"));
|
|
77
|
+
var os = __importStar(require("os"));
|
|
78
|
+
var semver = __importStar(require("semver"));
|
|
79
|
+
function getPlatform() {
|
|
80
|
+
var platform = os.platform();
|
|
81
|
+
switch (platform) {
|
|
82
|
+
case "linux":
|
|
83
|
+
return "linux";
|
|
84
|
+
case "darwin":
|
|
85
|
+
return "macos";
|
|
86
|
+
case "win32":
|
|
87
|
+
return "windows";
|
|
88
|
+
default:
|
|
89
|
+
throw new Error("Unsupported platform: ".concat(platform));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function getArchitecture() {
|
|
93
|
+
var arch = os.arch();
|
|
94
|
+
switch (arch) {
|
|
95
|
+
case "x64":
|
|
96
|
+
return "x86_64";
|
|
97
|
+
case "arm64":
|
|
98
|
+
return "arm64";
|
|
99
|
+
default:
|
|
100
|
+
throw new Error("Unsupported architecture: ".concat(arch));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
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
|
+
exports.downloadMitmproxyCommand = new commander_1.Command("download-mitmproxy")
|
|
122
|
+
.description("Download the Mitmproxy binary")
|
|
123
|
+
.requiredOption("-v, --version <version>", "Specify the version of the Mitmproxy to download (semver, e.g. >=7.0.0 <8.0.0).")
|
|
124
|
+
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
+
var releases, validReleases, latest, version, platform, architecture, downloadUrl, baseDir, dirname, existingFiles, _i, existingFiles_1, file, filename;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
console.log("=== Installing mitmproxy ===");
|
|
130
|
+
// Get latest version from GitHub API
|
|
131
|
+
console.log("Fetching release list...");
|
|
132
|
+
return [4 /*yield*/, fetchJson("https://api.github.com/repos/mitmproxy/mitmproxy/releases")];
|
|
133
|
+
case 1:
|
|
134
|
+
releases = _a.sent();
|
|
135
|
+
if (!releases)
|
|
136
|
+
throw new Error("Could not determine latest version");
|
|
137
|
+
validReleases = releases
|
|
138
|
+
.filter(function (r) { return !r.draft && !r.prerelease; })
|
|
139
|
+
.filter(function (r) {
|
|
140
|
+
var version = semver.coerce(r.tag_name);
|
|
141
|
+
return version ? semver.satisfies(version, options.version) : false;
|
|
142
|
+
})
|
|
143
|
+
.sort(function (a, b) {
|
|
144
|
+
var va = semver.coerce(a.tag_name);
|
|
145
|
+
var vb = semver.coerce(b.tag_name);
|
|
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.replace(/^v/, "");
|
|
153
|
+
platform = getPlatform();
|
|
154
|
+
architecture = getArchitecture();
|
|
155
|
+
downloadUrl = "https://downloads.mitmproxy.org/".concat(version, "/mitmproxy-").concat(version, "-").concat(platform, "-").concat(architecture, ".").concat(platform == "windows" ? "zip" : "tar.gz");
|
|
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*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}); });
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
+
function step(op) {
|
|
49
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
+
switch (op[0]) {
|
|
54
|
+
case 0: case 1: t = op; break;
|
|
55
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
+
default:
|
|
59
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
+
if (t[2]) _.ops.pop();
|
|
64
|
+
_.trys.pop(); continue;
|
|
65
|
+
}
|
|
66
|
+
op = body.call(thisArg, _);
|
|
67
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
+
exports.downloadOAuth2ProxyCommand = void 0;
|
|
73
|
+
/* eslint-disable no-console */
|
|
74
|
+
var child_process_1 = require("child_process");
|
|
75
|
+
var commander_1 = require("commander");
|
|
76
|
+
var fs = __importStar(require("fs"));
|
|
77
|
+
var os = __importStar(require("os"));
|
|
78
|
+
var semver = __importStar(require("semver"));
|
|
79
|
+
function getPlatform() {
|
|
80
|
+
var platform = os.platform();
|
|
81
|
+
switch (platform) {
|
|
82
|
+
case "linux":
|
|
83
|
+
return "linux";
|
|
84
|
+
case "darwin":
|
|
85
|
+
return "darwin";
|
|
86
|
+
case "win32":
|
|
87
|
+
return "windows";
|
|
88
|
+
default:
|
|
89
|
+
throw new Error("Unsupported platform: ".concat(platform));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function getArchitecture() {
|
|
93
|
+
var arch = os.arch();
|
|
94
|
+
switch (arch) {
|
|
95
|
+
case "x64":
|
|
96
|
+
return "amd64";
|
|
97
|
+
case "arm64":
|
|
98
|
+
return "arm64";
|
|
99
|
+
default:
|
|
100
|
+
throw new Error("Unsupported architecture: ".concat(arch));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
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
|
+
exports.downloadOAuth2ProxyCommand = new commander_1.Command("download-oauth2-proxy")
|
|
122
|
+
.description("Download the OAuth2 Proxy binary")
|
|
123
|
+
.requiredOption("-v, --version <version>", "Specify the version of the OAuth2 Proxy to download (semver, e.g. >=7.0.0 <8.0.0).")
|
|
124
|
+
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
125
|
+
var releases, validReleases, latest, version, platform, architecture, asset, baseDir, dirname, existingFiles, _i, existingFiles_1, file, filename;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
console.log("=== Installing oauth2-proxy ===");
|
|
130
|
+
// Get latest version from GitHub API
|
|
131
|
+
console.log("Fetching release list...");
|
|
132
|
+
return [4 /*yield*/, fetchJson("https://api.github.com/repos/oauth2-proxy/oauth2-proxy/releases")];
|
|
133
|
+
case 1:
|
|
134
|
+
releases = _a.sent();
|
|
135
|
+
if (!releases)
|
|
136
|
+
throw new Error("Could not determine latest version");
|
|
137
|
+
validReleases = releases
|
|
138
|
+
.filter(function (r) { return !r.draft && !r.prerelease; })
|
|
139
|
+
.filter(function (r) {
|
|
140
|
+
var version = semver.coerce(r.tag_name);
|
|
141
|
+
return version ? semver.satisfies(version, options.version) : false;
|
|
142
|
+
})
|
|
143
|
+
.sort(function (a, b) {
|
|
144
|
+
var va = semver.coerce(a.tag_name);
|
|
145
|
+
var vb = semver.coerce(b.tag_name);
|
|
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*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); });
|
|
@@ -78,7 +78,8 @@ function writeFieldType(field, blockNamePostfix) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
else if (field.kind === "Enum") {
|
|
81
|
-
|
|
81
|
+
var enumType = "\"".concat(field.enum.join('" | "'), "\"");
|
|
82
|
+
content += field.array ? "(".concat(enumType, ")[]") : enumType;
|
|
82
83
|
}
|
|
83
84
|
else if (field.kind === "Block") {
|
|
84
85
|
content += "".concat(field.block).concat(blockNamePostfix);
|
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-20251113142723",
|
|
4
4
|
"description": "A collection of CLI tools for Comet projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/cli",
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"commander": "^9.5.0",
|
|
23
23
|
"prettier": "^3.6.2",
|
|
24
|
+
"semver": "^7.7.3",
|
|
24
25
|
"ts-node": "^10.9.2"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@types/node": "^
|
|
28
|
+
"@types/node": "^24.9.1",
|
|
28
29
|
"eslint": "^9.30.1",
|
|
29
30
|
"npm-run-all2": "^8.0.0",
|
|
30
31
|
"rimraf": "^6.0.1",
|
|
31
32
|
"typescript": "5.8.3",
|
|
32
|
-
"@comet/eslint-config": "9.0.0-canary-
|
|
33
|
+
"@comet/eslint-config": "9.0.0-canary-20251113142723"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
36
|
"node": ">=22.0.0"
|
|
@@ -39,12 +40,12 @@
|
|
|
39
40
|
"registry": "https://registry.npmjs.org"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
+
"build": "pnpm run clean && tsc",
|
|
43
44
|
"clean": "rimraf lib",
|
|
44
45
|
"dev": "tsc --watch",
|
|
45
46
|
"lint": "run-p lint:prettier lint:eslint lint:tsc",
|
|
46
47
|
"lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
|
|
47
|
-
"lint:prettier": "
|
|
48
|
+
"lint:prettier": "pnpm exec prettier --check './**/*.{js,json,md,yml,yaml}'",
|
|
48
49
|
"lint:tsc": "tsc"
|
|
49
50
|
}
|
|
50
51
|
}
|