Skip to content

Commit 6c42a3b

Browse files
Refactor to use only EJS for templating (#10)
1 parent a6819c1 commit 6c42a3b

File tree

6 files changed

+9
-17
lines changed

6 files changed

+9
-17
lines changed

packages/create-vue-lib/src/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,6 @@ function copyFiles(templateFile: string, config: Config) {
474474

475475
fs.writeFileSync(target, content)
476476
}
477-
else if (['package.json', 'vite.config.mts', 'config.mts', 'index.md', 'introduction.md', 'App.vue', 'tsconfig.app.json', 'env.d.ts'].includes(filename)) {
478-
const template = fs.readFileSync(templatePath, 'utf-8')
479-
const content = template
480-
.replace(/@projectName@/g, config.mainPackageDirName)
481-
.replace(new RegExp(`@(${Object.keys(config).join('|')})@`, 'g'), (all, setting) => `${config[setting as keyof Config] ?? all}`)
482-
483-
fs.writeFileSync(targetPath, content)
484-
}
485477
else {
486478
fs.copyFileSync(templatePath, targetPath)
487479
}

packages/create-vue-lib/src/template/playground/config/packages/playground/env.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="vite/client" />
2+
3+
import '../<%- config.mainPackageDirName %>/env.d.ts'

packages/create-vue-lib/src/template/vitepress/config/packages/docs/env.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="vite/client" />
2+
3+
import '../<%- config.mainPackageDirName %>/env.d.ts'

packages/create-vue-lib/src/template/vitepress/examples/packages/docs/src/index.md renamed to packages/create-vue-lib/src/template/vitepress/examples/packages/docs/src/index.md.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
layout: home
33

4-
title: @unscopedPackageName@
4+
title: <%- config.unscopedPackageName %>
55
titleTemplate: Title template
66

77
hero:
8-
name: @unscopedPackageName@
8+
name: <%- config.unscopedPackageName %>
99
text: Description
1010
tagline: Tag line!
1111
actions:
@@ -14,7 +14,7 @@ hero:
1414
link: /introduction
1515
- theme: alt
1616
text: View on GitHub
17-
link: https://github.com/@githubPath@
17+
link: https://github.com/<%- config.githubPath %>
1818
- theme: alt
1919
text: See a demo
2020
link: https://play.vuejs.org/

0 commit comments

Comments
 (0)