@comet/admin-generator 9.0.0-canary-20260113132154 → 9.0.0-canary-20260119123708
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")
|
|
@@ -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-20260119123708",
|
|
4
4
|
"description": "Comet Admin Generator CLI tool",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/admin/admin-generator",
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@apollo/client": "^3.14.0",
|
|
34
|
-
"@mui/material": "^7.3.
|
|
34
|
+
"@mui/material": "^7.3.7",
|
|
35
35
|
"@mui/x-data-grid": "^7.29.8",
|
|
36
|
-
"@types/jest": "^29.5.14",
|
|
37
36
|
"@types/node": "^24.9.1",
|
|
38
37
|
"@types/object-path": "^0.11.4",
|
|
39
38
|
"@types/pluralize": "^0.0.33",
|
|
@@ -41,19 +40,18 @@
|
|
|
41
40
|
"@types/react-dom": "^18.3.7",
|
|
42
41
|
"eslint": "^9.30.1",
|
|
43
42
|
"final-form": "^4.20.10",
|
|
44
|
-
"
|
|
45
|
-
"npm-run-all2": "^8.0.0",
|
|
43
|
+
"npm-run-all2": "^8.0.4",
|
|
46
44
|
"prettier": "^3.6.2",
|
|
47
45
|
"react": "^18.3.1",
|
|
48
46
|
"react-dom": "^18.3.1",
|
|
49
47
|
"react-intl": "^7.1.11",
|
|
50
48
|
"rimraf": "^6.1.2",
|
|
51
|
-
"ts-jest": "^29.4.0",
|
|
52
49
|
"typescript": "5.9.3",
|
|
53
|
-
"
|
|
54
|
-
"@comet/admin
|
|
55
|
-
"@comet/
|
|
56
|
-
"@comet/
|
|
50
|
+
"vitest": "^4.0.16",
|
|
51
|
+
"@comet/admin": "9.0.0-canary-20260119123708",
|
|
52
|
+
"@comet/admin-icons": "9.0.0-canary-20260119123708",
|
|
53
|
+
"@comet/cms-admin": "9.0.0-canary-20260119123708",
|
|
54
|
+
"@comet/eslint-config": "9.0.0-canary-20260119123708"
|
|
57
55
|
},
|
|
58
56
|
"engines": {
|
|
59
57
|
"node": ">=22.0.0"
|
|
@@ -69,10 +67,10 @@
|
|
|
69
67
|
"lint": "run-p lint:prettier lint:eslint lint:tsc",
|
|
70
68
|
"lint:ci": "pnpm run lint",
|
|
71
69
|
"lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
|
|
72
|
-
"lint:prettier": "pnpm exec prettier --check '
|
|
70
|
+
"lint:prettier": "pnpm exec prettier --check '*.{ts,js,json,md,yml,yaml}'",
|
|
73
71
|
"lint:tsc": "tsc",
|
|
74
|
-
"test": "
|
|
75
|
-
"test:updateSnapshot": "
|
|
76
|
-
"test:watch": "
|
|
72
|
+
"test": "vitest --run",
|
|
73
|
+
"test:updateSnapshot": "vitest --run --update",
|
|
74
|
+
"test:watch": "vitest --watch"
|
|
77
75
|
}
|
|
78
76
|
}
|