@comet/cli 8.0.0-canary-20241115114800 → 8.0.0-canary-20241119131900
Sign up to get free protection for your applications and to get access to all the features.
@@ -55,15 +55,27 @@ var content = "";
|
|
55
55
|
function writeFieldType(field, blockNamePostfix) {
|
56
56
|
if (field.kind === "String") {
|
57
57
|
content += "string";
|
58
|
+
if (field.array) {
|
59
|
+
content += "[]";
|
60
|
+
}
|
58
61
|
}
|
59
62
|
else if (field.kind === "Number") {
|
60
63
|
content += "number";
|
64
|
+
if (field.array) {
|
65
|
+
content += "[]";
|
66
|
+
}
|
61
67
|
}
|
62
68
|
else if (field.kind === "Boolean") {
|
63
69
|
content += "boolean";
|
70
|
+
if (field.array) {
|
71
|
+
content += "[]";
|
72
|
+
}
|
64
73
|
}
|
65
74
|
else if (field.kind === "Json") {
|
66
75
|
content += "unknown";
|
76
|
+
if (field.array) {
|
77
|
+
content += "[]";
|
78
|
+
}
|
67
79
|
}
|
68
80
|
else if (field.kind === "Enum") {
|
69
81
|
content += "\"".concat(field["enum"].join('" | "'), "\"");
|
@@ -107,15 +107,14 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
107
107
|
.option("-f, --site-config-file <file>", "Path to ts-file which provides a default export with (env: string) => SiteConfig[]")
|
108
108
|
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
109
109
|
var configFile, getSiteConfigs, str, getUrlFromDomain, replacerFunctions;
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
switch (_b.label) {
|
110
|
+
return __generator(this, function (_a) {
|
111
|
+
var _b;
|
112
|
+
switch (_a.label) {
|
114
113
|
case 0:
|
115
|
-
configFile =
|
116
|
-
return [4 /*yield*/, (
|
114
|
+
configFile = "".concat(process.cwd(), "/").concat(options.siteConfigFile || "site-configs.ts");
|
115
|
+
return [4 /*yield*/, (_b = configFile, Promise.resolve().then(function () { return __importStar(require(_b)); }))];
|
117
116
|
case 1:
|
118
|
-
getSiteConfigs = (
|
117
|
+
getSiteConfigs = (_a.sent())["default"];
|
119
118
|
console.log("inject-site-configs: Replace site-configs in ".concat(options.inFile));
|
120
119
|
str = fs_1["default"].readFileSync((0, path_1.resolve)(process.cwd(), options.inFile)).toString();
|
121
120
|
getUrlFromDomain = function (domain) {
|
@@ -159,7 +158,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
159
158
|
});
|
160
159
|
}); })];
|
161
160
|
case 2:
|
162
|
-
str =
|
161
|
+
str = _a.sent();
|
163
162
|
str = str.replace(/"({{ site:\/\/domains\/.*\/.* }})"/g, "$1"); // remove quotes in array
|
164
163
|
return [4 /*yield*/, replaceAsync(str, /{{ site:\/\/domains\/(site|prelogin)\/(.*) }}/g, function (substr, type, env) { return __awaiter(void 0, void 0, void 0, function () {
|
165
164
|
var siteConfigs, filteredSiteConfigs;
|
@@ -181,7 +180,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
181
180
|
});
|
182
181
|
}); })];
|
183
182
|
case 3:
|
184
|
-
str =
|
183
|
+
str = _a.sent();
|
185
184
|
fs_1["default"].writeFileSync((0, path_1.resolve)(process.cwd(), options.outFile), str);
|
186
185
|
return [2 /*return*/];
|
187
186
|
}
|
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-20241119131900",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "https://github.com/vivid-planet/comet",
|
@@ -21,8 +21,8 @@
|
|
21
21
|
"prettier": "^2.7.1"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
|
-
"@comet/eslint-config": "8.0.0-canary-
|
25
|
-
"@types/node": "^
|
24
|
+
"@comet/eslint-config": "8.0.0-canary-20241119131900",
|
25
|
+
"@types/node": "^22.0.0",
|
26
26
|
"eslint": "^8.0.0",
|
27
27
|
"npm-run-all": "^4.1.5",
|
28
28
|
"rimraf": "^3.0.0",
|