Skip to content

Commit 711a591

Browse files
author
yangdan
committed
feat(template): support custom templates
1 parent c319ba3 commit 711a591

File tree

97 files changed

+212
-2879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+212
-2879
lines changed

eslint.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ export default tseslint.config(
6666
'**/dist/',
6767
'**/node_modules/',
6868
'temp/',
69-
'packages/openapi-ts/src/legacy/handlebars/compiled/**/*.js',
70-
'packages/openapi-ts/src/legacy/handlebars/templates/**/*.hbs',
69+
'packages/openapi-ts/templates/**/*.hbs',
7170
'**/test/e2e/generated/',
7271
'**/test/generated/',
7372
'**/__snapshots__/',

packages/openapi-ts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
"files": [
6161
"bin",
6262
"dist",
63+
"templates",
6364
"LICENSE.md"
6465
],
6566
"scripts": {
6667
"build": "tsup && pnpm check-exports",
6768
"check-exports": "attw --pack .",
6869
"dev": "tsup --watch",
69-
"handlebars": "node src/legacy/handlebars/handlebars.cjs",
7070
"prepublishOnly": "pnpm build",
7171
"test:coverage": "vitest run --config vitest.config.unit.ts --coverage",
7272
"test:e2e": "vitest run --config vitest.config.e2e.ts",

packages/openapi-ts/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const createClient = async (
2929
Performance.end('config');
3030

3131
Performance.start('handlebars');
32-
const templates = registerHandlebarTemplates();
32+
const templates = await registerHandlebarTemplates();
3333
Performance.end('handlebars');
3434

3535
const clients = await Promise.all(

packages/openapi-ts/src/initConfigs.ts

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export const initConfigs = async (
267267
exportCore = true,
268268
name,
269269
request,
270+
templatesPath,
270271
useOptions = true,
271272
} = userConfig;
272273

@@ -311,6 +312,7 @@ export const initConfigs = async (
311312
name,
312313
output,
313314
request,
315+
templatesPath,
314316
useOptions,
315317
watch: getWatch({ ...userConfig, input }),
316318
});

0 commit comments

Comments
 (0)