feat(build-chain): set up and updated deps

This commit is contained in:
Florent Chehab 2020-04-19 16:33:55 +02:00
parent 84b4ff019f
commit a61ac620a2
No known key found for this signature in database
GPG Key ID: 9A0CE018889EA246
5 changed files with 8073 additions and 5 deletions

61
config/webpack.base.js Normal file
View File

@ -0,0 +1,61 @@
const webpack = require("webpack");
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require("path");
const config = {
entry: {
main: ["./src/js/index.js"],
},
output: {
path: path.join(__dirname, "..", "public"),
filename: "[name]-[hash].js"
},
resolve: {
extensions: ["*", ".json", ".js"]
},
module: {
rules: [
{
test: /\.(js)$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
compact: true
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: 'file-loader',
},
],
}
]
},
plugins: [
new CleanWebpackPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
"window.jQuery": "jquery",
"window.$": "jquery",
}),
new CopyPlugin([
{ from: 'assets', to: '' },
]),
new HtmlWebpackPlugin({
template: 'src/index.html',
minify: false,
inject: true
})
]
};
module.exports = config;

11
config/webpack.build.js Normal file
View File

@ -0,0 +1,11 @@
const merge = require("webpack-merge");
const baseConfig = require("./webpack.base");
module.exports = merge(baseConfig, {
mode: "production",
optimization: {
minimize: true,
nodeEnv: "production",
},
devtool: false
});

18
config/webpack.dev.js Normal file
View File

@ -0,0 +1,18 @@
const merge = require("webpack-merge");
const baseConfig = require("./webpack.base");
const webpack = require("webpack");
const devConfig = merge(baseConfig, {
mode: "development",
devtool: "eval-source-map",
optimization: {
minimize: false,
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(), // don't reload if there is an error
].concat(baseConfig.plugins),
});
module.exports = devConfig;

7933
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,11 @@
"main": "server.js",
"directories": {},
"scripts": {
"test": "echo \"No tests needed!\" && exit 1",
"start": "node server.js"
"build": "webpack --config config/webpack.build.js",
"start:dev": "node scripts/server.js --mode=development",
"start:prod": "npm run build && npm run start:prod-no-build",
"start:prod-no-build": "node scripts/server.js --mode=production",
"test": "echo \"No tests needed!\" && exit 1"
},
"repository": {
"type": "git",
@ -26,6 +29,52 @@
"socket.io": "2.*",
"webdav": "^2.8.0"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.5",
"@fortawesome/fontawesome-free": "^5.8.1",
"babel-loader": "^8.1.0",
"babel-preset-minify": "^0.5.0",
"clean-webpack-plugin": "3.0.0",
"copy-webpack-plugin": "5.1.1",
"css-loader": "3.5.2",
"html-webpack-plugin": "4.2.0",
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"keymage": "^1.1.3",
"style-loader": "1.1.4",
"vanilla-picker": "2.10.1",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2"
},
"author": "Cracker0dks",
"license": "MIT"
"license": "MIT",
"private": true,
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties"
]
]
}
}