Update dependencies and webpack config.

This commit is contained in:
panr 2020-09-05 19:51:01 +02:00
parent 2382c7531b
commit cab65cfcf3
18 changed files with 1269 additions and 1595 deletions

View File

@ -4,56 +4,57 @@
"main": "index.js", "main": "index.js",
"author": "Radosław Kozieł <@panr> <radoslaw.koziel@gmail.com>", "author": "Radosław Kozieł <@panr> <radoslaw.koziel@gmail.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "webpack --mode=development --watch", "dev": "webpack --mode=development --watch",
"build": "webpack --mode=production" "build": "webpack --mode=production"
}, },
"browserslist": [ "browserslist": [
"last 2 versions", "last 2 versions",
">1%", ">1%",
"not dead" "not dead"
], ],
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.2.3", "@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2", "@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.2.0", "@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.3.1", "@babel/preset-env": "^7.3.1",
"@babel/preset-stage-2": "^7.0.0", "@babel/preset-stage-2": "^7.0.0",
"babel-eslint": "^8.2.1", "babel-eslint": "^10.1.0",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"browserslist": "^4.0.1", "browserslist": "^4.0.1",
"clean-webpack-plugin": "^0.1.19", "clean-webpack-plugin": "^3.0.0",
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"css-loader": "^1.0.1", "css-loader": "^4.2.2",
"cssnano": "^4.1.8", "cssnano": "^4.1.8",
"eslint-config-airbnb": "^17.1.0", "eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^2.10.0", "eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-jsx-a11y": "^6.2.1",
"extract-text-webpack-plugin": "^4.0.0-beta.0", "extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11", "file-loader": "^6.1.0",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^4.4.1",
"husky": "^4.2.5", "husky": "^4.2.5",
"postcss": "^7.0.0", "mini-css-extract-plugin": "^0.11.0",
"postcss-browser-reporter": "^0.5.0", "postcss": "^7.0.0",
"postcss-cli": "^6.1.1", "postcss-browser-reporter": "^0.6.0",
"postcss-import": "^11.1.0", "postcss-cli": "^7.1.2",
"postcss-loader": "^2.1.6", "postcss-import": "^12.0.1",
"postcss-mixins": "^6.2.1", "postcss-loader": "^3.0.0",
"postcss-nested": "^3.0.0", "postcss-mixins": "^6.2.1",
"postcss-preset-env": "^5.3.0", "postcss-nested": "^4.2.3",
"postcss-reporter": "^5.0.0", "postcss-preset-env": "^6.7.0",
"postcss-url": "^7.3.2", "postcss-reporter": "^6.0.1",
"prettier-eslint-cli": "^4.7.1", "postcss-url": "^8.0.0",
"ramda": "^0.25.0", "prettier-eslint-cli": "^5.0.0",
"style-loader": "^0.21.0", "ramda": "^0.27.1",
"uglifyjs-webpack-plugin": "^1.3.0", "style-loader": "^1.2.1",
"url-loader": "^1.1.2", "uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.29.3", "url-loader": "^4.1.0",
"webpack-cli": "^3.2.3" "webpack": "^4.29.3",
}, "webpack-cli": "^3.2.3"
"husky": { },
"hooks": { "husky": {
"pre-push": "yarn build && git add . && git commit --amend --no-edit" "hooks": {
} "pre-push": "yarn build && git add . && git commit --amend --no-edit"
} }
}
} }

View File

