Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2eda924

Browse filesBrowse files
committed
update build script
1 parent c72a994 commit 2eda924
Copy full SHA for 2eda924

File tree

Expand file treeCollapse file tree

5 files changed

+108
-61
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+108
-61
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+1Lines changed: 1 addition & 0 deletions
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

‎build/build.js

Copy file name to clipboardExpand all lines: build/build.js
+64-53Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,73 +23,84 @@ rollup.rollup({
2323
loose: 'all'
2424
})
2525
]
26-
}).then(function (bundle) {
27-
write('dist/vue.common.js', bundle.generate({
26+
})
27+
.then(function (bundle) {
28+
return write('dist/vue.common.js', bundle.generate({
2829
format: 'cjs'
2930
}).code)
30-
}).catch(logError)
31-
31+
})
3232
// Standalone Dev Build
33-
rollup.rollup({
34-
entry: 'src/index.js',
35-
plugins: [
36-
replace({
37-
'process.env.NODE_ENV': "'development'"
38-
}),
39-
babel({
40-
loose: 'all'
41-
})
42-
]
43-
}).then(function (bundle) {
44-
write('dist/vue.js', bundle.generate({
45-
format: 'umd',
46-
banner: banner,
47-
moduleName: 'Vue'
48-
}).code)
49-
}).catch(logError)
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)
5079

51-
// Standalone Production Build
52-
rollup.rollup({
53-
entry: 'src/index.js',
54-
plugins: [
55-
replace({
56-
'process.env.NODE_ENV': "'production'"
57-
}),
58-
babel({
59-
loose: 'all'
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()
6086
})
61-
]
62-
}).then(function (bundle) {
63-
var code = bundle.generate({
64-
format: 'umd',
65-
moduleName: 'Vue'
66-
}).code
67-
var minified = banner + '\n' + uglify.minify(code, {
68-
fromString: true
69-
}).code
70-
write('dist/vue.min.js', minified, zip)
71-
}).catch(logError)
72-
73-
function write (dest, code, cb) {
74-
fs.writeFile(dest, code, function (err) {
75-
if (err) throw err
76-
console.log(blue('built: ') + dest + ' ' + getSize(code))
77-
cb && cb()
7887
})
7988
}
8089

8190
function zip () {
82-
fs.readFile('dist/vue.min.js', function (err, buf) {
83-
if (err) throw err
84-
zlib.gzip(buf, function (err, buf) {
85-
if (err) throw err
86-
write('dist/vue.min.js.gz', buf)
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+
})
8798
})
8899
})
89100
}
90101

91102
function getSize (code) {
92-
return '(' + (code.length / 1024).toFixed(2) + 'kb)'
103+
return (code.length / 1024).toFixed(2) + 'kb'
93104
}
94105

95106
function logError (e) {

‎build/ci.sh

Copy file name to clipboard
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
set -e
12
if [ -z "$CI_PULL_REQUEST" ]
23
then
3-
npm run lint &&\
4-
npm run cover &&\
4+
npm run lint
5+
npm run cover
56
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
6-
npm run build &&\
7-
npm run e2e &&\
7+
npm run build
8+
npm run e2e
89
npm run sauce-all
910
else
10-
npm run lint &&\
11-
npm run cover &&\
12-
npm run build &&\
11+
npm run lint
12+
npm run cover
13+
npm run build
1314
npm run e2e
1415
fi

‎build/release.sh

Copy file name to clipboard
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
set -e
2+
echo "Enter release version: "
3+
read VERSION
4+
5+
read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
6+
echo # (optional) move to a new line
7+
if [[ $REPLY =~ ^[Yy]$ ]]
8+
then
9+
echo "Releasing $VERSION ..."
10+
11+
# lint and test
12+
npm run lint 2>/dev/null
13+
npm run unit 2>/dev/null
14+
npm run cover 2>/dev/null
15+
16+
# build
17+
VERSION=$VERSION npm run build
18+
19+
# e2e
20+
npm run e2e 2>/dev/null
21+
# sauce
22+
npm run sauce-all 2>/dev/null
23+
24+
# commit
25+
git add -A
26+
git commit -m "[build] $VERSION"
27+
npm version $VERSION --message "[release] $VERSION"
28+
29+
# publish
30+
git push origin refs/tags/v$VERSION
31+
git push
32+
npm publish
33+
fi

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"unit": "karma start build/karma.unit.config.js",
2929
"cover": "karma start build/karma.cover.config.js",
3030
"sauce": "karma start build/karma.sauce.config.js",
31-
"sauce-all": "npm run sauce && npm run sauce -- 1 && npm run sauce -- 2"
31+
"sauce-all": "npm run sauce && npm run sauce -- 1 && npm run sauce -- 2",
32+
"release": "bash build/release.sh"
3233
},
3334
"dependencies": {
3435
"envify": "^3.4.0"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.