Skip to content

Commit b1729ff

Browse files
author
Jarek Kuliga
committed
feat: 🎸 generate api endpoint file
1 parent 2cecb79 commit b1729ff

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎generators/structure-api/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export = class StructureApiGenerator extends Generator {
1919
}
2020

2121
public writing() {
22-
["api", "dto", "mapper", "mock"].forEach(file => {
22+
["api", "dto", "mapper", "mock", "endpoint"].forEach(file => {
2323
this.fs.copyTpl(
2424
this.templatePath(`${file}.ts`),
2525
this.destinationPath(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export enum <%= name %>Endpoint {}

‎generators/structure-module/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ export = class StructureModuleGenerator extends Generator {
1717
name: this.name,
1818
module: this.name
1919
});
20+
this.composeWith(require.resolve(`../structure-store`), {
21+
name: this.name,
22+
module: this.name
23+
});
2024
}
2125
};

‎tests/structure-api.spec.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe("yo codibly-ts:structure-api", () => {
2323
const dtoPath = `${path}.dto.ts`;
2424
const mapperPath = `${path}.mapper.ts`;
2525
const mockPath = `${path}.mock.ts`;
26+
const endpointPath = `${path}.endpoint.ts`;
2627

2728
it("generates required files", () => {
2829
assert.file([apiPath, dtoPath, mapperPath, mockPath]);
@@ -105,4 +106,8 @@ describe("yo codibly-ts:structure-api", () => {
105106
"mock.onDelete('/api/user/:id').reply(status);"
106107
);
107108
});
109+
110+
it("creates enum in Endpoint", () => {
111+
assert.fileContent(endpointPath, "enum UserEndpoint");
112+
});
108113
});

0 commit comments

Comments
 (0)