Skip to content

Commit

Permalink
first use of generics in a generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Oct 11, 2024
1 parent 9ed2529 commit 7e7261a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions generators/angular/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import chalk from 'chalk';
import { isFileStateModified } from 'mem-fs-editor/state';

import type { Entity } from '../../lib/types/application/entity.js';
import BaseApplicationGenerator from '../base-application/index.js';
import { GENERATOR_ANGULAR, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../generator-list.js';
import { defaultLanguage } from '../languages/support/index.js';
Expand All @@ -32,6 +32,7 @@ import {
} from '../client/support/index.js';
import { createNeedleCallback, mutateData } from '../base/support/index.js';
import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js';
import type { TaskTypes as DefaultTaskTypes } from '../../lib/types/application/tasks.js';
import { cleanupEntitiesFiles, postWriteEntitiesFiles, writeEntitiesFiles } from './entity-files-angular.js';
import { writeFiles } from './files-angular.js';
import cleanupOldFilesTask from './cleanup.js';
Expand All @@ -46,10 +47,15 @@ import {
isTranslatedAngularFile,
translateAngularFilesTransform,
} from './support/index.js';
import type { AngularApplication } from './types.js';

const { ANGULAR } = clientFrameworkTypes;

export default class AngularGenerator extends BaseApplicationGenerator {
export default class AngularGenerator extends BaseApplicationGenerator<
Entity,
AngularApplication,
DefaultTaskTypes<Entity, AngularApplication>
> {
localEntities?: any[];

async beforeQueue() {
Expand Down
5 changes: 4 additions & 1 deletion generators/angular/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { Entity } from '../../lib/types/application/entity.js';
import type { ApplicationType } from '../../lib/types/application/application.js';

export type AngularApplication = {
angularLocaleId: string;
};
} & ApplicationType<Entity>;
2 changes: 0 additions & 2 deletions generators/client/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { addIconImport, addItemToMenu, addRoute } from '../angular/support/needles.js';
import type { AngularApplication } from '../angular/types.js';
import type { ExportApplicationPropertiesFromCommand } from '../../lib/command/index.js';
import type { CypressApplication } from '../cypress/types.js';
import type { JavaScriptApplication, JavaScriptSourceType } from '../javascript/types.js';
Expand All @@ -10,7 +9,6 @@ type ApplicationClientProperties = ExportApplicationPropertiesFromCommand<typeof

export type ClientApplication = ApplicationClientProperties &
JavaScriptApplication &
AngularApplication &
CypressApplication & {
webappLoginRegExp: string;
webappEnumerationsDir?: string;
Expand Down

0 comments on commit 7e7261a

Please sign in to comment.