Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Generator (Future): Generate only specific file #1943

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/admin/cms-admin/src/generator/future/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ export type GeneratorConfig = FormConfig<any> | GridConfig<any> | TabsConfig;

export type GeneratorReturn = { code: string; gqlDocuments: Record<string, string> };

export async function runFutureGenerate() {
export async function runFutureGenerate(specificFile?: string) {
johnnyomair marked this conversation as resolved.
Show resolved Hide resolved
const schema = await loadSchema("./schema.gql", {
loaders: [new GraphQLFileLoader()],
});
const gqlIntrospection = introspectionFromSchema(schema);

const files = await glob("src/**/*.cometGen.ts");
const files: string[] = specificFile ? [specificFile] : await glob("src/**/*.cometGen.ts");
for (const file of files) {
let outputCode = "";
let gqlDocumentsOutputCode = "";
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/cms-admin/src/generator/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ program.addCommand(
);

program.addCommand(
new Command("future-generate").action(async () => {
await runFutureGenerate();
new Command("future-generate").option("-f, --file <file>", "config file to generate").action(async ({ file }: { file?: string }) => {
await runFutureGenerate(file);
}),
);

Expand Down
Loading