@comet/admin-generator 8.11.1-canary-20260114161223 → 8.11.1-canary-20260115100304
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/bin/admin-generator.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,10 +44,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
45
|
exports.parseConfig = parseConfig;
|
|
13
46
|
const fs_1 = require("fs");
|
|
14
|
-
const jiti_1 = require("jiti");
|
|
15
47
|
const path_1 = require("path");
|
|
16
48
|
const transformConfig_1 = require("./transformConfig");
|
|
17
|
-
const jiti = (0, jiti_1.createJiti)(__dirname);
|
|
18
49
|
function parseConfig(file) {
|
|
19
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
51
|
//1. parse config file using TypeScript Complier Api and transform it (replace imports and functions that can't be executed)
|
|
@@ -25,8 +56,11 @@ function parseConfig(file) {
|
|
|
25
56
|
//3. import (=execute) temp modified config file
|
|
26
57
|
let executedConfig;
|
|
27
58
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
59
|
+
const configFile = yield Promise.resolve(`${tempFileName.replace(/\.tsx?$/, "")}`).then(s => __importStar(require(s)));
|
|
60
|
+
if (!configFile.default) {
|
|
61
|
+
throw new Error(`No default export found in ${file}`);
|
|
62
|
+
}
|
|
63
|
+
executedConfig = configFile.default;
|
|
30
64
|
}
|
|
31
65
|
catch (e) {
|
|
32
66
|
console.error(e);
|
|
@@ -62,7 +62,7 @@ function runGenerate() {
|
|
|
62
62
|
const targetDirectory = `${(0, path_1.dirname)(file)}/generated`;
|
|
63
63
|
const baseOutputFilename = (0, path_1.basename)(file).replace(/\.cometGen\.tsx?$/, "");
|
|
64
64
|
console.log(`generating ${file}`);
|
|
65
|
-
const config = yield (0, parseConfig_1.parseConfig)(
|
|
65
|
+
const config = yield (0, parseConfig_1.parseConfig)(file);
|
|
66
66
|
const codeOuputFilename = `${targetDirectory}/${(0, path_1.basename)(file.replace(/\.cometGen\.tsx?$/, ""))}.tsx`;
|
|
67
67
|
yield fs_1.promises.rm(codeOuputFilename, { force: true });
|
|
68
68
|
const exportName = (_a = file.match(/([^/]+)\.cometGen\.tsx?$/)) === null || _a === void 0 ? void 0 : _a[1];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/admin-generator",
|
|
3
|
-
"version": "8.11.1-canary-
|
|
3
|
+
"version": "8.11.1-canary-20260115100304",
|
|
4
4
|
"description": "Comet Admin Generator CLI tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/admin/admin-generator",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"commander": "^9.5.0",
|
|
26
26
|
"glob": "^11.1.0",
|
|
27
27
|
"graphql": "^16.11.0",
|
|
28
|
-
"jiti": "^2.6.1",
|
|
29
28
|
"object-path": "^0.11.8",
|
|
30
|
-
"pluralize": "^8.0.0"
|
|
29
|
+
"pluralize": "^8.0.0",
|
|
30
|
+
"ts-node": "^10.9.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@apollo/client": "^3.14.0",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"rimraf": "^6.1.2",
|
|
47
47
|
"typescript": "5.9.3",
|
|
48
48
|
"vitest": "^4.0.16",
|
|
49
|
-
"@comet/admin": "8.11.1-canary-
|
|
50
|
-
"@comet/admin-icons": "8.11.1-canary-
|
|
51
|
-
"@comet/cms-admin": "8.11.1-canary-
|
|
52
|
-
"@comet/eslint-config": "8.11.1-canary-
|
|
49
|
+
"@comet/admin": "8.11.1-canary-20260115100304",
|
|
50
|
+
"@comet/admin-icons": "8.11.1-canary-20260115100304",
|
|
51
|
+
"@comet/cms-admin": "8.11.1-canary-20260115100304",
|
|
52
|
+
"@comet/eslint-config": "8.11.1-canary-20260115100304"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=22.0.0"
|