Skip to content

Commit f103896

Browse files
committed
fix add router
1 parent f0a1702 commit f103896

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ module.exports = {
3838
"src/store/**/*": "vuex",
3939
"typings/interface/state.d.ts": "vuex"
4040
},
41-
"completeMessage": "{{#inPlace}}To get started:\n\n npm install\n npm run dev.{{else}}To get started:\n\n cd {{destDirName}}\n yarn\n yarn dll\n npm run dev.{{/inPlace}}"
41+
"completeMessage": "{{#inPlace}}To get started:\n\n npm install\n npm run dev.{{else}}To get started:\n\n cd {{destDirName}}\n yarn\n yarn dll\n yarn dev.{{/inPlace}}"
4242
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-template-typescript",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"license": "MIT",
55
"description": "Vue use typescript",
66
"scripts": {

template/.stylelintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**
22
* stylelint 配置
3-
* @author Allenice <994298628@qq.com>
4-
* @date 2017-07-20 09:57:50
53
*/
64

75
module.exports = {

template/tools/command/router.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,23 @@ let user = os.userInfo({ encoding: 'utf8' })
2121
const tab = ' '
2222

2323
function build(data) {
24-
let outFile = data.outFile
24+
let outFile: string = data.outFile
25+
let viewPath: string = data.args.viewPath
26+
let srcReg = /^src\//
27+
28+
// 如果 src 开头的话,去掉 src
29+
if (srcReg.test(viewPath)) {
30+
viewPath = viewPath.replace(srcReg, '')
31+
}
32+
2533
let renderData = {
2634
username: data.context.username,
2735
curDate: data.context.curDate,
2836
version: data.context.version,
2937
routerName: data.args.routerName,
30-
componentPath: data.args.viewPath
38+
componentPath: viewPath
3139
}
40+
3241
let code = compileFile(
3342
path.join(__dirname, '../tpl/router/router.ts.txt'),
3443
renderData

0 commit comments

Comments
 (0)