Skip to content

Commit 9dc0d7d

Browse files
committed
use ES2015 + new build setup
1 parent 9ba1358 commit 9dc0d7d

File tree

162 files changed

+8326
-8164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+8326
-8164
lines changed

.eslintrc

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88
"jQuery": true
99
},
1010

11+
"ecmaFeatures": {
12+
"arrowFunctions": true,
13+
"destructuring": true,
14+
"classes": true,
15+
"defaultParams": true,
16+
"blockBindings": true,
17+
"modules": true,
18+
"objectLiteralComputedProperties": true,
19+
"objectLiteralShorthandMethods": true,
20+
"objectLiteralShorthandProperties": true,
21+
"restParams": true,
22+
"spread": true,
23+
"templateStrings": true
24+
},
25+
1126
"rules": {
1227
"accessor-pairs": 2,
1328
"array-bracket-spacing": 0,

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
dist/vue.js.map
22
dist/vue.min.js.gz
3+
dist/vue.common.js
34
test/unit/specs.js
45
test/unit/specs.js.map
56
explorations

.npmignore

-15
This file was deleted.

CONTRIBUTING.md

+8-19
Original file line numberDiff line numberDiff line change
@@ -62,49 +62,38 @@ Hi! I’m really excited that you are interested in contributing to Vue.js. Befo
6262

6363
## Development Setup
6464

65-
You will need [Node.js](http://nodejs.org) & [Grunt](http://gruntjs.com).
65+
You will need [Node.js](http://nodejs.org).
6666

6767
``` bash
68-
$ npm install -g grunt-cli
6968
$ npm install
7069
# install pre-commit lint hook
7170
$ npm run install-hook
7271
```
7372

74-
Dev mode: watch and auto-build `dist/vue.js` and unit tests during development:
73+
Dev mode: watch and auto-build `dist/vue.js` and serve unit tests at `http://localhost:8080` during development:
7574

7675
``` bash
7776
$ npm run dev
7877
```
7978

80-
The unit tests can be run in a browser by opening `test/unit/runner.html`. Make sure you are running dev mode first. There's a shortcut grunt task for opening the unit test page:
81-
82-
``` bash
83-
$ grunt open
84-
```
85-
8679
To lint:
8780

8881
``` bash
89-
$ grunt eslint
82+
$ npm run lint
9083
```
9184

9285
To build:
9386

9487
``` bash
95-
$ grunt build
88+
$ npm run build
9689
```
9790

98-
Run full test suite (see browser notes below):
91+
Run default test suite:
9992

10093
``` bash
101-
$ grunt test
94+
$ npm test
10295
```
10396

104-
The default task (by simply running `grunt`) will do the following: lint -> build -> unit tests -> e2e tests. It is required to have this pass successfully for a PR to be considered.
105-
106-
The unit tests are written with Jasmine and run with Karma. The e2e tests are written for and run with CasperJS.
107-
108-
### Test Browser Notes
97+
The default test script will do the following: lint -> unit tests with coverage -> build -> e2e tests. **Please make sure to have this pass successfully before submitting a PR.**
10998

110-
When running the default `grunt` task, the unit tests will automatically be run in Chrome, Firefox and Safari. If you are not on a Mac, or don't have one of the browsers installed on your system, you can modify the [karma config in gruntfile.js](https://github.com/vuejs/vue/blob/dev/gruntfile.js#L38) to only run Karma tests in browsers that are available on your system. Just make sure don’t check in the gruntfile changes for the commit.
99+
The unit tests are written with [Jasmine](http://jasmine.github.io/2.3/introduction.html) and run with [Karma](http://karma-runner.github.io/0.13/index.html). The e2e tests are written for and run with [CasperJS](http://casperjs.org/).

build/build.js

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
var fs = require('fs')
2+
var zlib = require('zlib')
3+
var rollup = require('rollup')
4+
var uglify = require('uglify-js')
5+
var babel = require('rollup-plugin-babel')
6+
var replace = require('rollup-plugin-replace')
7+
var version = process.env.VERSION || require('../package.json').version
8+
9+
var banner =
10+
'/*!\n' +
11+
' * Vue.js v' + version + '\n' +
12+
' * (c) ' + new Date().getFullYear() + ' Evan You\n' +
13+
' * Released under the MIT License.\n' +
14+
' */'
15+
16+
// CommonJS build.
17+
// this is used as the "main" field in package.json
18+
// and used by bundlers like Webpack and Browserify.
19+
rollup.rollup({
20+
entry: 'src/index.js',
21+
plugins: [
22+
babel({
23+
loose: 'all'
24+
})
25+
]
26+
})
27+
.then(function (bundle) {
28+
return write('dist/vue.common.js', bundle.generate({
29+
format: 'cjs'
30+
}).code)
31+
})
32+
// Standalone Dev Build
33+
.then(function () {
34+
return rollup.rollup({
35+
entry: 'src/index.js',
36+
plugins: [
37+
replace({
38+
'process.env.NODE_ENV': "'development'"
39+
}),
40+
babel({
41+
loose: 'all'
42+
})
43+
]
44+
})
45+
.then(function (bundle) {
46+
return write('dist/vue.js', bundle.generate({
47+
format: 'umd',
48+
banner: banner,
49+
moduleName: 'Vue'
50+
}).code)
51+
})
52+
})
53+
.then(function () {
54+
// Standalone Production Build
55+
return rollup.rollup({
56+
entry: 'src/index.js',
57+
plugins: [
58+
replace({
59+
'process.env.NODE_ENV': "'production'"
60+
}),
61+
babel({
62+
loose: 'all'
63+
})
64+
]
65+
})
66+
.then(function (bundle) {
67+
var code = bundle.generate({
68+
format: 'umd',
69+
moduleName: 'Vue'
70+
}).code
71+
var minified = banner + '\n' + uglify.minify(code, {
72+
fromString: true
73+
}).code
74+
return write('dist/vue.min.js', minified)
75+
})
76+
.then(zip)
77+
})
78+
.catch(logError)
79+
80+
function write (dest, code) {
81+
return new Promise(function (resolve, reject) {
82+
fs.writeFile(dest, code, function (err) {
83+
if (err) return reject(err)
84+
console.log(blue(dest) + ' ' + getSize(code))
85+
resolve()
86+
})
87+
})
88+
}
89+
90+
function zip () {
91+
return new Promise(function (resolve, reject) {
92+
fs.readFile('dist/vue.min.js', function (err, buf) {
93+
if (err) return reject(err)
94+
zlib.gzip(buf, function (err, buf) {
95+
if (err) return reject(err)
96+
write('dist/vue.min.js.gz', buf).then(resolve)
97+
})
98+
})
99+
})
100+
}
101+
102+
function getSize (code) {
103+
return (code.length / 1024).toFixed(2) + 'kb'
104+
}
105+
106+
function logError (e) {
107+
console.log(e)
108+
}
109+
110+
function blue (str) {
111+
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
112+
}

build/ci.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set -e
2+
if [ -z "$CI_PULL_REQUEST" ]
3+
then
4+
npm run lint
5+
npm run cover
6+
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
7+
npm run build
8+
npm run e2e
9+
npm run sauce-all
10+
else
11+
npm test
12+
fi

build/grunt-tasks/build.js

-69
This file was deleted.

build/grunt-tasks/casper.js

-26
This file was deleted.

build/grunt-tasks/codecov.js

-18
This file was deleted.

build/grunt-tasks/open.js

-11
This file was deleted.

0 commit comments

Comments
 (0)