Refine cms build scripts
This commit is contained in:
parent
98e2f4a9e0
commit
c5641eaa4f
4 changed files with 12 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"scripts": {
|
||||
"build": "npm i && webpack --config webpack.config.js"
|
||||
"build": "webpack --config webpack.config.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ const path = require('path')
|
|||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const production = process.env.NODE_ENV === 'production'
|
||||
|
||||
console.log(`Building CMS in ${production ? 'production' : 'development'} mode`)
|
||||
|
||||
const productionPlugins = production ? [new UglifyJsPlugin()] : []
|
||||
|
||||
module.exports = {
|
||||
entry: './cms.js',
|
||||
output: {
|
||||
|
|
@ -38,6 +44,6 @@ module.exports = {
|
|||
new ExtractTextPlugin({
|
||||
filename: 'cms.bundle.css'
|
||||
}),
|
||||
new UglifyJsPlugin()
|
||||
...productionPlugins
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,13 +55,15 @@
|
|||
"build":
|
||||
"npm-run-all -s prepare-content build:cms build:app build:postcss build:react-snapshot build:sitemap build:sw build:sha",
|
||||
"build:app": "react-scripts build",
|
||||
"build:cms": "cd cms && npm run build",
|
||||
"build:cms": "cd cms && NODE_ENV=production npm run build",
|
||||
"build:postcss": "postcss build/static/css/*.css -r",
|
||||
"build:react-snapshot": "react-snapshot",
|
||||
"build:sw": "sw-precache --config='sw-precache-config.js'",
|
||||
"build:sitemap": "node ./functions/generate-sitemap.js",
|
||||
"build:sha": "git rev-parse HEAD > build/sha",
|
||||
"parse-content": "node ./functions/parse-content.js",
|
||||
"prepare": "npm run install:cms",
|
||||
"install:cms": "cd cms && npm i",
|
||||
"resize-images": "node ./functions/resize-images.js",
|
||||
"prepare-content": "npm-run-all -s parse-content resize-images",
|
||||
"test": "standard | snazzy && react-scripts test --env=jsdom",
|
||||
|
|
|
|||
|
|
@ -8167,7 +8167,7 @@ set-value@^2.0.0:
|
|||
is-plain-object "^2.0.3"
|
||||
split-string "^3.0.1"
|
||||
|
||||
setimmediate@^1.0.4, setimmediate@^1.0.5:
|
||||
setimmediate@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue