Skip to content

Commit f554381

Browse files
committed
fix injecting code in App.vue file
1 parent ad0c332 commit f554381

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

generator/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ module.exports = (api) => {
66
'vue-extensionpoints': '^0.1.4',
77
},
88
})
9-
const appPath = api.resolve('src/App.vue')
10-
if (fs.existsSync(appPath)) {
11-
let content = fs.readFileSync(appPath, { encoding: 'utf8' })
12-
content = content.replace(/HelloWorld/gi, 'ExtensionpointExample')
13-
fs.writeFileSync(appPath, content, { encoding: 'utf8' })
14-
}
15-
api.render('./template')
9+
api.render('./template');
1610

1711
// add import
1812
api.injectImports(api.entryFile,
@@ -34,5 +28,12 @@ module.exports.hooks = (api) => {
3428
lines[renderIndex] = `Vue.use(Extensionpoints, plugins)${EOL}${EOL}` + lines[renderIndex]
3529
fs.writeFileSync(api.entryFile, lines.join(EOL), { encoding: 'utf-8' })
3630
}
31+
32+
const appPath = api.resolve('src/App.vue')
33+
if (fs.existsSync(appPath)) {
34+
let content = fs.readFileSync(appPath, { encoding: 'utf8' })
35+
content = content.replace(/HelloWorld/gi, 'ExtensionpointExample')
36+
fs.writeFileSync(appPath, content)
37+
}
3738
})
3839
}

0 commit comments

Comments
 (0)