Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
steffans committed Jun 15, 2016
2 parents 7bba0a5 + 515db07 commit a27faff
Show file tree
Hide file tree
Showing 22 changed files with 2,838 additions and 1,519 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vue-resource",
"main": "dist/vue-resource.js",
"description": "A web request service for Vue.js",
"version": "0.7.4",
"version": "0.8.0",
"homepage": "https://github.com/vuejs/vue-resource",
"license": "MIT",
"ignore": [
Expand Down
42 changes: 18 additions & 24 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ var banner =
" * Released under the MIT License.\n" +
" */\n";

// Standalone
rollup.rollup({
entry: 'src/index.js',
plugins: [
Expand All @@ -25,50 +24,45 @@ rollup.rollup({
format: 'umd',
banner: banner,
moduleName: 'VueResource'
}).code);
}).code, bundle);
})
.then(function () {
return write(
'dist/vue-resource.min.js',
banner + '\n' + uglify.minify('dist/vue-resource.js').code
);
.then(function (bundle) {
return write('dist/vue-resource.min.js',
banner + '\n' + uglify.minify('dist/vue-resource.js').code,
bundle);
})
.catch(logError);

// CommonJS
rollup.rollup({
entry: 'src/index.js',
plugins: [
babel({
presets: ['es2015-rollup']
})
]
.then(function (bundle) {
return write('dist/vue-resource.es2015.js', bundle.generate({
banner: banner,
footer: 'export { Url, Http, Resource };'
}).code, bundle);
})
.then(function (bundle) {
return write('dist/vue-resource.common.js', bundle.generate({
format: 'cjs',
banner: banner
}).code);
});
}).code, bundle);
})
.catch(logError);

function write (dest, code) {
function write(dest, code, bundle) {
return new Promise(function (resolve, reject) {
fs.writeFile(dest, code, function (err) {
if (err) return reject(err);
console.log(blue(dest) + ' ' + getSize(code));
resolve();
resolve(bundle);
});
});
}

function getSize (code) {
function getSize(code) {
return (code.length / 1024).toFixed(2) + 'kb';
}

function logError (e) {
function logError(e) {
console.log(e);
}

function blue (str) {
function blue(str) {
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m';
}
Loading

0 comments on commit a27faff

Please sign in to comment.