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/1.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Feb 11, 2018
2 parents 0fe6533 + ea80f37 commit d0b845a
Show file tree
Hide file tree
Showing 37 changed files with 2,238 additions and 704 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
/test
44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
"root":true,
"env": {
"es6": true,
"browser": true,
"commonjs": true,
},
"extends": [
"eslint:recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
"comma-style": "error",
"comma-spacing": "error",
"eqeqeq": ["off", "smart"],
"indent": "off",
"indent-legacy": ["error", 4, {"SwitchCase": 1}],
"key-spacing": "error",
"keyword-spacing": "error",
"linebreak-style": ["error", "unix"],
"no-multi-spaces": "error",
"no-trailing-spaces": "error",
"no-lone-blocks": "error",
"no-extend-native": "error",
"no-unused-vars": ["error", {"vars": "local", "args": "none"}],
"no-empty": ["error", {"allowEmptyCatch": true}],
"no-duplicate-imports": "error",
"no-array-constructor": "error",
"no-multiple-empty-lines": "error",
"no-template-curly-in-string": "error",
"no-console": "off",
"object-curly-spacing": "error",
"quotes": ["error", "single", {"avoidEscape": true}],
"semi": ["error", "always"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"space-in-parens": "error",
"space-before-blocks": "error",
"template-curly-spacing": "error"
}
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ $ npm install vue-resource
```

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

## Example
Expand Down
2 changes: 1 addition & 1 deletion 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.3.5",
"version": "1.3.6",
"description": "The HTTP client for Vue.js",
"homepage": "https://github.com/pagekit/vue-resource",
"license": "MIT",
Expand Down
54 changes: 28 additions & 26 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
/* eslint-env node */

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

rollup.rollup({
input: 'src/index.js',
plugins: [buble()]
input: 'src/index.js',
plugins: [buble()]
})
.then(bundle =>
bundle.generate({
format: 'umd',
banner: banner,
name: 'VueResource'
format: 'umd',
banner: banner,
name: 'VueResource'
}).then(({code}) => write('dist/vue-resource.js', code, bundle))
)
.then(bundle =>
Expand All @@ -28,41 +30,41 @@ rollup.rollup({
)
.then(bundle =>
bundle.generate({
format: 'es',
banner: banner,
footer: 'export { Url, Http, Resource };'
format: 'es',
banner: banner,
footer: 'export { Url, Http, Resource };'
}).then(({code}) => write('dist/vue-resource.esm.js', code, bundle))
)
.then(bundle =>
bundle.generate({
format: 'cjs',
banner: banner
format: 'cjs',
banner: banner
}).then(({code}) => write('dist/vue-resource.common.js', code, bundle))
)
.catch(logError);

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

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(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(bundle);
});
});
});
}

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

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

function blue(str) {
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m';
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m';
}
20 changes: 11 additions & 9 deletions build/release.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
/* eslint-env node */

var replace = require('replace-in-file');
var version = process.argv[2];

replace({
files: "bower.json",
from: /("version"\s*:\s*")\d+\.\d+\.\d+("\s*,)/g,
to: "$1" + version + "$2"
files: 'bower.json',
from: /("version"\s*:\s*")\d+\.\d+\.\d+("\s*,)/g,
to: '$1' + version + '$2'
});

replace({
files: "package.json",
from: /("version"\s*:\s*")\d+\.\d+\.\d+("\s*,)/g,
to: "$1" + version + "$2"
files: 'package.json',
from: /("version"\s*:\s*")\d+\.\d+\.\d+("\s*,)/g,
to: '$1' + version + '$2'
});

replace({
files: "README.md",
from: /(\/|@)\d+\.\d+\.\d+/g,
to: "$1" + version
files: 'README.md',
from: /(\/|@)\d+\.\d+\.\d+/g,
to: '$1' + version
});
Loading

0 comments on commit d0b845a

Please sign in to comment.