Skip to content

Commit

Permalink
Update dependencies, build and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
liqueurdetoile committed Feb 19, 2022
2 parents 2ccbf29 + 9b0e105 commit bee1e23
Show file tree
Hide file tree
Showing 22 changed files with 1,861 additions and 6,281 deletions.
22 changes: 0 additions & 22 deletions .babelrc

This file was deleted.

7 changes: 3 additions & 4 deletions .config/karma.benchmark.conf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Karma configuration

var webpackConfig = require('./webpack/bench.js');

module.exports = function (config) {
module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
Expand Down Expand Up @@ -51,6 +50,6 @@ module.exports = function (config) {

browserDisconnectTimeout: 60000,

browserNoActivityTimeout : 600000
browserNoActivityTimeout: 600000
});
};
};
44 changes: 22 additions & 22 deletions .config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// Karma configuration

var webpackConfig = require('./webpack/tests.js');

module.exports = function (config) {
module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '../',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
frameworks: [
'mocha', 'chai', 'sinon', 'webpack'
],

webpack: webpackConfig,

Expand All @@ -21,13 +22,10 @@ module.exports = function (config) {
},

// list of files / patterns to load in the browser
files: [
'tests/index.js'
],
files: ['tests/index.js'],

// list of files / patterns to exclude
exclude: [
],
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
Expand All @@ -40,14 +38,22 @@ module.exports = function (config) {
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// reporters: ['progress', 'coverage-istanbul', 'coveralls'],
// reporters: ['progress', 'mocha', 'coverage-istanbul'],
reporters: ['mocha', 'coverage'],
reporters: [
'mocha', 'coverage'
],

coverageReporter: {
dir: './coverage',
dir: 'coverage',
reporters: [
{ type: 'html', subdir: '.'},
{ type: 'lcov', subdir: '.'},
{ type: 'text-summary' }
{
type: 'html',
subdir: '.'
}, {
type: 'lcov',
subdir: '.'
}, {
type: 'text-summary'
}
]
},

Expand All @@ -67,17 +73,11 @@ module.exports = function (config) {
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
// browsers: ['Chrome', 'ChromeCanary', 'Firefox', 'Safari', 'PhantomJS', 'Opera', 'IE'],
browsers: ['ChromeHeadless', 'FirefoxHeadless', 'Edge'],
browsers: [
'ChromeHeadless', 'FirefoxHeadless'
],

customLaunchers: {
ChromeHeadlessWithoutSecurity: {
base: 'ChromeHeadless',
flags: ['--disable-web-security']
},
ChromeWithoutSecurity: {
base: 'Chromium',
flags: ['--disable-web-security']
},
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless']
Expand Down
23 changes: 13 additions & 10 deletions .config/webpack/base.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
'use strict';

const path = require('path');

function resolve(dir) {
return path.join(__dirname, '..', dir);
}
const CircularDependencyPlugin = require('circular-dependency-plugin')
const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
entry: './src/index.js',
output: {
library: 'blobCompare',
libraryTarget: "umd"
},
module: {
rules: [
{
rules: [{
test: /(\.js)$/,
loader: 'babel-loader',
exclude: /node_modules|tests|benchmarks/
},
{
test: /(\.worker.js)$/,
test: /(worker\.js)$/,
loader: 'worker-loader',
options: { inline: isProduction ? "no-fallback" : "fallback" },
exclude: /node_modules/
},
{
Expand All @@ -39,5 +36,11 @@ module.exports = {
alias: {
'@': path.resolve('./src')
}
}
};
},
plugins: [
new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true
}),
]
};
6 changes: 2 additions & 4 deletions .config/webpack/bench.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {merge} = require('webpack-merge');
const webpack = require('webpack');
const path = require('path');
const { merge } = require('webpack-merge');
const base = require('./base.js');

module.exports = merge(base, {
Expand All @@ -10,4 +8,4 @@ module.exports = merge(base, {
},
mode: 'production',
watch: false
});
});
10 changes: 6 additions & 4 deletions .config/webpack/build.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
const {merge} = require('webpack-merge');
const { merge } = require('webpack-merge');
const webpack = require('webpack');
const path = require('path');
const base = require('./base.js');

module.exports = merge(base, {
entry: './src/index.js',
devtool: false,
mode: 'production',
output: {
path: path.resolve('./dist'),
filename: 'index.min.js'
filename: 'index.min.js',
clean: true,
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin()
new webpack.optimize.ModuleConcatenationPlugin(),
]
});
});
6 changes: 3 additions & 3 deletions .config/webpack/tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {merge} = require('webpack-merge');
const { merge } = require('webpack-merge');
const base = require('./base.js');

module.exports = merge(base, {
Expand All @@ -7,5 +7,5 @@ module.exports = merge(base, {
output: {
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
}
});
},
});
40 changes: 0 additions & 40 deletions .eslintrc

This file was deleted.

48 changes: 48 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const webpackConfig = require('./.config/webpack/tests.js');

module.exports = {
env: {
browser: true,
es6: true,
node: true
},

globals: {
document: false,
escape: false,
navigator: false,
unescape: false,
window: false,
describe: true,
before: true,
after: true,
beforeEach: true,
afterEach: true,
it: true,
expect: true,
sinon: true,
},

parserOptions: {
parser: '@babel/eslint-parser',
sourceType: 'module',
"ecmaVersion": 2018,
},

extends: [
'eslint:recommended',
],

rules: {
indent: ["error", 2, { "SwitchCase": 1 }],
'keyword-spacing': [2, { "before": true, "after": true }],
},

settings: {
'import/resolver': {
webpack: {
config: webpackConfig
}
}
}
}
28 changes: 28 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run test suite

on:
pull_request:
branches:
- master
- dev-progressive
push:
branches:
- master
- dev-progressive

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
cache: 'npm'
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- run: npm install
- run: CHROME_BIN=$(which chrome) npm run test
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

25 changes: 25 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
"presets": [
[
"@babel/preset-env",
{
"modules": "auto",
"useBuiltIns": "usage",
"corejs": 3,
},
]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
],
"env": {
"test": {
"plugins": [
[
"istanbul",
{ "exclude": ["tests/**/*.js"] }
]
]
}
}
}
1 change: 1 addition & 0 deletions dist/273.index.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit bee1e23

Please sign in to comment.