Closed dirkdev98 closed 1 year ago
Current accepted options:
export class App {
static defaultEslintIgnore: string[];
generateOpenApi(
options: {
inputPath: string;
outputFile: string;
enabledGroups?: string[] | undefined;
verbose?: boolean | undefined;
openApiExtensions?: OpenApiExtensions | undefined;
openApiRouteExtensions?: Record<string, any> | undefined;
},
): Promise<void>;
generateTypes(
options: {
outputDirectory: string;
inputPaths: string[];
dumpCompasTypes?: boolean | string[] | undefined;
verbose?: boolean | undefined;
fileHeader?: string | undefined;
},
): Promise<void>;
generate(
options: {
enabledGroups?: string[] | undefined;
isBrowser?: boolean | undefined;
isNode?: boolean | undefined;
isNodeServer?: boolean | undefined;
environment?:
| {
clientRuntime?: "browser" | "react-native" | undefined;
}
| undefined;
enabledGenerators?:
| ("type" | "validator" | "router" | "sql" | "apiClient" | "reactQuery")[]
| undefined;
useTypescript?: boolean | undefined;
dumpStructure?: boolean | undefined;
dumpApiStructure?: boolean | undefined;
dumpPostgres?: boolean | undefined;
fileHeader?: string | undefined;
outputDirectory: string;
declareGlobalTypes?: false | undefined;
},
): Promise<void>;
}
As started with the recent #1908 we should redo some generating based on the provided or inferred environment.
Current supported environments
See below for the current accepted options: https://github.com/compasjs/compas/issues/2010#issuecomment-1242922965
Things to solve:
isBrowser
,isNode
&isNodeServer
optionsApp#generate
,App#generateTypes
andApp#generateOpenApi
) in to a single / double cohesive api.API proposal;
Usage:
This probably won't land in a single Compas release, so we may want to use
@compas/code-gen/experimental
for the new exports.