]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commit
refactor: use ejs templates for `vite.config.*` (#292)
authorHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 12 Jun 2023 06:24:18 +0000 (14:24 +0800)
committerGitHub <noreply@github.com>
Mon, 12 Jun 2023 06:24:18 +0000 (14:24 +0800)
commitcd2c4ab7d39a80a888370e6ebc9fe21343a5e12b
tree0099cb0c191c6edce780e6404d27b865f65e58ca
parent3aa416109f732d71f74315e3141b2edc27f8e78b
refactor: use ejs templates for `vite.config.*` (#292)

The base template has a `vite.config.js.ejs` template file, which reads data from a corresponding `vite.config.js.data.mjs` file. The data file has a default export called `getData()`.
Other templates can also have data files that can be chained together so that they can modify the data fed into the template. They don't have to define the template again, though.

This fixes the issue mentioned in https://github.com/vuejs/create-vue/pull/257#issuecomment-1582022157

As we don't support plugins or extensions for this tool, I didn't choose to design the feature in an extensible way, but only considered ease of implementation and ease of modification.
13 files changed:
LICENSE
index.ts
package.json
pnpm-lock.yaml
template/base/vite.config.js.data.mjs [new file with mode: 0644]
template/base/vite.config.js.ejs [moved from template/base/vite.config.js with 57% similarity]
template/config/jsx/vite.config.js [deleted file]
template/config/jsx/vite.config.js.data.mjs [new file with mode: 0644]
template/config/nightwatch-ct/vite.config.js [deleted file]
template/config/nightwatch-ct/vite.config.js.data.mjs [new file with mode: 0644]
template/config/nightwatch/vite.config.js [deleted file]
template/config/nightwatch/vite.config.js.data.mjs [new file with mode: 0644]
utils/renderTemplate.ts