Skip to content

Commit f17e515

Browse files
committed
core: add basic structure
1 parent a0dc6c8 commit f17e515

File tree

9 files changed

+106
-1
lines changed

9 files changed

+106
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# vue-cli-plugin-element
1+
# vue-cli-plugin-element
2+
3+
Quickly build a backend system with vue-cli and element-ui in seconds.

generator.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fs = require('fs')
2+
3+
const removeFiles = (files = []) => {
4+
files.forEach(path => {
5+
if (fs.existsSync(path)) {
6+
fs.unlinkSync(path);
7+
}
8+
})
9+
}
10+
11+
module.exports = (api, options, rootOptions) => {
12+
api.extendPackage({
13+
dependencies: {
14+
'element-ui': '^2.4.11'
15+
},
16+
})
17+
18+
api.injectImports(api.entryFile, `import './registerElementUI'`)
19+
20+
api.render('./template/structure')
21+
22+
api.onCreateComplete(() => {
23+
removeFiles([
24+
api.resolve('src/components/HelloWorld.vue')
25+
])
26+
})
27+
}

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = (api, projectOptions) => {
2+
api.chainWebpack(webpackConfig => {})
3+
4+
api.configureWebpack(webpackConfig => {})
5+
6+
// api.registerCommand('command', args => {})
7+
}

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "vue-cli-plugin-element",
3+
"version": "0.1.0",
4+
"description": "Quickly build a backend system with vue-cli and element-ui in seconds.",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "yarn test"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/codetrial/vue-cli-plugin-element.git"
12+
},
13+
"keywords": [
14+
"vue",
15+
"cli",
16+
"element",
17+
"layout",
18+
"structure"
19+
],
20+
"author": "felixpy",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/codetrial/vue-cli-plugin-element/issues"
24+
},
25+
"homepage": "https://github.com/codetrial/vue-cli-plugin-element#readme"
26+
}

preset.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"useConfigFiles": true,
3+
"plugins": {
4+
"@vue/cli-plugin-babel": {},
5+
"@vue/cli-plugin-pwa": {},
6+
"@vue/cli-plugin-eslint": {
7+
"config": "airbnb",
8+
"lintOn": [
9+
"save"
10+
]
11+
},
12+
"@vue/cli-plugin-unit-jest": {}
13+
},
14+
"router": true,
15+
"routerHistoryMode": true,
16+
"vuex": true,
17+
"cssPreprocessor": "sass"
18+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<div>This is the layout</div>
3+
</template>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Vue from 'vue'
2+
import ElementUI from 'element-ui'
3+
4+
import './styles/theme/element-variables.scss'
5+
6+
Vue.use(ElementUI)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$--color-primary: #409eff;
2+
3+
$--font-path: '~element-ui/lib/theme-chalk/fonts';
4+
5+
@import "~element-ui/packages/theme-chalk/src/index";

template/structure/src/views/Home.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<div class="home">
3+
<img alt="Vue logo" src="../assets/logo.png">
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: "home"
10+
};
11+
</script>

0 commit comments

Comments
 (0)