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

Commit 89845da

Browse files
author
Walker Leite
committed
fix(build): fix build proccess and documentation
1 parent ae38fb3 commit 89845da

File tree

6 files changed

+44
-27
lines changed

6 files changed

+44
-27
lines changed

template/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.DS_Store
22
node_modules/
33
dist/
4+
cjs/
5+
umd/
46
styleguide/
57
npm-debug.log
68
yarn-error.log

template/README.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
> {{ description }}
44
5-
# Usage
5+
## Installation
66

7-
## ES6 Modules / CommonJS
7+
### Using yarn
88

9-
```bash
10-
$ npm run build
11-
```
9+
`yarn add {{ name }}`
10+
11+
### Using npm
12+
13+
`npm i --save {{ name }}`
14+
15+
## Demo and Docs
16+
17+
`npm run serve`
18+
19+
## Usage
20+
21+
### With [vue-loader](https://github.com/vuejs/vue-loader) or [vueify](https://github.com/vuejs/vueify)
1222

1323
```js
14-
import {{ camelcase name }} from 'dist/{{ name }}';
24+
import {{ camelcase name }} from '{{ name }}.vue';
1525

1626
Vue.component('{{ name }}', {{ camelcase name }});
1727
```
@@ -20,36 +30,36 @@ Vue.component('{{ name }}', {{ camelcase name }});
2030
<{{name}} text="Hello World!"></{{name}}>
2131
```
2232

23-
## UMD
33+
### ES6 Modules / CommonJS
34+
35+
```js
36+
import {{ camelcase name }} from '{{ name }}/cjs/{{ name }}.min.js';
37+
import '{{ name }}/cjs/{{ name }}.min.css';
38+
39+
Vue.component('{{ name }}', {{ camelcase name }});
40+
```
2441

25-
```bash
26-
$ npm run build:umd
42+
```html
43+
<{{name}} text="Hello World!"></{{name}}>
2744
```
2845

46+
### UMD
47+
2948
```html
3049
<{{name}} text="Hello World!"></{{name}}>
3150

3251
<script src="https://unpkg.com/vue" charset="utf-8"></script>
33-
<script src="./dist/{{ name }}.min.js" charset="utf-8"></script>
52+
<script src="./umd/{{ name }}.min.js" charset="utf-8"></script>
53+
<link rel="stylesheet" type="text/css" href="./umd/{{ name }}.min.css">
3454

3555
<script type="text/javascript">
3656
Vue.component('{{ name }}', window.{{ camelcase name }});
3757
</script>
3858
```
3959

40-
## Installation
41-
42-
### Using yarn
60+
## Build
4361

44-
`yarn add {{ name }}`
45-
46-
### Using npm
47-
48-
`npm i --save {{ name }}`
49-
50-
## Demo and Docs
51-
52-
`npm run serve`
62+
Build configuration is located in the `poi.config.js` file, to build just run: `npm run build`, it will build to `cjs` and `umd` directories.
5363

5464
## Tests
5565

template/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
"version": "0.0.1",
44
"description": "{{ description }}",
55
"author": "{{ author }}",
6-
"main": "dist/{{name}}.min.js",
6+
"main": "src/{{name}}/{{name}}.vue",
77
"license": "MIT",
88
"scripts": {
99
"lint": "eslint src/**/*.vue",
10-
"build": "poi build --format cjs",
11-
"build:umd": "poi build --format umd",
10+
"build": "poi build --format cjs --dist cjs; poi build --format umd --dist umd",
1211
"build:doc": "vue-styleguidist build",
1312
"serve": "vue-styleguidist server",
1413
"test": "poi test",
@@ -20,7 +19,8 @@
2019
"component"
2120
],
2221
"files": [
23-
"dist/"
22+
"umd/",
23+
"cjs/"
2424
],
2525
"dependencies": {
2626
"vue": "^2.5.3"

template/poi.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
entry: glob('./src/**/*.vue'),
88
filename: {
99
js: name + '.min.js',
10+
css: name + '.min.css',
1011
},
1112
sourceMap: true,
1213
html: false,

template/src/Component/Component.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ export default {
2020
},
2121
}
2222
</script>
23+
24+
<style lang="css" scoped>
25+
/* place here your styles */
26+
</style>

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const commands = [
55
{cmd: './node_modules/.bin/vue', args: ['init', '.', 'test-cmp'], yes: true},
66
{cmd: 'npm', args: ['install'], cwd: 'test-cmp'},
77
{cmd: 'npm', args: ['run', 'lint'], cwd: 'test-cmp'},
8-
{cmd: 'npm', args: ['run', 'build:umd'], cwd: 'test-cmp'},
8+
{cmd: 'npm', args: ['run', 'build'], cwd: 'test-cmp'},
99
{cmd: 'npm', args: ['run', 'build:doc'], cwd: 'test-cmp'},
1010
{cmd: 'npm', args: ['run', 'test'], cwd: 'test-cmp'},
1111
{cmd: 'npm', args: ['run', 'test:cov'], cwd: 'test-cmp'}

0 commit comments

Comments
 (0)