diff options
| author | Dayana31 <[email protected]> | 2022-04-21 17:27:08 -0500 |
|---|---|---|
| committer | Dayana31 <[email protected]> | 2022-04-21 17:27:08 -0500 |
| commit | 67c50667678dd0ce4709b29a854f6a47093a1ac5 (patch) | |
| tree | b6f9f39092ad54bf6b815984d32b37d7c7ca67ab /front/odiparpack/internals/scripts/dependencies.js | |
| parent | 91140b24f0d49a9f89a080ee063e9eb023a4b73a (diff) | |
| parent | e13e630cd6e4fc0b1ff92098a28a770794c7bb9a (diff) | |
| download | DP1_project-67c50667678dd0ce4709b29a854f6a47093a1ac5.tar.gz DP1_project-67c50667678dd0ce4709b29a854f6a47093a1ac5.tar.bz2 DP1_project-67c50667678dd0ce4709b29a854f6a47093a1ac5.zip | |
Merge branch 'gabshr' into dayana
Diffstat (limited to 'front/odiparpack/internals/scripts/dependencies.js')
| -rw-r--r-- | front/odiparpack/internals/scripts/dependencies.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/front/odiparpack/internals/scripts/dependencies.js b/front/odiparpack/internals/scripts/dependencies.js new file mode 100644 index 0000000..4f9f1ed --- /dev/null +++ b/front/odiparpack/internals/scripts/dependencies.js @@ -0,0 +1,52 @@ +// No need to build the DLL in production +if (process.env.NODE_ENV === 'production') { + process.exit(0); +} + +require('shelljs/global'); + +const path = require('path'); +const fs = require('fs'); +const exists = fs.existsSync; +const writeFile = fs.writeFileSync; + +const defaults = require('lodash/defaultsDeep'); +const pkg = require(path.join(process.cwd(), 'package.json')); +const config = require('../config'); +const dllConfig = defaults(pkg.dllPlugin, config.dllPlugin.defaults); +const outputPath = path.join(process.cwd(), dllConfig.path); +const dllManifestPath = path.join(outputPath, 'package.json'); + +/** + * I use node_modules/react-boilerplate-dlls by default just because + * it isn't going to be version controlled and babel wont try to parse it. + */ +mkdir('-p', outputPath); + +echo('Building the Webpack DLL...'); + +/** + * Create a manifest so npm install doesn't warn us + */ +if (!exists(dllManifestPath)) { + writeFile( + dllManifestPath, + JSON.stringify( + defaults({ + name: 'react-boilerplate-dlls', + private: true, + author: pkg.author, + repository: pkg.repository, + version: pkg.version, + }), + null, + 2, + ), + 'utf8', + ); +} + +// the BUILDING_DLL env var is set to avoid confusing the development environment +exec( + 'cross-env BUILDING_DLL=true webpack --display-chunks --color --config internals/webpack/webpack.dll.babel.js --hide-modules', +); |
