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/v1.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
janschoenherr committed Mar 2, 2021
2 parents a6add1c + 6e4b446 commit 46f757a
Show file tree
Hide file tree
Showing 14 changed files with 7,314 additions and 5,649 deletions.
10 changes: 10 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {

presets: [
['@babel/preset-env', {
loose: true,
modules: false
}]
]

};
17 changes: 7 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2

defaults: &defaults
docker:
- image: circleci/node:9-browsers
- image: circleci/node:10-browsers
environment:
CHROME_BIN: /usr/bin/google-chrome
working_directory: ~/vue-resource
Expand All @@ -11,24 +11,21 @@ jobs:
build:
<<: *defaults
steps:
- run:
name: Update Environment
command: echo 'export PATH=$CIRCLE_WORKING_DIRECTORY/node_modules/.bin:$PATH' >> $BASH_ENV
- checkout
- restore_cache:
key: yarn-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --pure-lockfile --cache-folder ~/.yarn
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- ~/.yarn
command: yarn --pure-lockfile
- run:
name: Run Tests
command: |
yarn test
karma start test/karma.conf.js --single-run --browsers Chrome,Firefox
yarn karma --browsers Chrome
- run:
name: Build Release
command: yarn build
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# vue-resource [![Build](https://img.shields.io/circleci/project/pagekit/vue-resource/develop.svg)](https://circleci.com/gh/pagekit/vue-resource) [![Downloads](https://img.shields.io/npm/dm/vue-resource.svg)](https://www.npmjs.com/package/vue-resource) [![jsdelivr](https://data.jsdelivr.com/v1/package/npm/vue-resource/badge?style=rounded)](https://www.jsdelivr.com/package/npm/vue-resource) [![Version](https://img.shields.io/npm/v/vue-resource.svg)](https://www.npmjs.com/package/vue-resource) [![License](https://img.shields.io/npm/l/vue-resource.svg)](https://www.npmjs.com/package/vue-resource)
# vue-resource [![Build](https://circleci.com/gh/pagekit/vue-resource.svg?style=shield)](https://circleci.com/gh/pagekit/vue-resource) [![Downloads](https://img.shields.io/npm/dm/vue-resource.svg)](https://www.npmjs.com/package/vue-resource) [![jsdelivr](https://data.jsdelivr.com/v1/package/npm/vue-resource/badge?style=rounded)](https://www.jsdelivr.com/package/npm/vue-resource) [![Version](https://img.shields.io/npm/v/vue-resource.svg)](https://www.npmjs.com/package/vue-resource) [![License](https://img.shields.io/npm/l/vue-resource.svg)](https://www.npmjs.com/package/vue-resource)

The plugin for [Vue.js](http://vuejs.org) provides services for making web requests and handle responses using a [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) or JSONP.

Expand All @@ -18,9 +18,9 @@ $ npm install vue-resource
```

### CDN
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-resource@1.5.1), [unpkg](https://unpkg.com/vue-resource@1.5.1) or [cdnjs](https://cdnjs.com/libraries/vue-resource).
Available on [jsdelivr](https://cdn.jsdelivr.net/npm/vue-resource@1.5.2), [unpkg](https://unpkg.com/vue-resource@1.5.2) or [cdnjs](https://cdnjs.com/libraries/vue-resource).
```html
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.1"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.5.2"></script>
```

## Example
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-resource",
"main": "dist/vue-resource.js",
"version": "1.5.1",
"version": "1.5.2",
"description": "The HTTP client for Vue.js",
"homepage": "https://github.com/pagekit/vue-resource",
"license": "MIT",
Expand All @@ -17,4 +17,4 @@
"docs",
"package.json"
]
}
}
71 changes: 38 additions & 33 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
/* eslint-env node */

var fs = require('fs');
var rollup = require('rollup');
var uglify = require('uglify-js');
var buble = require('rollup-plugin-buble');
var {version} = require('../package.json');
var banner =
'/*!\n' +
' * vue-resource v' + version + '\n' +
' * https://github.com/pagekit/vue-resource\n' +
' * Released under the MIT License.\n' +
' */\n';
const fs = require('fs');
const zlib = require('zlib');
const rollup = require('rollup');
const uglify = require('uglify-js');
const babel = require('rollup-plugin-babel');
const replace = require('rollup-plugin-replace');
const {name, version, homepage} = require('../package.json');
const banner = `/*!\n * ${name} v${version}\n * ${homepage}\n * Released under the MIT License.\n */\n`;

rollup.rollup({
input: 'src/index.js',
plugins: [buble()]
plugins: [babel(), replace({__VERSION__: version})]
})
.then(bundle =>
bundle.generate({
format: 'umd',
banner: banner,
name: 'VueResource'
}).then(({code}) => write('dist/vue-resource.js', code, bundle))
bundle.generate({
banner,
format: 'umd',
name: 'VueResource'
}).then(({code}) => write(`dist/${name}.js`, code, bundle))
)
.then(bundle =>
write('dist/vue-resource.min.js', banner + '\n' +
uglify.minify(read('dist/vue-resource.js')).code,
bundle)
write(`dist/${name}.min.js`, banner + '\n' +
uglify.minify(read(`dist/${name}.js`)).code, bundle, true)
)
.then(bundle =>
bundle.generate({
format: 'es',
banner: banner,
footer: 'export { Url, Http, Resource };'
}).then(({code}) => write('dist/vue-resource.esm.js', code, bundle))
bundle.generate({
banner,
format: 'es',
footer: 'export { Url, Http, Resource };'
}).then(({code}) => write(`dist/${name}.esm.js`, code, bundle))
)
.then(bundle =>
bundle.generate({
format: 'cjs',
banner: banner
}).then(({code}) => write('dist/vue-resource.common.js', code, bundle))
bundle.generate({
banner,
format: 'cjs'
}).then(({code}) => write(`dist/${name}.common.js`, code, bundle))
)
.catch(logError);

function read(path) {
return fs.readFileSync(path, 'utf8');
}

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

if (zip) {
zlib.gzip(code, (err, zipped) => {
if (err) return reject(err);
console.log(blue(dest) + ' ' + getSize(code) + ' (' + getSize(zipped) + ' gzipped)');
});
} else {
console.log(blue(dest) + ' ' + getSize(code));
}

resolve(bundle);
});
});
Expand Down
Loading

0 comments on commit 46f757a

Please sign in to comment.