generator-begcode
Version:
Spring Boot + Angular/React/Vue in one handy generator
110 lines (109 loc) • 6.38 kB
TypeScript
import type { RunContextSettings, RunResult } from 'yeoman-test';
import { RunContext, YeomanTest } from 'yeoman-test';
import type Environment from 'yeoman-environment';
import type { BaseEnvironmentOptions, GetGeneratorConstructor, BaseGenerator as YeomanGenerator } from '@yeoman/types';
import type { EmptyObject } from 'type-fest';
import type { JHipsterGeneratorOptions } from '../../generators/base/api.js';
import type CoreGenerator from '../../generators/base-core/generator.js';
import type { ApplicationConfiguration } from '../types/application/yo-rc.js';
import type { Entity } from '../types/base/entity.js';
import type { CliCommand } from '../../cli/types.js';
type GeneratorTestType = YeomanGenerator<JHipsterGeneratorOptions>;
type GeneratorTestOptions = JHipsterGeneratorOptions;
type WithJHipsterGenerators = {
useDefaultMocks?: boolean;
actualGeneratorsList?: string[];
useMock?: (ns: string) => boolean;
};
type RunJHipster = WithJHipsterGenerators & {
useEnvironmentBuilder?: boolean;
};
type JHipsterRunResult<GeneratorType extends CoreGenerator = CoreGenerator> = Omit<RunResult<GeneratorType>, 'env'> & {
env: Environment;
sourceCallsArg: Record<string, unknown[]>;
composedMockedGenerators: string[];
createJHipster: (ns: string, options?: WithJHipsterGenerators) => JHipsterRunContext;
};
type HelpersDefaults = {
blueprint?: string;
blueprintPackagePath?: string;
entrypointGenerator?: string;
};
declare const runResult: JHipsterRunResult;
export { runResult, runResult as result };
export declare const resetDefaults: () => void;
export declare const defineDefaults: (defaults?: {
mockFactory?: any;
accumulateMockArgs?: (mock: Record<string, any>) => Record<string, any>;
} & HelpersDefaults) => Promise<void>;
export declare const createJHipsterConfigFiles: (configuration: Record<string, unknown>, entities?: Entity[]) => Record<string, any>;
export type FakeBlueprintOptions = {
packageJson?: any;
generator?: string | string[];
generatorContent?: string;
files?: Record<string, unknown>;
};
export declare const createBlueprintFiles: (blueprintPackage: string, { packageJson, generator, generatorContent, files }?: FakeBlueprintOptions) => {
[x: string]: any;
};
declare class JHipsterRunContext extends RunContext<GeneratorTestType> {
sharedSource: Record<string, any>;
private sharedData;
private sharedApplication;
private sharedControl;
private workspaceApplications;
private commonWorkspacesConfig;
private generateApplicationsSet;
withOptions(options: Partial<Omit<JHipsterGeneratorOptions, 'env' | 'resolved' | 'namespace'> & Record<string, any>>): this;
withJHipsterConfig<Config extends EmptyObject>(configuration?: Readonly<Partial<Config & ApplicationConfiguration>>, entities?: Entity[]): this;
withSkipWritingPriorities(): this;
withWorkspacesCommonConfig(commonWorkspacesConfig: Record<string, unknown>): this;
withWorkspaceApplicationAtFolder(workspaceFolder: string, configuration: Record<string, unknown>, entities?: Entity[]): this;
withWorkspaceApplication(configuration: Record<string, unknown>, entities?: Entity[]): this;
withWorkspacesSamples(...appNames: string[]): this;
withGenerateWorkspaceApplications(generateWorkspaces?: boolean): this;
withJHipsterLookup(): this;
withBlueprintConfig(config: Record<string, any>): this;
withConfiguredBlueprint(): this;
withParentBlueprintLookup(lookups?: string[]): this;
withFakeTestBlueprint(blueprintPackage: string, { packageJson, generator }?: FakeBlueprintOptions): this;
withMockedSource(options?: {
except?: string[];
}): this;
withControl(sharedControl: Record<string, any>): this;
withSharedApplication(sharedApplication: Record<string, any>): this;
withMockedNodeDependencies(): this;
withMockedJHipsterGenerators(options?: string[] | {
except?: string[];
filter?: (string: any) => boolean;
}): this;
withJHipsterGenerators(options?: WithJHipsterGenerators): this;
withGradleBuildTool(): this;
private withSharedData;
run(): Promise<RunResult<GeneratorTestType>>;
}
declare class JHipsterTest extends YeomanTest {
constructor();
run<GeneratorType extends YeomanGenerator<GeneratorTestOptions> = YeomanGenerator<GeneratorTestOptions>>(GeneratorOrNamespace: string | GetGeneratorConstructor<GeneratorType>, settings?: RunContextSettings | undefined, envOptions?: (BaseEnvironmentOptions & {
createEnv?: any;
}) | undefined): JHipsterRunContext;
runJHipster(jhipsterGenerator: string, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
runJHipster(jhipsterGenerator: string, options?: RunJHipster): JHipsterRunContext;
runCli(command: string | string[], options?: {
commands?: Record<string, CliCommand>;
useEnvironmentBuilder?: boolean;
entrypointGenerator?: string;
}): JHipsterRunContext;
runJHipsterInApplication(jhipsterGenerator: string, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
runJDL(jdl: string, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
runJDLInApplication(jdl: string, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
runTestBlueprintGenerator(): JHipsterRunContext;
create<GeneratorType extends YeomanGenerator<GeneratorTestOptions> = YeomanGenerator<GeneratorTestOptions>>(GeneratorOrNamespace: string | GetGeneratorConstructor<GeneratorType>, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
createJHipster(jhipsterGenerator: string, settings?: RunContextSettings | undefined, envOptions?: BaseEnvironmentOptions | undefined): JHipsterRunContext;
generateDeploymentWorkspaces(commonConfig?: Record<string, unknown>): JHipsterRunContext;
}
export declare function createTestHelpers(options?: any): JHipsterTest;
export declare const basicHelpers: JHipsterTest;
export declare const defaultHelpers: JHipsterTest;
export declare const skipPrettierHelpers: JHipsterTest;
export declare const dryRunHelpers: JHipsterTest;