Skip to content

Commit 7cf43d2

Browse files
committed
fix: don't use template files for readme, to simplify the logic
1 parent f878294 commit 7cf43d2

File tree

3 files changed

+22
-38
lines changed

3 files changed

+22
-38
lines changed

utils/docs/README-TEMPLATE.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

utils/docs/SFC-TYPE-SUPPORT.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

utils/generateReadme.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,35 @@ import fs from 'fs'
22

33
import getCommand from './getCommand.js'
44

5-
const sfcTypeSupportDoc = fs.readFileSync(
6-
new URL('./docs/SFC-TYPE-SUPPORT.md', import.meta.url).pathname,
7-
'utf8'
8-
)
5+
const sfcTypeSupportDoc =
6+
'\n' +
7+
'## Type Support for `.vue` Imports in TS\n' +
8+
'\n' +
9+
"Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates.\n" +
10+
'\n' +
11+
'However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can run `Volar: Switch TS Plugin on/off` from VSCode command palette.\n'
912

1013
export default function generateReadme({
1114
projectName,
1215
packageManager,
1316
needsTypeScript,
1417
needsTests
1518
}) {
16-
let template = fs.readFileSync(
17-
new URL('./docs/README-TEMPLATE.md', import.meta.url).pathname,
18-
'utf8'
19-
)
19+
let readme = `# ${projectName}
2020
21-
template = template.replace('{{projectName}}', projectName)
21+
This template should help get you started developing with Vue 3 in Vite.
2222
23-
if (needsTypeScript) {
24-
template = template.replace('<!-- SFC-TYPE-SUPPORT -->\n', sfcTypeSupportDoc)
25-
} else {
26-
template = template.replace('<!-- SFC-TYPE-SUPPORT -->\n\n', '')
27-
}
23+
## Recommended IDE Setup
24+
25+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) (and disable Vetur).
26+
${needsTypeScript ? sfcTypeSupportDoc : ''}
27+
## Customize configuration
28+
29+
See [Vite Configuration Reference](https://vitejs.dev/config/).
30+
31+
## Project Setup
32+
33+
`
2834

2935
let npmScriptsDescriptions = `\`\`\`sh
3036
${getCommand(packageManager, 'install')}
@@ -65,7 +71,7 @@ ${getCommand(packageManager, 'test:e2e')} # or \`${getCommand(
6571
`
6672
}
6773

68-
template = template.replace('<!-- NPM-SCRIPTS -->\n', npmScriptsDescriptions)
74+
readme += npmScriptsDescriptions
6975

70-
return template
76+
return readme
7177
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy