mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-18 05:26:35 +02:00
Upgrade old packages (#508)
* Upgrade Webpack to v4 * Upgrade Mocha * Export unminfied and minified version * Add browserslistrc * Remove core.js polyfills * Run bundle size on pre push * Run bundlesize last * Update readme gzip side
This commit is contained in:
parent
2f873167f6
commit
5c9dfdf2db
10
.babelrc
10
.babelrc
|
@ -1,3 +1,11 @@
|
||||||
{
|
{
|
||||||
"presets": ["env", "stage-2"]
|
"presets": [
|
||||||
|
"@babel/preset-env"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"@babel/plugin-transform-modules-commonjs",
|
||||||
|
["@babel/plugin-transform-spread", {
|
||||||
|
"loose": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
2
.browserslistrc
Normal file
2
.browserslistrc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
> 5%
|
||||||
|
IE 11
|
|
@ -1,5 +1,5 @@
|
||||||
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![](https://data.jsdelivr.com/v1/package/npm/choices.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js) [![codebeat badge](https://codebeat.co/badges/55120150-5866-42d8-8010-6aaaff5d3fa1)](https://codebeat.co/projects/github-com-jshjohnson-choices-master)
|
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![](https://data.jsdelivr.com/v1/package/npm/choices.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js) [![codebeat badge](https://codebeat.co/badges/55120150-5866-42d8-8010-6aaaff5d3fa1)](https://codebeat.co/projects/github-com-jshjohnson-choices-master)
|
||||||
A vanilla, lightweight (~25kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
|
A vanilla, lightweight (~22kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
|
||||||
|
|
||||||
[Demo](https://joshuajohnson.co.uk/Choices/)
|
[Demo](https://joshuajohnson.co.uk/Choices/)
|
||||||
|
|
||||||
|
@ -919,6 +919,8 @@ Choices is compiled using [Babel](https://babeljs.io/) to enable support for [ES
|
||||||
* Array.prototype.map
|
* Array.prototype.map
|
||||||
* Array.prototype.find
|
* Array.prototype.find
|
||||||
* Array.prototype.some
|
* Array.prototype.some
|
||||||
|
* Array.prototype.includes
|
||||||
|
* Array.from
|
||||||
* Array.prototype.reduce
|
* Array.prototype.reduce
|
||||||
* Array.prototype.indexOf
|
* Array.prototype.indexOf
|
||||||
* Object.assign
|
* Object.assign
|
||||||
|
|
70
package.json
70
package.json
|
@ -13,13 +13,11 @@
|
||||||
"cypress:run": "$(npm bin)/cypress run",
|
"cypress:run": "$(npm bin)/cypress run",
|
||||||
"cypress:open": "$(npm bin)/cypress open",
|
"cypress:open": "$(npm bin)/cypress open",
|
||||||
"test": "run-p test:unit test:e2e",
|
"test": "run-p test:unit test:e2e",
|
||||||
"test:unit": "mocha --require ./config/jsdom.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\" --exit",
|
"test:unit": "mocha --require ./config/jsdom.js --require @babel/register $(find src -name '*.test.js') --exit",
|
||||||
"test:unit:watch": "npm run test:unit -- --watch --inspect=5556",
|
"test:unit:watch": "npm run test:unit -- --watch --inspect=5556",
|
||||||
"test:e2e": "run-p --race start cypress:run",
|
"test:e2e": "run-p --race start cypress:run",
|
||||||
"js:watch": "NODE_ENV=development node server.js",
|
"js:watch": "NODE_ENV=development node server.js",
|
||||||
"js:build:minimised": "webpack --env.minimize --config webpack.config.prod.js",
|
"js:build": "webpack --config webpack.config.prod.js",
|
||||||
"js:build:unminimised": "webpack --config webpack.config.prod.js",
|
|
||||||
"js:build": "run-p js:build:minimised js:build:unminimised",
|
|
||||||
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
||||||
"css:build": "run-p css:sass css:prefix css:min",
|
"css:build": "run-p css:sass css:prefix css:min",
|
||||||
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
|
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
|
||||||
|
@ -28,7 +26,7 @@
|
||||||
"bump-cache": "node bump-cache.js --current $npm_package_version",
|
"bump-cache": "node bump-cache.js --current $npm_package_version",
|
||||||
"deploy": "git subtree push --prefix public origin gh-pages",
|
"deploy": "git subtree push --prefix public origin gh-pages",
|
||||||
"postversion": "npm run js:build && npm run bump-cache",
|
"postversion": "npm run js:build && npm run bump-cache",
|
||||||
"prepush": "run-p lint test:unit"
|
"prepush": "run-p lint test:unit && npm run bundlesize"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -55,49 +53,53 @@
|
||||||
"js"
|
"js"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.2.2",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.3.0",
|
||||||
|
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
|
||||||
|
"@babel/plugin-transform-spread": "^7.2.2",
|
||||||
|
"@babel/preset-env": "^7.3.1",
|
||||||
|
"@babel/register": "^7.0.0",
|
||||||
"autoprefixer": "^6.3.3",
|
"autoprefixer": "^6.3.3",
|
||||||
"babel-core": "^6.26.0",
|
"babel-eslint": "^9.0.0",
|
||||||
"babel-eslint": "^7.2.3",
|
"babel-loader": "^8.0.5",
|
||||||
"babel-loader": "^7.1.2",
|
|
||||||
"babel-preset-env": "^1.6.1",
|
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
|
||||||
"bundlesize": "^0.17.1",
|
"bundlesize": "^0.17.1",
|
||||||
"chai": "^4.1.0",
|
"chai": "^4.2.0",
|
||||||
"csso": "^1.8.2",
|
"csso": "^1.8.2",
|
||||||
"cypress": "^3.1.4",
|
"cypress": "^3.1.5",
|
||||||
"eslint": "^3.19.0",
|
"eslint": "^3.19.0",
|
||||||
"eslint-config-airbnb": "^15.1.0",
|
"eslint-config-airbnb": "^15.1.0",
|
||||||
"eslint-config-prettier": "^2.9.0",
|
"eslint-config-prettier": "^2.10.0",
|
||||||
"eslint-loader": "^1.5.0",
|
"eslint-loader": "^2.1.2",
|
||||||
"eslint-plugin-cypress": "^2.0.1",
|
"eslint-plugin-cypress": "^2.2.0",
|
||||||
"eslint-plugin-import": "^2.7.0",
|
"eslint-plugin-import": "^2.16.0",
|
||||||
"eslint-plugin-jsx-a11y": "^5.1.1",
|
"eslint-plugin-jsx-a11y": "^5.1.1",
|
||||||
"eslint-plugin-prettier": "^2.6.0",
|
"eslint-plugin-prettier": "^2.7.0",
|
||||||
"eslint-plugin-react": "^7.2.1",
|
"eslint-plugin-react": "^7.12.4",
|
||||||
"express": "^4.16.3",
|
"express": "^4.16.4",
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"jsdom": "^11.5.1",
|
"jsdom": "^11.12.0",
|
||||||
"mocha": "^3.4.2",
|
"mocha": "^5.2.0",
|
||||||
"node-sass": "^4.9.3",
|
"node-sass": "^4.11.0",
|
||||||
"nodemon": "^1.18.9",
|
"nodemon": "^1.18.10",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.5",
|
||||||
"nyc": "^11.0.3",
|
"nyc": "^11.9.0",
|
||||||
"opn": "^5.1.0",
|
"opn": "^5.4.0",
|
||||||
"postcss-cli": "^2.5.1",
|
"postcss-cli": "^2.5.1",
|
||||||
"prettier": "^1.13.0",
|
"prettier": "^1.16.4",
|
||||||
"sinon": "^2.4.0",
|
"sinon": "^2.4.0",
|
||||||
"webpack": "^3.8.1",
|
"unminified-webpack-plugin": "^2.0.0",
|
||||||
"webpack-dev-middleware": "^2.0.0",
|
"webpack": "^4.29.3",
|
||||||
"webpack-hot-middleware": "^2.22.2",
|
"webpack-cli": "^3.2.3",
|
||||||
|
"webpack-dev-middleware": "^3.5.2",
|
||||||
|
"webpack-hot-middleware": "^2.24.3",
|
||||||
"whatwg-fetch": "^1.0.0",
|
"whatwg-fetch": "^1.0.0",
|
||||||
"wrapper-webpack-plugin": "^0.1.7"
|
"wrapper-webpack-plugin": "^2.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.6",
|
||||||
"core-js": "^2.5.6",
|
|
||||||
"custom-event-polyfill": "^0.3.0",
|
"custom-event-polyfill": "^0.3.0",
|
||||||
"deepmerge": "^2.2.1",
|
"deepmerge": "^2.2.1",
|
||||||
"fuse.js": "^3.1.0",
|
"fuse.js": "^3.4.1",
|
||||||
"redux": "^3.3.1"
|
"redux": "^3.3.1"
|
||||||
},
|
},
|
||||||
"npmName": "choices.js",
|
"npmName": "choices.js",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
58
public/assets/scripts/choices.min.js
vendored
58
public/assets/scripts/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,4 +1 @@
|
||||||
import 'core-js/fn/array/find';
|
|
||||||
import 'core-js/fn/array/from';
|
|
||||||
import 'core-js/fn/array/includes';
|
|
||||||
import 'custom-event-polyfill';
|
import 'custom-event-polyfill';
|
||||||
|
|
|
@ -5,7 +5,8 @@ export default class Store {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._store = createStore(
|
this._store = createStore(
|
||||||
rootReducer,
|
rootReducer,
|
||||||
window.devToolsExtension ? window.devToolsExtension() : undefined,
|
window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
||||||
|
window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const { HotModuleReplacementPlugin } = require('webpack');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'eval',
|
mode: 'development',
|
||||||
entry: [
|
entry: [
|
||||||
'webpack/hot/dev-server',
|
'webpack/hot/dev-server',
|
||||||
'webpack-hot-middleware/client',
|
'webpack-hot-middleware/client',
|
||||||
|
@ -15,21 +15,14 @@ module.exports = {
|
||||||
library: 'Choices',
|
library: 'Choices',
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [new HotModuleReplacementPlugin()],
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': {
|
|
||||||
NODE_ENV: JSON.stringify('development'),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
test: /\.js?$/,
|
test: /\.js?$/,
|
||||||
include: path.join(__dirname, 'src/scripts'),
|
include: path.join(__dirname, 'src/scripts'),
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /node_modules/,
|
||||||
loader: 'eslint-loader',
|
loader: 'eslint-loader',
|
||||||
query: {
|
query: {
|
||||||
configFile: '.eslintrc',
|
configFile: '.eslintrc',
|
||||||
|
@ -38,8 +31,11 @@ module.exports = {
|
||||||
{
|
{
|
||||||
test: /\.js?$/,
|
test: /\.js?$/,
|
||||||
include: path.join(__dirname, 'src/scripts'),
|
include: path.join(__dirname, 'src/scripts'),
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /node_modules/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
babelrc: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,78 +1,56 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const pkg = require('./package.json');
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||||
|
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
|
||||||
|
|
||||||
const banner = `/*! ${pkg.name} v${pkg.version} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
|
const pkg = require('./package.json');
|
||||||
|
|
||||||
module.exports = (env) => {
|
const banner = `/*! ${pkg.name} v${
|
||||||
const minimize = !!(env && env.minimize);
|
pkg.version
|
||||||
|
} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
|
||||||
|
|
||||||
const config = {
|
module.exports = {
|
||||||
devtool: minimize ? false : 'cheap-module-source-map',
|
mode: 'production',
|
||||||
entry: [
|
entry: ['./src/scripts/choices'],
|
||||||
'./src/scripts/choices',
|
output: {
|
||||||
],
|
path: path.join(__dirname, '/public/assets/scripts'),
|
||||||
output: {
|
filename: 'choices.min.js',
|
||||||
path: path.join(__dirname, '/public/assets/scripts'),
|
publicPath: '/public/assets/scripts/',
|
||||||
filename: minimize ? 'choices.min.js' : 'choices.js',
|
library: 'Choices',
|
||||||
publicPath: '/public/assets/scripts/',
|
libraryTarget: 'umd',
|
||||||
library: 'Choices',
|
auxiliaryComment: {
|
||||||
libraryTarget: 'umd',
|
root: 'Window',
|
||||||
auxiliaryComment: {
|
commonjs: 'CommonJS',
|
||||||
root: 'Window',
|
commonjs2: 'CommonJS2',
|
||||||
commonjs: 'CommonJS',
|
amd: 'AMD',
|
||||||
commonjs2: 'CommonJS2',
|
|
||||||
amd: 'AMD',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
plugins: [
|
},
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new WrapperPlugin({
|
||||||
'process.env': {
|
header: banner,
|
||||||
// This has effect on the react lib size
|
}),
|
||||||
NODE_ENV: JSON.stringify('production'),
|
new UnminifiedWebpackPlugin(),
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
enforce: 'pre',
|
||||||
|
test: /\.js?$/,
|
||||||
|
include: path.join(__dirname, 'src/scripts'),
|
||||||
|
exclude: /(node_modules|bower_components)/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
query: {
|
||||||
|
configFile: '.eslintrc',
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
new WrapperPlugin({
|
{
|
||||||
header: banner,
|
test: /\.js?$/,
|
||||||
}),
|
include: path.join(__dirname, 'src/scripts'),
|
||||||
|
exclude: /(node_modules|bower_components)/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
babelrc: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
module: {
|
},
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
enforce: 'pre',
|
|
||||||
test: /\.js?$/,
|
|
||||||
include: path.join(__dirname, 'src/scripts'),
|
|
||||||
exclude: /(node_modules|bower_components)/,
|
|
||||||
loader: 'eslint-loader',
|
|
||||||
query: {
|
|
||||||
configFile: '.eslintrc',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js?$/,
|
|
||||||
include: path.join(__dirname, 'src/scripts'),
|
|
||||||
exclude: /(node_modules|bower_components)/,
|
|
||||||
loader: 'babel-loader',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (minimize) {
|
|
||||||
config.plugins.unshift(new webpack.optimize.UglifyJsPlugin({
|
|
||||||
sourceMap: false,
|
|
||||||
mangle: true,
|
|
||||||
output: {
|
|
||||||
comments: false,
|
|
||||||
},
|
|
||||||
compress: {
|
|
||||||
warnings: false,
|
|
||||||
screw_ie8: true,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue