@comet/admin-generator 9.0.0-canary-20260113132154 → 9.0.0-canary-20260121085838
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.
|
@@ -16,15 +16,18 @@ exports.injectFormVariables = injectFormVariables;
|
|
|
16
16
|
exports.defineConfig = defineConfig;
|
|
17
17
|
const graphql_file_loader_1 = require("@graphql-tools/graphql-file-loader");
|
|
18
18
|
const load_1 = require("@graphql-tools/load");
|
|
19
|
+
const child_process_1 = require("child_process");
|
|
19
20
|
const commander_1 = require("commander");
|
|
20
21
|
const fs_1 = require("fs");
|
|
21
22
|
const glob_1 = require("glob");
|
|
22
23
|
const graphql_1 = require("graphql");
|
|
23
24
|
const path_1 = require("path");
|
|
25
|
+
const util_1 = require("util");
|
|
24
26
|
const parseConfig_1 = require("./config/parseConfig");
|
|
25
27
|
const generateForm_1 = require("./generateForm/generateForm");
|
|
26
28
|
const generateGrid_1 = require("./generateGrid/generateGrid");
|
|
27
29
|
const writeGenerated_1 = require("./utils/writeGenerated");
|
|
30
|
+
const exec = (0, util_1.promisify)(child_process_1.exec);
|
|
28
31
|
function isComponentFormFieldConfig(arg) {
|
|
29
32
|
return arg && arg.type === "component";
|
|
30
33
|
}
|
|
@@ -51,6 +54,7 @@ function runGenerate() {
|
|
|
51
54
|
loaders: [new graphql_file_loader_1.GraphQLFileLoader()],
|
|
52
55
|
});
|
|
53
56
|
const gqlIntrospection = (0, graphql_1.introspectionFromSchema)(schema);
|
|
57
|
+
const writtenFiles = [];
|
|
54
58
|
const files = yield (0, glob_1.glob)(filePattern);
|
|
55
59
|
for (const file of files) {
|
|
56
60
|
let outputCode = "";
|
|
@@ -80,6 +84,7 @@ function runGenerate() {
|
|
|
80
84
|
gqlDocumentsOutputCode += `${exportStatement} const ${queryName} = gql\`${generated.gqlDocuments[queryName].document}\`\n`;
|
|
81
85
|
}
|
|
82
86
|
yield (0, writeGenerated_1.writeGenerated)(codeOuputFilename, outputCode);
|
|
87
|
+
writtenFiles.push(codeOuputFilename);
|
|
83
88
|
if (gqlDocumentsOutputCode != "") {
|
|
84
89
|
const gqlDocumentsOuputFilename = `${targetDirectory}/${(0, path_1.basename)(file.replace(/\.cometGen\.tsx?$/, ""))}.gql.tsx`;
|
|
85
90
|
yield fs_1.promises.rm(gqlDocumentsOuputFilename, { force: true });
|
|
@@ -89,9 +94,14 @@ function runGenerate() {
|
|
|
89
94
|
${gqlDocumentsOutputCode}
|
|
90
95
|
`;
|
|
91
96
|
yield (0, writeGenerated_1.writeGenerated)(gqlDocumentsOuputFilename, gqlDocumentsOutputCode);
|
|
97
|
+
writtenFiles.push(gqlDocumentsOuputFilename);
|
|
92
98
|
}
|
|
93
99
|
console.log("");
|
|
94
100
|
}
|
|
101
|
+
if (writtenFiles.length > 0) {
|
|
102
|
+
console.log("Formatting generated files...");
|
|
103
|
+
yield exec(`./node_modules/.bin/prettier --write ${writtenFiles.join(" ")}`);
|
|
104
|
+
}
|
|
95
105
|
});
|
|
96
106
|
}
|
|
97
107
|
exports.generateCommand = new commander_1.Command("generate")
|
|
@@ -144,11 +144,11 @@ function generateFormField({ gqlIntrospection, baseOutputFilename, config, formC
|
|
|
144
144
|
}
|
|
145
145
|
else if (config.type == "date") {
|
|
146
146
|
imports.push({
|
|
147
|
-
name: "
|
|
147
|
+
name: "Future_DatePickerField",
|
|
148
148
|
importPath: "@comet/admin",
|
|
149
149
|
});
|
|
150
150
|
code = `
|
|
151
|
-
<
|
|
151
|
+
<Future_DatePickerField
|
|
152
152
|
${required ? "required" : ""}
|
|
153
153
|
${config.readOnly ? readOnlyPropsWithLock : ""}
|
|
154
154
|
variant="horizontal"
|
|
@@ -173,7 +173,7 @@ function generateFormField({ gqlIntrospection, baseOutputFilename, config, formC
|
|
|
173
173
|
}
|
|
174
174
|
else if (config.type == "dateTime") {
|
|
175
175
|
imports.push({
|
|
176
|
-
name: "DateTimePickerField",
|
|
176
|
+
name: "Future_DateTimePickerField as DateTimePickerField",
|
|
177
177
|
importPath: "@comet/admin",
|
|
178
178
|
});
|
|
179
179
|
code = `<DateTimePickerField
|
|
@@ -463,7 +463,7 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
|
|
|
463
463
|
maxWidth: column.maxWidth,
|
|
464
464
|
flex: column.flex,
|
|
465
465
|
headerInfoTooltip: column.headerInfoTooltip,
|
|
466
|
-
visible: column.visible
|
|
466
|
+
visible: column.visible !== undefined ? (typeof column.visible == "string" ? `theme.breakpoints.${column.visible}` : "false") : undefined,
|
|
467
467
|
pinned: column.pinned,
|
|
468
468
|
disableExport: column.disableExport,
|
|
469
469
|
};
|
|
@@ -518,7 +518,7 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
|
|
|
518
518
|
maxWidth: column.maxWidth,
|
|
519
519
|
flex: column.flex,
|
|
520
520
|
headerInfoTooltip: column.headerInfoTooltip,
|
|
521
|
-
visible: column.visible
|
|
521
|
+
visible: column.visible !== undefined ? (typeof column.visible == "string" ? `theme.breakpoints.${column.visible}` : "false") : undefined,
|
|
522
522
|
pinned: column.pinned,
|
|
523
523
|
disableExport: column.disableExport,
|
|
524
524
|
sortBy: "sortBy" in column ? column.sortBy : undefined,
|
|
@@ -759,7 +759,11 @@ function generateGrid({ exportName, baseOutputFilename, targetDirectory, gqlIntr
|
|
|
759
759
|
id: `${instanceGqlType}.actions`,
|
|
760
760
|
type: "intlCall",
|
|
761
761
|
})
|
|
762
|
-
: `""`, sortable: "false", filterable: "false", type: '"actions"', align: '"right"', pinned: `"${actionsColumnPinned}"`, width: forwardRowAction ? "actionsColumnWidth" : actionsColumnWidth, visible: actionsColumnVisible
|
|
762
|
+
: `""`, sortable: "false", filterable: "false", type: '"actions"', align: '"right"', pinned: `"${actionsColumnPinned}"`, width: forwardRowAction ? "actionsColumnWidth" : actionsColumnWidth, visible: actionsColumnVisible !== undefined
|
|
763
|
+
? typeof actionsColumnVisible == "string"
|
|
764
|
+
? `theme.breakpoints.${actionsColumnVisible}`
|
|
765
|
+
: "false"
|
|
766
|
+
: undefined }, restActionsColumnConfig), { headerInfoTooltip: restActionsColumnConfig.headerInfoTooltip
|
|
763
767
|
? (0, intl_1.generateFormattedMessage)({
|
|
764
768
|
config: restActionsColumnConfig.headerInfoTooltip,
|
|
765
769
|
id: `${instanceGqlType}.actions`,
|
|
@@ -2,5 +2,5 @@ import { type Breakpoint } from "@mui/material";
|
|
|
2
2
|
type BreakpointKey = `'${Breakpoint}'` | number;
|
|
3
3
|
type SingleValueBrakpointTypes = "up" | "down" | "only" | "not";
|
|
4
4
|
type MultiValueBrakpointTypes = "between";
|
|
5
|
-
export type ColumnVisibleOption = `${SingleValueBrakpointTypes}(${BreakpointKey})` | `${MultiValueBrakpointTypes}(${BreakpointKey}, ${BreakpointKey})
|
|
5
|
+
export type ColumnVisibleOption = `${SingleValueBrakpointTypes}(${BreakpointKey})` | `${MultiValueBrakpointTypes}(${BreakpointKey}, ${BreakpointKey})` | false;
|
|
6
6
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/admin-generator",
|
|
3
|
-
"version": "9.0.0-canary-
|
|
3
|
+
"version": "9.0.0-canary-20260121085838",
|
|
4
4
|
"description": "Comet Admin Generator CLI tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/admin/admin-generator",
|
|
@@ -31,29 +31,25 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@apollo/client": "^3.14.0",
|
|
34
|
-
"@mui/material": "^7.3.
|
|
35
|
-
"@mui/x-data-grid": "^7.29.
|
|
36
|
-
"@types/jest": "^29.5.14",
|
|
34
|
+
"@mui/material": "^7.3.7",
|
|
35
|
+
"@mui/x-data-grid": "^7.29.12",
|
|
37
36
|
"@types/node": "^24.9.1",
|
|
38
37
|
"@types/object-path": "^0.11.4",
|
|
39
38
|
"@types/pluralize": "^0.0.33",
|
|
40
39
|
"@types/react": "^18.3.27",
|
|
41
|
-
"@types/react-dom": "^18.3.7",
|
|
42
40
|
"eslint": "^9.30.1",
|
|
43
41
|
"final-form": "^4.20.10",
|
|
44
|
-
"
|
|
45
|
-
"npm-run-all2": "^8.0.0",
|
|
42
|
+
"npm-run-all2": "^8.0.4",
|
|
46
43
|
"prettier": "^3.6.2",
|
|
47
44
|
"react": "^18.3.1",
|
|
48
|
-
"react-dom": "^18.3.1",
|
|
49
45
|
"react-intl": "^7.1.11",
|
|
50
46
|
"rimraf": "^6.1.2",
|
|
51
|
-
"ts-jest": "^29.4.0",
|
|
52
47
|
"typescript": "5.9.3",
|
|
53
|
-
"
|
|
54
|
-
"@comet/admin
|
|
55
|
-
"@comet/
|
|
56
|
-
"@comet/
|
|
48
|
+
"vitest": "^4.0.16",
|
|
49
|
+
"@comet/admin": "9.0.0-canary-20260121085838",
|
|
50
|
+
"@comet/admin-icons": "9.0.0-canary-20260121085838",
|
|
51
|
+
"@comet/cms-admin": "9.0.0-canary-20260121085838",
|
|
52
|
+
"@comet/eslint-config": "9.0.0-canary-20260121085838"
|
|
57
53
|
},
|
|
58
54
|
"engines": {
|
|
59
55
|
"node": ">=22.0.0"
|
|
@@ -69,10 +65,10 @@
|
|
|
69
65
|
"lint": "run-p lint:prettier lint:eslint lint:tsc",
|
|
70
66
|
"lint:ci": "pnpm run lint",
|
|
71
67
|
"lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
|
|
72
|
-
"lint:prettier": "pnpm exec prettier --check '
|
|
68
|
+
"lint:prettier": "pnpm exec prettier --check '*.{ts,js,json,md,yml,yaml}'",
|
|
73
69
|
"lint:tsc": "tsc",
|
|
74
|
-
"test": "
|
|
75
|
-
"test:updateSnapshot": "
|
|
76
|
-
"test:watch": "
|
|
70
|
+
"test": "vitest --run",
|
|
71
|
+
"test:updateSnapshot": "vitest --run --update",
|
|
72
|
+
"test:watch": "vitest --watch"
|
|
77
73
|
}
|
|
78
74
|
}
|