-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor app setup and remove build app
- Loading branch information
1 parent
a797c2b
commit 781961b
Showing
18 changed files
with
164 additions
and
2,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,7 @@ __pycache__/ | |
.pytest_cache | ||
|
||
/env | ||
/venv | ||
/*.sh | ||
|
||
/output | ||
.Rproj.user | ||
|
||
deploy*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
nvm | ||
node_modules | ||
dist | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
prod: | ||
source ${NVM_DIR}/nvm.sh; nvm use; npm run build:prod | ||
export NVM_DIR=$(dir $(realpath $(lastword $(MAKEFILE_LIST))))/nvm | ||
|
||
watch: | ||
source ${NVM_DIR}/nvm.sh; nvm use; npm run watch | ||
.PHONY: prod build watch | ||
|
||
prod: nvm node_modules | ||
. "${NVM_DIR}/nvm.sh"; nvm use; npm run build:prod | ||
|
||
build: nvm node_modules | ||
. "${NVM_DIR}/nvm.sh"; nvm use; npm run build | ||
|
||
watch: nvm node_modules | ||
. "${NVM_DIR}/nvm.sh"; nvm use; npm run watch | ||
|
||
nvm: | ||
mkdir -p ${NVM_DIR} | ||
NVM_DIR=${NVM_DIR} PROFILE=/dev/null \ | ||
bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash > /dev/null' | ||
. "${NVM_DIR}/nvm.sh"; nvm install | ||
|
||
node_modules: | ||
. "${NVM_DIR}/nvm.sh"; nvm use; npm ci | ||
|
||
clean: | ||
rm -rf nvm node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const webpack = require('webpack') | ||
const { merge } = require('webpack-merge') | ||
const path = require('path') | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin') | ||
const CopyWebpackPlugin = require('copy-webpack-plugin') | ||
const TerserPlugin = require('terser-webpack-plugin') | ||
|
||
// base config for all environments | ||
const baseConfig = { | ||
entry: './src/app.js', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /(node_modules|bower_components)/, | ||
loader: 'babel-loader', | ||
options: { presets: ['@babel/env'] } | ||
} | ||
] | ||
}, | ||
resolve: { extensions: ['*', '.js', '.jsx'] }, | ||
output: { | ||
path: path.resolve(__dirname, './output/'), | ||
filename: 'app.js' | ||
} | ||
} | ||
|
||
// special config for development | ||
const developmentConfig = { | ||
devtool: 'eval', | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('development') | ||
}) | ||
] | ||
} | ||
|
||
// special config for production | ||
const productionConfig = { | ||
bail: true, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('production') | ||
}) | ||
], | ||
optimization: { | ||
minimize: true, | ||
minimizer: [new TerserPlugin()] | ||
} | ||
} | ||
|
||
// combine config depending on the provided --mode command line option | ||
module.exports = (env, argv) => { | ||
switch (argv.mode) { | ||
case 'development': | ||
return merge(baseConfig, developmentConfig) | ||
case 'production': | ||
return merge(baseConfig, productionConfig) | ||
default: | ||
throw new Error('Invalid mode') | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.