Skip to content

Commit c0df900

Browse files
committed
feat!: rename --spa option to --router
1 parent 073af21 commit c0df900

File tree

27 files changed

+29
-56
lines changed

27 files changed

+29
-56
lines changed

β€Žindex.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ function emptyDir(dir) {
4545
async function init() {
4646
const cwd = process.cwd()
4747
// possible options:
48-
// --jsx
49-
// --spa (todo: split into vuex & vue-router)
5048
// --typescript / --ts
49+
// --jsx
50+
// --router / --vue-router
51+
// --vuex (todo)
5152
// --with-tests / --tests / --cypress
5253
const argv = minimist(process.argv.slice(2), {
5354
alias: {
5455
'typescript': ['ts'],
55-
'with-tests': ['tests', 'cypress']
56+
'with-tests': ['tests', 'cypress'],
57+
'router': ['vue-router']
5658
},
5759
// all arguments are treated as booleans
5860
boolean: true
@@ -69,7 +71,9 @@ async function init() {
6971
// - whether to overwrite the existing directory or not?
7072
// - enter a valid package name for package.json
7173
// - Project language: JavaScript / TypeScript
72-
// - Install Vue Router & Vuex for SPA development?
74+
// - Add JSX Support?
75+
// - Install Vue Router for SPA development?
76+
// - Install Vuex for state management? (TODO)
7377
// - Add Cypress for testing?
7478
result = await prompts(
7579
[
@@ -111,26 +115,26 @@ async function init() {
111115
isValidPackageName(dir) || 'Invalid package.json name'
112116
},
113117
{
114-
name: 'needsJSX',
115-
type: () => (argv.jsx ? null : 'toggle'),
116-
message: 'Add JSX Support?',
118+
name: 'needsTypeScript',
119+
type: () => (argv.typescript ? null : 'toggle'),
120+
message: 'Add TypeScript?',
117121
initial: false,
118122
active: 'Yes',
119123
inactive: 'No'
120124
},
121125
{
122-
name: 'needsTypeScript',
123-
type: () => (argv.typescript ? null : 'toggle'),
124-
message: 'Add TypeScript?',
126+
name: 'needsJSX',
127+
type: () => (argv.jsx ? null : 'toggle'),
128+
message: 'Add JSX Support?',
125129
initial: false,
126130
active: 'Yes',
127131
inactive: 'No'
128132
},
129133
{
130-
name: 'isSPA',
131-
type: () => (argv.spa ? null : 'toggle'),
134+
name: 'needsRouter',
135+
type: () => (argv.router ? null : 'toggle'),
132136
message:
133-
'Add Vue Router & Vuex for Single Page Application development?',
137+
'Add Vue Router for Single Page Application development?',
134138
initial: false,
135139
active: 'Yes',
136140
inactive: 'No'
@@ -162,7 +166,7 @@ async function init() {
162166
shouldOverwrite,
163167
needsJSX = argv.jsx,
164168
needsTypeScript = argv.typescript,
165-
isSPA = argv.spa,
169+
needsRouter = argv.router,
166170
needsTests = argv.tests
167171
} = result
168172
const root = path.join(cwd, targetDir)
@@ -220,7 +224,7 @@ async function init() {
220224
// prettier-ignore
221225
const codeTemplate =
222226
(needsTypeScript ? 'typescript-' : '') +
223-
(isSPA ? 'spa' : 'default')
227+
(needsRouter ? 'router' : 'default')
224228
render(`code/${codeTemplate}`)
225229

226230
// TODO:

β€Žtemplate/code/router/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"vue-router": "^4.0.10"
4+
}
5+
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { createApp } from 'vue'
22
import App from './App.vue'
3-
43
import router from './router'
5-
import store from './store'
64

75
const app = createApp(App)
86

97
app.use(router)
10-
app.use(store)
118

129
app.mount('#app')

0 commit comments

Comments
Β (0)