Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,39 +139,155 @@ export default async () => ({});
export type Config = {
generators?: {
component?: {
// Generate a `class-based` component, instead of a `template-only` component:
classBased?: boolean;
// Copy the generated component to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated component to the console, instead of writing it to disk:
log?: boolean;
// The component's name:
name?: string;
// Generate a nested colocated component, e.g. `foo/bar/index.gts`:
nested?: boolean;
// Generate a component at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` component, instead of a `.gjs` component:
typescript?: boolean;
};
"component-test"?: {
// Copy the generated component-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated component-test to the console, instead of writing it to disk:
log?: boolean;
// The component-test's name:
name?: string;
// Generate a component-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` component-test, instead of a `.gjs` component-test:
typescript?: boolean;
};
helper?: {
// Generate a `class-based` helper, instead of a `function-based` helper:
classBased?: boolean;
// Copy the generated helper to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated helper to the console, instead of writing it to disk:
log?: boolean;
// The helper's name:
name?: string;
// Generate a helper at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` helper, instead of a `.js` helper:
typescript?: boolean;
};
"helper-test"?: {
// Copy the generated helper-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated helper-test to the console, instead of writing it to disk:
log?: boolean;
// The helper-test's name:
name?: string;
// Generate a helper-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` helper-test, instead of a `.gjs` helper-test:
typescript?: boolean;
};
modifier?: {
// Generate a `class-based` modifier, instead of a `function-based` modifier:
classBased?: boolean;
// Copy the generated modifier to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated modifier to the console, instead of writing it to disk:
log?: boolean;
// The modifier's name:
name?: string;
// Generate a modifier at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` modifier, instead of a `.js` modifier:
typescript?: boolean;
};
"modifier-test"?: {
// Copy the generated modifier-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated modifier-test to the console, instead of writing it to disk:
log?: boolean;
// The modifier-test's name:
name?: string;
// Generate a modifier-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test:
typescript?: boolean;
};
service?: {
// Copy the generated service to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated service to the console, instead of writing it to disk:
log?: boolean;
// The service's name:
name?: string;
// Generate a service at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` service, instead of a `.js` service:
typescript?: boolean;
};
"service-test"?: {
// Copy the generated service-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated service-test to the console, instead of writing it to disk:
log?: boolean;
// The service-test's name:
name?: string;
// Generate a service-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` service-test, instead of a `.js` service-test:
typescript?: boolean;
};
"acceptance-test"?: {
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated acceptance-test to the console, instead of writing it to disk:
log?: boolean;
// The acceptance-test's name:
name?: string;
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
typescript?: boolean;
};
};
Expand Down
17 changes: 17 additions & 0 deletions dev/generators-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// eslint-disable-next-line n/no-missing-import
import { generators } from "../dist/generators.js";

let generatorsType = "";

for (const generator of generators) {
generatorsType += `${generator.name.includes("-") ? `"${generator.name}"` : generator.name}?: {\n`;

for (const arg of generator.args) {
generatorsType += ` // ${arg.description}:\n`;
generatorsType += ` ${arg.name}?: ${arg.type === "positional" ? "string" : arg.type};\n`;
}

generatorsType += `};\n`;
}

console.log(generatorsType);
116 changes: 116 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,155 @@ import type { GeneratorFile } from "./types.js";
export type Config = {
generators?: {
component?: {
// Generate a `class-based` component, instead of a `template-only` component:
classBased?: boolean;
// Copy the generated component to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated component to the console, instead of writing it to disk:
log?: boolean;
// The component's name:
name?: string;
// Generate a nested colocated component, e.g. `foo/bar/index.gts`:
nested?: boolean;
// Generate a component at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` component, instead of a `.gjs` component:
typescript?: boolean;
};
"component-test"?: {
// Copy the generated component-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated component-test to the console, instead of writing it to disk:
log?: boolean;
// The component-test's name:
name?: string;
// Generate a component-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` component-test, instead of a `.gjs` component-test:
typescript?: boolean;
};
helper?: {
// Generate a `class-based` helper, instead of a `function-based` helper:
classBased?: boolean;
// Copy the generated helper to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated helper to the console, instead of writing it to disk:
log?: boolean;
// The helper's name:
name?: string;
// Generate a helper at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` helper, instead of a `.js` helper:
typescript?: boolean;
};
"helper-test"?: {
// Copy the generated helper-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated helper-test to the console, instead of writing it to disk:
log?: boolean;
// The helper-test's name:
name?: string;
// Generate a helper-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` helper-test, instead of a `.gjs` helper-test:
typescript?: boolean;
};
modifier?: {
// Generate a `class-based` modifier, instead of a `function-based` modifier:
classBased?: boolean;
// Copy the generated modifier to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated modifier to the console, instead of writing it to disk:
log?: boolean;
// The modifier's name:
name?: string;
// Generate a modifier at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` modifier, instead of a `.js` modifier:
typescript?: boolean;
};
"modifier-test"?: {
// Copy the generated modifier-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated modifier-test to the console, instead of writing it to disk:
log?: boolean;
// The modifier-test's name:
name?: string;
// Generate a modifier-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test:
typescript?: boolean;
};
service?: {
// Copy the generated service to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated service to the console, instead of writing it to disk:
log?: boolean;
// The service's name:
name?: string;
// Generate a service at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` service, instead of a `.js` service:
typescript?: boolean;
};
"service-test"?: {
// Copy the generated service-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated service-test to the console, instead of writing it to disk:
log?: boolean;
// The service-test's name:
name?: string;
// Generate a service-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` service-test, instead of a `.js` service-test:
typescript?: boolean;
};
"acceptance-test"?: {
// Copy the generated acceptance-test to the clipboard, instead of writing it to disk:
copy?: boolean;
// Log the generated acceptance-test to the console, instead of writing it to disk:
log?: boolean;
// The acceptance-test's name:
name?: string;
// Generate a acceptance-test at a custom path, e.g. `--path=src/-private`:
path?: string;
// Custom template content:
templateContent?: string;
// Custom template path:
templatePath?: string;
// Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test:
typescript?: boolean;
};
};
Expand Down
Loading