Skip to content

Commit d2ff7de

Browse files
author
Guillaume Chau
authored
Merge pull request #62 from Austio/add-build-script
Add build script using rollup
2 parents 6a28b75 + 4dc19d4 commit d2ff7de

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["stage-0"]
3+
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
node_modules/
2-
lib/
2+
dist/

package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "vue-apollo",
33
"version": "2.1.0-beta.9",
44
"description": "Vue apollo integration",
5-
"main": "lib/index.js",
5+
"main": "dist/main.min.js",
66
"scripts": {
7-
"compile": "babel --presets es2015,stage-0 -d lib/ src/",
8-
"prepublish": "npm run compile",
7+
"build": "rimraf ./dist && ./node_modules/.bin/rollup -c",
8+
"prepublish": "npm run build",
99
"dev": "npm-watch"
1010
},
1111
"watch": {
12-
"compile": "src/*.js"
12+
"build": "src/*.js"
1313
},
1414
"repository": {
1515
"type": "git",
@@ -38,12 +38,18 @@
3838
"devDependencies": {
3939
"babel-cli": "^6.14.0",
4040
"babel-eslint": "^7.1.1",
41-
"babel-preset-es2015": "^6.14.0",
42-
"babel-preset-stage-0": "^6.16.0",
41+
"babel-preset-stage-0": "^6.24.1",
4342
"eslint": "^3.12.1",
4443
"eslint-config-standard": "^7.1.0",
4544
"eslint-plugin-promise": "^3.4.0",
4645
"eslint-plugin-standard": "^2.0.1",
47-
"npm-watch": "^0.1.6"
46+
"npm-watch": "^0.1.6",
47+
"rimraf": "^2.6.1",
48+
"rollup": "^0.41.6",
49+
"rollup-plugin-babel": "^2.7.1",
50+
"rollup-plugin-commonjs": "^8.0.2",
51+
"rollup-plugin-node-resolve": "^3.0.0",
52+
"rollup-plugin-uglify": "^1.0.2",
53+
"uglify-js-harmony": "^2.7.7"
4854
}
4955
}

rollup.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import commonjs from 'rollup-plugin-commonjs';
2+
import resolve from 'rollup-plugin-node-resolve';
3+
import babel from 'rollup-plugin-babel';
4+
import uglify from 'rollup-plugin-uglify';
5+
import { minify } from 'uglify-js-harmony';
6+
7+
export default {
8+
entry: 'src/index.js',
9+
dest: 'dist/main.min.js',
10+
format: 'iife',
11+
exports: 'named',
12+
moduleName: 'vue-apollo',
13+
plugins: [
14+
resolve({
15+
jsnext: true,
16+
main: true,
17+
browser: true,
18+
}),
19+
commonjs(),
20+
babel({
21+
exclude: 'node_modules/**',
22+
}),
23+
uglify({}, minify)
24+
],
25+
};

0 commit comments

Comments
 (0)