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

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffan committed Dec 29, 2018
1 parent e25df44 commit 3bbc799
Show file tree
Hide file tree
Showing 7 changed files with 2,230 additions and 1,296 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
}]
]

};
15 changes: 6 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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,Firefox
- run:
name: Build Release
command: yarn build
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
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
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"jsdelivr": "dist/vue-resource.min.js",
"typings": "types/index.d.ts",
"description": "The HTTP client for Vue.js",
"homepage": "https://github.com/pagekit/vue-resource#readme",
"homepage": "https://github.com/pagekit/vue-resource",
"license": "MIT",
"keywords": [
"vue",
Expand All @@ -23,6 +23,7 @@
"url": "git+https://github.com/pagekit/vue-resource.git"
},
"scripts": {
"up": "yarn upgrade-interactive --latest",
"test": "jest --env=node",
"karma": "karma start test/karma.conf.js --single-run",
"build": "node build/build.js",
Expand All @@ -36,24 +37,27 @@
"got": "^8.0.3"
},
"devDependencies": {
"buble": "^0.19.1",
"buble-loader": "^0.5.1",
"eslint": "^4.17.0",
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.0",
"babel-loader": "^8.0.4",
"eslint": "^5.11.1",
"generate-release": "^1.1.1",
"jasmine": "^3.2.0",
"jasmine-core": "^3.2.1",
"jest": "^22.2.2",
"karma": "^2.0.0",
"jasmine": "^3.3.1",
"jasmine-core": "^3.3.0",
"jest": "^23.6.0",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^1.1.1",
"karma-jasmine": "^2.0.1",
"karma-safari-launcher": "^1.0.0",
"karma-webpack": "^2.0.9",
"karma-webpack": "^3.0.5",
"replace-in-file": "^3.4.2",
"rollup": "^0.66.0",
"rollup-plugin-buble": "^0.19.1",
"rollup-plugin-babel": "^4.1.0",
"rollup-plugin-replace": "^2.1.0",
"uglify-js": "^3.4.9",
"vue": "^2.5.17",
"webpack": "^3.11.0"
"vue": "^2.5.21",
"webpack": "^4.28.3",
"webpack-cli": "^3.1.2"
}
}
10 changes: 8 additions & 2 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ module.exports = config => {
browsers: ['Chrome', 'Safari', 'Firefox'],

files: [
'index.js',
{pattern: 'data/*', included: false},
'index.js', {
pattern: 'data/*',
included: false
},
],

preprocessors: {
Expand All @@ -21,6 +23,10 @@ module.exports = config => {
'/data/': '/base/data/'
},

webpack: {
mode: 'development'
},

});

};
21 changes: 13 additions & 8 deletions test/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
var webpack = require('webpack');

module.exports = {

mode: 'development',

entry: __dirname + '/index.js',

output: {
path: __dirname + '/',
filename: 'specs.js'
},

module: {
loaders: [
{test: /\.js$/, loader: 'buble-loader', exclude: /node_modules/}
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin()
]
}

};
Loading

0 comments on commit 3bbc799

Please sign in to comment.