mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-02 05:52:46 +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)
|
||||
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/)
|
||||
|
||||
|
@ -919,6 +919,8 @@ Choices is compiled using [Babel](https://babeljs.io/) to enable support for [ES
|
|||
* Array.prototype.map
|
||||
* Array.prototype.find
|
||||
* Array.prototype.some
|
||||
* Array.prototype.includes
|
||||
* Array.from
|
||||
* Array.prototype.reduce
|
||||
* Array.prototype.indexOf
|
||||
* Object.assign
|
||||
|
|
70
package.json
70
package.json
|
@ -13,13 +13,11 @@
|
|||
"cypress:run": "$(npm bin)/cypress run",
|
||||
"cypress:open": "$(npm bin)/cypress open",
|
||||
"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:e2e": "run-p --race start cypress:run",
|
||||
"js:watch": "NODE_ENV=development node server.js",
|
||||
"js:build:minimised": "webpack --env.minimize --config webpack.config.prod.js",
|
||||
"js:build:unminimised": "webpack --config webpack.config.prod.js",
|
||||
"js:build": "run-p js:build:minimised js:build:unminimised",
|
||||
"js:build": "webpack --config webpack.config.prod.js",
|
||||
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
||||
"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",
|
||||
|
@ -28,7 +26,7 @@
|
|||
"bump-cache": "node bump-cache.js --current $npm_package_version",
|
||||
"deploy": "git subtree push --prefix public origin gh-pages",
|
||||
"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": {
|
||||
"type": "git",
|
||||
|
@ -55,49 +53,53 @@
|
|||
"js"
|
||||
],
|
||||
"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",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"babel-loader": "^8.0.5",
|
||||
"bundlesize": "^0.17.1",
|
||||
"chai": "^4.1.0",
|
||||
"chai": "^4.2.0",
|
||||
"csso": "^1.8.2",
|
||||
"cypress": "^3.1.4",
|
||||
"cypress": "^3.1.5",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-loader": "^1.5.0",
|
||||
"eslint-plugin-cypress": "^2.0.1",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"eslint-config-prettier": "^2.10.0",
|
||||
"eslint-loader": "^2.1.2",
|
||||
"eslint-plugin-cypress": "^2.2.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-jsx-a11y": "^5.1.1",
|
||||
"eslint-plugin-prettier": "^2.6.0",
|
||||
"eslint-plugin-react": "^7.2.1",
|
||||
"express": "^4.16.3",
|
||||
"eslint-plugin-prettier": "^2.7.0",
|
||||
"eslint-plugin-react": "^7.12.4",
|
||||
"express": "^4.16.4",
|
||||
"husky": "^0.14.3",
|
||||
"jsdom": "^11.5.1",
|
||||
"mocha": "^3.4.2",
|
||||
"node-sass": "^4.9.3",
|
||||
"nodemon": "^1.18.9",
|
||||
"npm-run-all": "^4.1.3",
|
||||
"nyc": "^11.0.3",
|
||||
"opn": "^5.1.0",
|
||||
"jsdom": "^11.12.0",
|
||||
"mocha": "^5.2.0",
|
||||
"node-sass": "^4.11.0",
|
||||
"nodemon": "^1.18.10",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"nyc": "^11.9.0",
|
||||
"opn": "^5.4.0",
|
||||
"postcss-cli": "^2.5.1",
|
||||
"prettier": "^1.13.0",
|
||||
"prettier": "^1.16.4",
|
||||
"sinon": "^2.4.0",
|
||||
"webpack": "^3.8.1",
|
||||
"webpack-dev-middleware": "^2.0.0",
|
||||
"webpack-hot-middleware": "^2.22.2",
|
||||
"unminified-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^4.29.3",
|
||||
"webpack-cli": "^3.2.3",
|
||||
"webpack-dev-middleware": "^3.5.2",
|
||||
"webpack-hot-middleware": "^2.24.3",
|
||||
"whatwg-fetch": "^1.0.0",
|
||||
"wrapper-webpack-plugin": "^0.1.7"
|
||||
"wrapper-webpack-plugin": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.5",
|
||||
"core-js": "^2.5.6",
|
||||
"classnames": "^2.2.6",
|
||||
"custom-event-polyfill": "^0.3.0",
|
||||
"deepmerge": "^2.2.1",
|
||||
"fuse.js": "^3.1.0",
|
||||
"fuse.js": "^3.4.1",
|
||||
"redux": "^3.3.1"
|
||||
},
|
||||
"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';
|
||||
|
|
|
@ -5,7 +5,8 @@ export default class Store {
|
|||
constructor() {
|
||||
this._store = createStore(
|
||||
rootReducer,
|
||||
window.devToolsExtension ? window.devToolsExtension() : undefined,
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const { HotModuleReplacementPlugin } = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
devtool: 'eval',
|
||||
mode: 'development',
|
||||
entry: [
|
||||
'webpack/hot/dev-server',
|
||||
'webpack-hot-middleware/client',
|
||||
|
@ -15,21 +15,14 @@ module.exports = {
|
|||
library: 'Choices',
|
||||
libraryTarget: 'umd',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify('development'),
|
||||
},
|
||||
}),
|
||||
],
|
||||
plugins: [new HotModuleReplacementPlugin()],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js?$/,
|
||||
include: path.join(__dirname, 'src/scripts'),
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'eslint-loader',
|
||||
query: {
|
||||
configFile: '.eslintrc',
|
||||
|
@ -38,8 +31,11 @@ module.exports = {
|
|||
{
|
||||
test: /\.js?$/,
|
||||
include: path.join(__dirname, 'src/scripts'),
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
babelrc: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,78 +1,56 @@
|
|||
const path = require('path');
|
||||
const pkg = require('./package.json');
|
||||
const webpack = require('webpack');
|
||||
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 minimize = !!(env && env.minimize);
|
||||
const banner = `/*! ${pkg.name} v${
|
||||
pkg.version
|
||||
} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
|
||||
|
||||
const config = {
|
||||
devtool: minimize ? false : 'cheap-module-source-map',
|
||||
entry: [
|
||||
'./src/scripts/choices',
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, '/public/assets/scripts'),
|
||||
filename: minimize ? 'choices.min.js' : 'choices.js',
|
||||
publicPath: '/public/assets/scripts/',
|
||||
library: 'Choices',
|
||||
libraryTarget: 'umd',
|
||||
auxiliaryComment: {
|
||||
root: 'Window',
|
||||
commonjs: 'CommonJS',
|
||||
commonjs2: 'CommonJS2',
|
||||
amd: 'AMD',
|
||||
},
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: ['./src/scripts/choices'],
|
||||
output: {
|
||||
path: path.join(__dirname, '/public/assets/scripts'),
|
||||
filename: 'choices.min.js',
|
||||
publicPath: '/public/assets/scripts/',
|
||||
library: 'Choices',
|
||||
libraryTarget: 'umd',
|
||||
auxiliaryComment: {
|
||||
root: 'Window',
|
||||
commonjs: 'CommonJS',
|
||||
commonjs2: 'CommonJS2',
|
||||
amd: 'AMD',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
// This has effect on the react lib size
|
||||
NODE_ENV: JSON.stringify('production'),
|
||||
},
|
||||
plugins: [
|
||||
new WrapperPlugin({
|
||||
header: banner,
|
||||
}),
|
||||
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