Skip to content
This repository was archived by the owner on Apr 1, 2019. It is now read-only.

Commit 77e854f

Browse files
committed
change default build to commonjs
add option to build to umd change build tool
1 parent 5500306 commit 77e854f

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

template/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44
55
# Usage
66

7+
```js
8+
import Component from '{{name}}'
9+
10+
Vue.component('{{name}}', Component);
11+
```
12+
713
<{{name}} text="Hello World!"></{{name}}>
814

15+
PS: You can also build to UMD with `npm run build:umd`, the component will be
16+
available in the window['{{name}}'] variable.
17+
918
## Installation
1019

1120
### Using yarn

template/build.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

template/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
"version": "0.0.1",
44
"description": "{{ description }}",
55
"author": "{{ author }}",
6-
"main": "dist/index.js",
6+
"main": "dist/{{name}}.min.js",
77
"license": "MIT",
88
"scripts": {
99
"lint": "eslint src",
10-
"build": "vue build ./src/index.js --config ./build.config.js --dist ./dist/ --prod --lib",
10+
"build": "poi build --format cjs",
11+
"build:umd": "poi build --format umd",
1112
"build:doc": "vue-styleguidist build",
1213
"serve": "vue-styleguidist server"
1314
},
@@ -25,7 +26,8 @@
2526
"babel-preset-es2015": "^6.24.1",
2627
"eslint": "^3.17.1",
2728
"eslint-plugin-vue": "beta",
28-
"vue-cli": "^2.8.2",
29+
"node-glob": "^1.2.0",
30+
"poi": "^9.3.10",
2931
"vue-styleguidist": "^1.2.5",
3032
"vue-webpack-loaders": "^1.0.6",
3133
"webpack": "^3.1.0"

template/poi.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const glob = require('glob').sync;
2+
const {name} = require('./package.json');
3+
4+
module.exports = {
5+
entry: glob('./src/**/*.vue'),
6+
filename: {
7+
js: name + '.min.js',
8+
},
9+
sourceMap: false,
10+
html: false
11+
};

template/src/index.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

template/styleguide.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
/* The component itself */
1010
name: '{{ name }}',
1111
content: 'docs/Introduction.md',
12-
components: 'src/**/{{ name }}.vue',
12+
components: 'src/**/*.vue',
1313
// ignore: ['src/ignored-component/ignored-component.vue'],
1414
sections: [
1515
/* One item for each demo or example of the component */

0 commit comments

Comments
 (0)