@comet/cli 7.16.0-canary-20250303141103 → 8.0.0-beta.1
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/comet.js +1 -1
- package/lib/commands/generate-block-types.js +8 -6
- package/lib/commands/site-configs.js +25 -17
- package/lib/index.js +1 -1
- package/lib/site-configs.types.js +1 -1
- package/package.json +13 -16
package/lib/comet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var commander_1 = require("commander");
|
|
4
4
|
var generate_block_types_1 = require("./commands/generate-block-types");
|
|
5
5
|
var site_configs_1 = require("./commands/site-configs");
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
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);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
exports
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.generateBlockTypes = void 0;
|
|
51
51
|
var commander_1 = require("commander");
|
|
52
52
|
var promises_1 = require("fs/promises");
|
|
@@ -78,7 +78,7 @@ function writeFieldType(field, blockNamePostfix) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
else if (field.kind === "Enum") {
|
|
81
|
-
content += "\"".concat(field
|
|
81
|
+
content += "\"".concat(field.enum.join('" | "'), "\"");
|
|
82
82
|
}
|
|
83
83
|
else if (field.kind === "Block") {
|
|
84
84
|
content += "".concat(field.block).concat(blockNamePostfix);
|
|
@@ -162,9 +162,11 @@ var generateBlockTypes = new commander_1.Command("generate-block-types")
|
|
|
162
162
|
return [4 /*yield*/, (0, prettier_1.resolveConfig)(process.cwd())];
|
|
163
163
|
case 2:
|
|
164
164
|
prettierOptions = _a.sent();
|
|
165
|
-
|
|
166
|
-
return [4 /*yield*/, (0, promises_1.writeFile)(options.outputFile, content)];
|
|
165
|
+
return [4 /*yield*/, (0, prettier_1.format)(content, __assign(__assign({}, prettierOptions), { parser: "typescript" }))];
|
|
167
166
|
case 3:
|
|
167
|
+
content = _a.sent();
|
|
168
|
+
return [4 /*yield*/, (0, promises_1.writeFile)(options.outputFile, content)];
|
|
169
|
+
case 4:
|
|
168
170
|
_a.sent();
|
|
169
171
|
return [2 /*return*/];
|
|
170
172
|
}
|
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
36
46
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
47
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
48
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,8 +53,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
53
|
});
|
|
44
54
|
};
|
|
45
55
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g =
|
|
56
|
+
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);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
58
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
59
|
function step(op) {
|
|
50
60
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -92,13 +102,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
92
102
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
93
103
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
94
104
|
};
|
|
95
|
-
exports
|
|
105
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
96
106
|
exports.injectSiteConfigsCommand = void 0;
|
|
97
107
|
/* eslint-disable no-console */
|
|
98
108
|
var commander_1 = require("commander");
|
|
99
109
|
var fs_1 = __importDefault(require("fs"));
|
|
100
110
|
var path_1 = require("path");
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
111
|
exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs")
|
|
103
112
|
.description("Inject site-configs into a file")
|
|
104
113
|
.requiredOption("-i, --in-file <file>", "The filename of a template file to inject.")
|
|
@@ -109,15 +118,14 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
|
109
118
|
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
119
|
var configFile, getSiteConfigs, str, getUrlFromDomain, replacerFunctions;
|
|
111
120
|
return __generator(this, function (_a) {
|
|
112
|
-
var _b;
|
|
113
121
|
switch (_a.label) {
|
|
114
122
|
case 0:
|
|
115
123
|
configFile = "".concat(process.cwd(), "/").concat(options.siteConfigFile || "site-configs.ts");
|
|
116
|
-
return [4 /*yield*/,
|
|
124
|
+
return [4 /*yield*/, Promise.resolve("".concat(configFile)).then(function (s) { return __importStar(require(s)); })];
|
|
117
125
|
case 1:
|
|
118
|
-
getSiteConfigs = (_a.sent())
|
|
126
|
+
getSiteConfigs = (_a.sent()).default;
|
|
119
127
|
console.log("inject-site-configs: Replace site-configs in ".concat(options.inFile));
|
|
120
|
-
str = fs_1
|
|
128
|
+
str = fs_1.default.readFileSync((0, path_1.resolve)(process.cwd(), options.inFile)).toString();
|
|
121
129
|
getUrlFromDomain = function (domain) {
|
|
122
130
|
return domain.includes("localhost") ? "http://".concat(domain) : "https://".concat(domain);
|
|
123
131
|
};
|
|
@@ -136,7 +144,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
|
136
144
|
var _a;
|
|
137
145
|
return (__assign(__assign({}, siteConfig.public), { name: siteConfig.name, domains: siteConfig.domains, preloginEnabled: siteConfig.preloginEnabled || false, url: getUrlFromDomain((_a = siteConfig.domains.preliminary) !== null && _a !== void 0 ? _a : siteConfig.domains.main) }));
|
|
138
146
|
});
|
|
139
|
-
}
|
|
147
|
+
},
|
|
140
148
|
};
|
|
141
149
|
str = str.replace(/"({{ site:\/\/configs\/.*\/.* }})"/g, "'$1'"); // convert to single quotes
|
|
142
150
|
return [4 /*yield*/, replaceAsync(str, RegExp("{{ site://configs/(.*)/(.*) }}", "g"), function (substr, type, env) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -186,7 +194,7 @@ exports.injectSiteConfigsCommand = new commander_1.Command("inject-site-configs"
|
|
|
186
194
|
}); })];
|
|
187
195
|
case 3:
|
|
188
196
|
str = _a.sent();
|
|
189
|
-
fs_1
|
|
197
|
+
fs_1.default.writeFileSync((0, path_1.resolve)(process.cwd(), options.outFile), str);
|
|
190
198
|
return [2 /*return*/];
|
|
191
199
|
}
|
|
192
200
|
});
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.1",
|
|
4
4
|
"repository": {
|
|
5
|
+
"directory": "packages/cli",
|
|
5
6
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/vivid-planet/comet"
|
|
7
|
-
"directory": "packages/cli"
|
|
7
|
+
"url": "https://github.com/vivid-planet/comet"
|
|
8
8
|
},
|
|
9
9
|
"license": "BSD-2-Clause",
|
|
10
10
|
"main": "lib/index.js",
|
|
@@ -17,20 +17,17 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"commander": "^9.
|
|
21
|
-
"prettier": "^
|
|
20
|
+
"commander": "^9.5.0",
|
|
21
|
+
"prettier": "^3.5.3",
|
|
22
|
+
"ts-node": "^10.9.2"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@comet/eslint-config": "
|
|
25
|
-
"@types/node": "^22.
|
|
26
|
-
"eslint": "^
|
|
27
|
-
"npm-run-
|
|
28
|
-
"rimraf": "^
|
|
29
|
-
"
|
|
30
|
-
"typescript": "^4.0.0"
|
|
31
|
-
},
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"ts-node": "^10.9.1"
|
|
25
|
+
"@comet/eslint-config": "^8.0.0-beta.1",
|
|
26
|
+
"@types/node": "^22.13.8",
|
|
27
|
+
"eslint": "^9.20.1",
|
|
28
|
+
"npm-run-all2": "^5.0.2",
|
|
29
|
+
"rimraf": "^6.0.1",
|
|
30
|
+
"typescript": "^5.7.3"
|
|
34
31
|
},
|
|
35
32
|
"publishConfig": {
|
|
36
33
|
"access": "public",
|
|
@@ -41,7 +38,7 @@
|
|
|
41
38
|
"clean": "rimraf lib",
|
|
42
39
|
"dev": "tsc --watch",
|
|
43
40
|
"lint": "run-p lint:prettier lint:eslint lint:tsc",
|
|
44
|
-
"lint:eslint": "eslint --max-warnings 0 src/
|
|
41
|
+
"lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
|
|
45
42
|
"lint:prettier": "npx prettier --check './**/*.{js,json,md,yml,yaml}'",
|
|
46
43
|
"lint:tsc": "tsc"
|
|
47
44
|
}
|