remove gzip on assets, add build.sh

pickups:
- build.sh: Make the target dir configurable
- build.sh: Auto-update yarn dependencies

Co-authored-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
This commit is contained in:
Morgan Bazalgette 2018-03-31 17:55:08 +02:00 committed by Haelwenn (lanodan) Monnier
parent ec849e5730
commit 85bd55e5cf
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
4 changed files with 13 additions and 25 deletions

10
build.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
TARGET="../pleroma" # Where pleromas repository is sitting
yarn install -D
rm -rf public/packs public/assets
env -i "PATH=$PATH" npm run build
cp public/assets/sw.js "${TARGET}/priv/static/sw.js"
rm -rf "${TARGET}/priv/static/packs"
cp -r public/packs "${TARGET}/priv/static/packs"

View file

@ -2,8 +2,6 @@
const merge = require('webpack-merge');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const zopfli = require('@gfx/zopfli');
const sharedConfig = require('./shared.js');
const OfflinePlugin = require('offline-plugin');
const { publicPath } = require('./configuration.js');
@ -29,8 +27,8 @@ module.exports = merge(sharedConfig, {
mode: 'production',
output: {
filename: '[name]-[chunkhash].js',
chunkFilename: '[name]-[chunkhash].js',
filename: '[name].js',
chunkFilename: '[name].js',
},
devtool: 'source-map', // separate sourcemap file, suitable for production
@ -58,12 +56,6 @@ module.exports = merge(sharedConfig, {
},
plugins: [
new CompressionPlugin({
algorithm(input, compressionOptions, callback) {
return zopfli.gzip(input, compressionOptions, callback);
},
test: /\.(js|css|html|json|ico|svg|eot|otf|ttf)$/,
}),
new OfflinePlugin({
publicPath: publicPath, // sw.js must be served from the root to avoid scope issues
caches: {
@ -87,7 +79,6 @@ module.exports = merge(sharedConfig, {
'/emoji/sheet_10.png', // used in emoji-mart
],
excludes: [
'**/*.gz',
'**/*.map',
'stats.json',
'report.html',

View file

@ -53,7 +53,6 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"babel-runtime": "^6.26.0",
"classnames": "^2.2.5",
"compression-webpack-plugin": "^2.0.0",
"cross-env": "^5.1.4",
"css-loader": "^2.1.0",
"cssnano": "^4.1.8",

View file

@ -2162,18 +2162,6 @@ compressible@~2.0.14:
dependencies:
mime-db ">= 1.36.0 < 2"
compression-webpack-plugin@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/compression-webpack-plugin/-/compression-webpack-plugin-2.0.0.tgz#46476350c1eb27f783dccc79ac2f709baa2cffbc"
integrity sha512-bDgd7oTUZC8EkRx8j0sjyCfeiO+e5sFcfgaFcjVhfQf5lLya7oY2BczxcJ7IUuVjz5m6fy8IECFmVFew3xLk8Q==
dependencies:
cacache "^11.2.0"
find-cache-dir "^2.0.0"
neo-async "^2.5.0"
schema-utils "^1.0.0"
serialize-javascript "^1.4.0"
webpack-sources "^1.0.1"
compression@^1.5.2:
version "1.7.3"
resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.3.tgz#27e0e176aaf260f7f2c2813c3e440adb9f1993db"
@ -9491,7 +9479,7 @@ webpack-merge@^4.1.5:
dependencies:
lodash "^4.17.5"
webpack-sources@^1.0.0, webpack-sources@^1.0.1, webpack-sources@^1.1.0, webpack-sources@^1.3.0:
webpack-sources@^1.0.0, webpack-sources@^1.1.0, webpack-sources@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85"
integrity sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==