@ -1 +1 @@
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){n(1),e.exports=n(2)},function(e,t){var n=document.querySelector(".container"),o=document.querySelector(".menu"),r=document.querySelector(".menu-trigger"),i=(document.querySelector(".menu__inner--desktop"),document.querySelector(".menu__sub-inner-more-trigger")),c=document.querySelector(".menu__sub-inner-more"),d=getComputedStyle(document.body).getPropertyValue("--phoneWidth"),u=function(){return window.matchMedia(d).matches},l=function(){r&&r.classList.toggle("hidden",!u()),o&&o.classList.toggle("hidden",u()),c&&c.classList.toggle("hidden",!u())};o&&o.addEventListener("click",function(e){return e.stopPropagation()}),c&&c.addEventListener("click",function(e){return e.stopPropagation()}),l(),document.body.addEventListener("click",function(){u()||!c||c.classList.contains("hidden")?u()&&!o.classList.contains("hidden")&&o.classList.add("hidden"):c.classList.add("hidden")}),window.addEventListener("resize",l),r&&r.addEventListener("click",function(e){e.stopPropagation(),o&&o.classList.toggle("hidden")}),i&&i.addEventListener("click",function(e){e.stopPropagation(),c&&c.classList.toggle("hidden"),c&&c.getBoundingClientRect().right>n.getBoundingClientRect().right&&(c.style.left="auto",c.style.right=0)})},function(e,t){var n=window.localStorage&&window.localStorage.getItem("theme"),o=document.querySelector(".theme-toggle"),r="dark"===n;null!==n&&document.body.classList.toggle("dark-theme",r),o.addEventListener("click",function(){document.body.classList.toggle("dark-theme"),window.localStorage&&window.localStorage.setItem("theme",document.body.classList.contains("dark-theme")?"dark":"light")})}]); !function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,n){n(1),e.exports=n(2)},function(e,t){function n(){return window.matchMedia(l).matches}function o(){c&&c.classList.toggle("hidden",!n()),i&&i.classList.toggle("hidden",n()),u&&u.classList.toggle("hidden",!n())}var r=document.querySelector(".container"),i=document.querySelector(".menu"),c=document.querySelector(".menu-trigger"),d=(document.querySelector(".menu__inner--desktop"),document.querySelector(".menu__sub-inner-more-trigger")),u=document.querySelector(".menu__sub-inner-more"),l=getComputedStyle(document.body).getPropertyValue("--phoneWidth");i&&i.addEventListener("click",function(e){return e.stopPropagation()}),u&&u.addEventListener("click",function(e){return e.stopPropagation()}),o(),document.body.addEventListener("click",function(){n()||!u||u.classList.contains("hidden")?n()&&!i.classList.contains("hidden")&&i.classList.add("hidden"):u.classList.add("hidden")}),window.addEventListener("resize",o),c&&c.addEventListener("click",function(e){e.stopPropagation(),i&&i.classList.toggle("hidden")}),d&&d.addEventListener("click",function(e){e.stopPropagation(),u&&u.classList.toggle("hidden"),u&&u.getBoundingClientRect().right>r.getBoundingClientRect().right&&(u.style.left="auto",u.style.right=0)})},function(e,t){var n=window.localStorage&&window.localStorage.getItem("theme"),o=document.querySelector(".theme-toggle"),r="dark"===n;null!==n&&document.body.classList.toggle("dark-theme",r),o.addEventListener("click",function(){document.body.classList.toggle("dark-theme"),window.localStorage&&window.localStorage.setItem("theme",document.body.classList.contains("dark-theme")?"dark":"light")})}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
const Webpack = require("webpack"); const Webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CleanPlugin = require("clean-webpack-plugin"); const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
@ -8,18 +8,18 @@ const path = require("path");
const join = (...paths) => path.join(__dirname, ...paths); const join = (...paths) => path.join(__dirname, ...paths);
module.exports = { module.exports = (env, { mode }) => ({
resolve: { resolve: {
extensions: [".js", ".css"], extensions: [".js", ".css"],
modules: ["assets", "node_modules"], modules: ["assets", "node_modules"],
}, },
entry: { entry: {
"main.js": [join("assets", "js", "menu.js"), join("assets", "js", "theme.js")], main: [join("assets", "js", "menu.js"), join("assets", "js", "theme.js")],
"prism.js": join("assets", "js", "prism.js"), prism: join("assets", "js", "prism.js"),
"style.css": join("assets", "css", "style.css"), style: join("assets", "css", "style.css"),
}, },
output: { output: {
filename: "[name]", filename: "[name].js",
path: join("static/assets"), path: join("static/assets"),
publicPath: "", publicPath: "",
}, },
@ -51,28 +51,27 @@ module.exports = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
use: ExtractTextPlugin.extract({ use: [
fallback: "style-loader", MiniCssExtractPlugin.loader,
use: [ {
{ loader: "css-loader",
loader: "css-loader", options: {
options: { modules: {
minimize: true,
modules: true,
importLoaders: 1,
localIdentName: "[local]", localIdentName: "[local]",
}, },
import: true,
importLoaders: 1,
}, },
{ },
loader: "postcss-loader", {
options: { loader: "postcss-loader",
config: { options: {
path: "postcss.config.js", config: {
}, path: "postcss.config.js",
}, },
}, },
], },
}), ],
}, },
], ],
}, },
@ -87,5 +86,15 @@ module.exports = {
}), }),
], ],
}, },
plugins: [new CleanPlugin(join("static/assets")), new ExtractTextPlugin("[name]")], plugins: [
}; new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [join("static/assets")],
cleanAfterEveryBuildPatterns: [join("static/assets/style.js")],
verbose: true,
}),
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css",
}),
],
});

2690
yarn.lock

File diff suppressed because it is too large Load Diff