@comet/cli 8.0.0-canary-20250120103259 → 8.0.0-canary-20250120122614
Sign up to get free protection for your applications and to get access to all the features.
@@ -104,6 +104,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
104
104
|
.requiredOption("-i, --in-file <file>", "The filename of a template file to inject.")
|
105
105
|
.requiredOption("-o, --out-file <file>", "Write the injected template to a file.")
|
106
106
|
.option("-d --dotenv", "dotenv compatibility") // https://github.com/motdotla/dotenv/issues/521#issuecomment-999016064
|
107
|
+
.option("--base64", "use base64 encoding")
|
107
108
|
.option("-f, --site-config-file <file>", "Path to ts-file which provides a default export with (env: string) => SiteConfig[]")
|
108
109
|
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
109
110
|
var configFile, getSiteConfigs, str, getUrlFromDomain, replacerFunctions;
|
@@ -139,7 +140,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
139
140
|
};
|
140
141
|
str = str.replace(/"({{ site:\/\/configs\/.*\/.* }})"/g, "'$1'"); // convert to single quotes
|
141
142
|
return [4 /*yield*/, replaceAsync(str, RegExp("{{ site://configs/(.*)/(.*) }}", "g"), function (substr, type, env) { return __awaiter(void 0, void 0, void 0, function () {
|
142
|
-
var siteConfigs, ret;
|
143
|
+
var siteConfigs, str, ret;
|
143
144
|
return __generator(this, function (_a) {
|
144
145
|
switch (_a.label) {
|
145
146
|
case 0: return [4 /*yield*/, getSiteConfigs(env)];
|
@@ -150,7 +151,11 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
150
151
|
console.error("inject-site-configs: ERROR: type must be ".concat(Object.keys(replacerFunctions).join("|"), " (got ").concat(type, ")"));
|
151
152
|
return [2 /*return*/, substr];
|
152
153
|
}
|
153
|
-
|
154
|
+
str = replacerFunctions[type](siteConfigs, env);
|
155
|
+
if (options.base64) {
|
156
|
+
return [2 /*return*/, Buffer.from(JSON.stringify(str)).toString("base64")];
|
157
|
+
}
|
158
|
+
ret = JSON.stringify(str).replace(/\\/g, "\\\\");
|
154
159
|
if (options.dotenv)
|
155
160
|
return [2 /*return*/, ret.replace(/\$/g, "\\$")];
|
156
161
|
return [2 /*return*/, ret];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@comet/cli",
|
3
|
-
"version": "8.0.0-canary-
|
3
|
+
"version": "8.0.0-canary-20250120122614",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/vivid-planet/comet",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"prettier": "^2.8.8"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"@comet/eslint-config": "8.0.0-canary-
|
24
|
+
"@comet/eslint-config": "8.0.0-canary-20250120122614",
|
25
25
|
"@types/node": "^22.0.0",
|
26
26
|
"eslint": "^8.0.0",
|
27
27
|
"npm-run-all": "^4.1.5",
|