Skip to content

Commit 3e3e1f0

Browse files
committed
V1
1 parent c7f6f68 commit 3e3e1f0

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

generator/index.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
module.exports = () => {}
1+
module.exports = (api, options) => {
2+
api.extendPackage({
3+
dependencies: {
4+
'vue-extend-layout': '^2.0.5'
5+
}
6+
})
7+
8+
if (options.addLayoutsTemplate) {
9+
api.render('./template')
10+
const fs = require('fs')
11+
const appPath = api.resolve('src/App.vue')
12+
return api.onCreateComplete(() => {
13+
try {
14+
const tplAppPath = api.resolve('src/layouts/App.vue')
15+
fs.copyFileSync(appPath, 'src/layouts/default.vue')
16+
fs.copyFileSync(tplAppPath, 'src/App.vue')
17+
fs.unlink(tplAppPath)
18+
19+
api.exitLog('Successfully installed, to learn more: https://github.com/ktquez/vue-extend-layout', 'info')
20+
} catch (e) {
21+
api.exitLog('Your main file couldn\'t be modified. Please, visit our repository to learn more about how to manually generate layouts: https://github.com/ktquez/vue-extend-layout#create-and-using-layouts', 'warn')
22+
}
23+
})
24+
}
25+
26+
api.exitLog('Visit the vue-extend-layout repository to learn more about how to manually generate layouts: https://github.com/ktquez/vue-extend-layout#create-and-using-layouts', 'info')
27+
}

generator/template.js

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div id="app">
3+
<vue-extend-layouts />
4+
</div>
5+
</template>
6+
7+
<script>
8+
import VueExtendLayouts from 'vue-extend-layout'
9+
export default {
10+
name: 'App',
11+
components: { VueExtendLayouts }
12+
}
13+
</script>

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-plugin-layouts",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "vue-cli 3 plugin Multiple layouts in your SPA with vue-extend-layout",
55
"main": "index.js",
66
"repository": {

prompt.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

prompts.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = [
2+
{
3+
name: `addLayoutsTemplate`,
4+
type: 'confirm',
5+
message: 'Use layouts template?',
6+
default: true
7+
}
8+
]

0 commit comments

Comments
 (0)