@@ -25,6 +25,8 @@ export default function generateReadme({
25
25
needsVitest,
26
26
needsEslint
27
27
} ) {
28
+ const commandFor = ( scriptName ) => getCommand ( packageManager , scriptName )
29
+
28
30
let readme = `# ${ projectName }
29
31
30
32
This template should help get you started developing with Vue 3 in Vite.
@@ -42,19 +44,19 @@ See [Vite Configuration Reference](https://vitejs.dev/config/).
42
44
`
43
45
44
46
let npmScriptsDescriptions = `\`\`\`sh
45
- ${ getCommand ( packageManager , 'install' ) }
47
+ ${ commandFor ( 'install' ) }
46
48
\`\`\`
47
49
48
50
### Compile and Hot-Reload for Development
49
51
50
52
\`\`\`sh
51
- ${ getCommand ( packageManager , 'dev' ) }
53
+ ${ commandFor ( 'dev' ) }
52
54
\`\`\`
53
55
54
56
### ${ needsTypeScript ? 'Type-Check, ' : '' } Compile and Minify for Production
55
57
56
58
\`\`\`sh
57
- ${ getCommand ( packageManager , 'build' ) }
59
+ ${ commandFor ( 'build' ) }
58
60
\`\`\`
59
61
`
60
62
@@ -63,7 +65,7 @@ ${getCommand(packageManager, 'build')}
63
65
### Run Unit Tests with [Vitest](https://vitest.dev/)
64
66
65
67
\`\`\`sh
66
- ${ getCommand ( packageManager , 'test:unit' ) }
68
+ ${ commandFor ( 'test:unit' ) }
67
69
\`\`\`
68
70
`
69
71
}
@@ -73,10 +75,7 @@ ${getCommand(packageManager, 'test:unit')}
73
75
### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
74
76
75
77
\`\`\`sh
76
- ${ getCommand ( packageManager , 'test:unit' ) } # or \`${ getCommand (
77
- packageManager ,
78
- 'test:unit:ci'
79
- ) } \` for headless testing
78
+ ${ commandFor ( 'test:unit' ) } # or \`${ commandFor ( 'test:unit:ci' ) } \` for headless testing
80
79
\`\`\`
81
80
`
82
81
}
@@ -86,11 +85,8 @@ ${getCommand(packageManager, 'test:unit')} # or \`${getCommand(
86
85
### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
87
86
88
87
\`\`\`sh
89
- ${ getCommand ( packageManager , 'build' ) }
90
- ${ getCommand ( packageManager , 'test:e2e' ) } # or \`${ getCommand (
91
- packageManager ,
92
- 'test:e2e:ci'
93
- ) } \` for headless testing
88
+ ${ commandFor ( 'build' ) }
89
+ ${ commandFor ( 'test:e2e' ) } # or \`${ commandFor ( 'test:e2e:ci' ) } \` for headless testing
94
90
\`\`\`
95
91
`
96
92
}
@@ -104,13 +100,13 @@ ${getCommand(packageManager, 'test:e2e')} # or \`${getCommand(
104
100
npx playwright install
105
101
106
102
# Runs the end-to-end tests
107
- ${ getCommand ( packageManager , 'test:e2e' ) }
103
+ ${ commandFor ( 'test:e2e' ) }
108
104
# Runs the tests only on Chromium
109
- ${ getCommand ( packageManager , 'test:e2e -- --project=chromium' ) }
105
+ ${ commandFor ( 'test:e2e -- --project=chromium' ) }
110
106
# Runs the tests of a specific file
111
- ${ getCommand ( packageManager , 'test:e2e -- tests/example.spec.ts' ) }
107
+ ${ commandFor ( 'test:e2e -- tests/example.spec.ts' ) }
112
108
# Runs the tests in debug mode
113
- ${ getCommand ( packageManager , 'test:e2e -- --debug' ) }
109
+ ${ commandFor ( 'test:e2e -- --debug' ) }
114
110
\`\`\`
115
111
`
116
112
}
@@ -120,7 +116,7 @@ ${getCommand(packageManager, 'test:e2e -- --debug')}
120
116
### Lint with [ESLint](https://eslint.org/)
121
117
122
118
\`\`\`sh
123
- ${ getCommand ( packageManager , 'lint' ) }
119
+ ${ commandFor ( 'lint' ) }
124
120
\`\`\`
125
121
`
126
122
}
0 commit comments