-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract webpack config to its own module (#1569)
* extract webpack config to its own module * update to use @xarc/webpack * ensure karma will install deps sinon/mocha/chai/enzyme * update tests for webpack config
- Loading branch information
Showing
89 changed files
with
267 additions
and
150 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 |
---|---|---|
|
@@ -25,25 +25,30 @@ | |
"Joel Chen <[email protected]>" | ||
], | ||
"dependencies": { | ||
"@types/mocha": "5.2.7", | ||
"babel-plugin-istanbul": "^5.1.0", | ||
"chai": "^4.0.0", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-shallowly": "^1.0.0", | ||
"enzyme": "^3.0.0", | ||
"chai": "^4.0.0", | ||
"core-js": "^3", | ||
"enzyme-adapter-react-16": "^1.1.0", | ||
"karma": "^3.1.1", | ||
"enzyme": "^3.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage": "^2.0.0", | ||
"karma-firefox-launcher": "^1.1.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-intl-shim": "^1.0.3", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.2", | ||
"karma-mocha": "^1.3.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-sonarqube-unit-reporter": "0.0.21", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-spec-reporter": "0.0.32", | ||
"karma-webpack": "4.0.0-rc.3" | ||
"karma-webpack": "4.0.0-rc.3", | ||
"karma": "^3.1.1", | ||
"mocha": "^4.0.0", | ||
"sinon-chai": "^2.14.0", | ||
"sinon": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"opt-archetype-check": "../opt-archetype-check", | ||
|
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
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,22 +1 @@ | ||
"use strict"; | ||
|
||
const { initWebpackConfigComposer, generateConfig } = require("./util/generate-config"); | ||
|
||
// | ||
// When clap execute a build task that involves invoking webpack it | ||
// will check if user wants webpack to start with their webpack.config.js | ||
// If yes, then the task will set env ELECTRODE_WEBPACK_PROFILE to | ||
// the desired profile, so when webpack runs, it's passed to the | ||
// archetype, where we can check and load the correct internal | ||
// webpack config accordingly. | ||
// | ||
const profile = process.env.ELECTRODE_WEBPACK_PROFILE || "production"; | ||
const options = require(`./options/${profile}`); | ||
|
||
module.exports = { | ||
initWebpackConfigComposer, | ||
compose: generateConfig, | ||
env: profile, | ||
options, | ||
partials: require("./partials") | ||
}; | ||
module.exports = require("@xarc/webpack"); |
4 changes: 1 addition & 3 deletions
4
packages/xarc-app-dev/config/webpack/webpack.config.browsercoverage.js
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("browsercoverage"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.browsercoverage"); |
4 changes: 1 addition & 3 deletions
4
packages/xarc-app-dev/config/webpack/webpack.config.coverage.js
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("coverage"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.coverage"); |
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("development"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.dev"); |
4 changes: 1 addition & 3 deletions
4
packages/xarc-app-dev/config/webpack/webpack.config.dev.static.js
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("static"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.dev.static"); |
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("dll"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.dll"); |
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("production"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config"); |
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,3 +1 @@ | ||
"use strict"; | ||
|
||
module.exports = require("./util/load-config")("test"); | ||
module.exports = require("@xarc/webpack/lib/webpack.config.test"); |
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,19 +1,7 @@ | ||
"use strict"; | ||
|
||
const Path = require("path"); | ||
const requireAt = require("require-at"); | ||
const optionalRequire = require("optional-require")(require); | ||
|
||
const invalidRequire = () => false; | ||
invalidRequire.resolve = () => false; | ||
invalidRequire.invalid = true; | ||
const getOptRequire = require("@xarc/webpack/lib/util/get-opt-require"); | ||
|
||
module.exports = { | ||
getOptArchetypeRequire(name) { | ||
const optPkg = optionalRequire.resolve(`${name}/package.json`); | ||
if (optPkg) { | ||
return requireAt(Path.dirname(optPkg)); | ||
} | ||
return invalidRequire; | ||
} | ||
getOptArchetypeRequire: getOptRequire | ||
}; |
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 |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
"Joel Chen <[email protected]>" | ||
], | ||
"peerDependencies": { | ||
"@xarc/app": "^7.0.4" | ||
"@xarc/app": "^8.0.3" | ||
}, | ||
"dependencies": { | ||
"@babel/cli": "^7.1.5", | ||
|
@@ -46,63 +46,41 @@ | |
"@babel/register": "^7.0.0", | ||
"@jchip/redbird": "^1.0.0", | ||
"@loadable/babel-plugin": "^5.10.0", | ||
"@loadable/webpack-plugin": "^5.7.1", | ||
"@xarc/defer": "^1.0.0", | ||
"acorn": "^6.0.5", | ||
"@xarc/webpack": "../xarc-webpack", | ||
"ansi-to-html": "^0.6.8", | ||
"autoprefixer": "^9.6.0", | ||
"babel-loader": "^8.0.4", | ||
"babel-plugin-dynamic-import-node": "^2.2.0", | ||
"babel-plugin-lodash": "^3.3.4", | ||
"babel-plugin-minify-dead-code-elimination": "^0.5.0", | ||
"babel-plugin-transform-node-env-inline": "^0.4.3", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.20", | ||
"batch": "^0.6.1", | ||
"boxen": "^2.1.0", | ||
"chalker": "^1.1.1", | ||
"chokidar": "^2.0.4", | ||
"convert-source-map": "^1.5.0", | ||
"core-js": "^2 || ^3", | ||
"css-loader": "^1.0.0", | ||
"electrode-cdn-file-loader": "^1.0.0", | ||
"core-js": "^3", | ||
"electrode-hapi-compat": "^1.2.0", | ||
"electrode-node-resolver": "^2.0.0", | ||
"fastify-plugin": "^1.6.0", | ||
"file-loader": "^2.0.0", | ||
"filter-scan-dir": "^1.0.9", | ||
"finalhandler": "^1.1.1", | ||
"fs-extra": "^0.26.5", | ||
"identity-obj-proxy": "^3.0.0", | ||
"isomorphic-loader": "^3.0.0", | ||
"jsonfile": "^2.2.2", | ||
"loader-utils": "^1.1.0", | ||
"lodash": "^4.13.1", | ||
"mime": "^1.0.0", | ||
"mini-css-extract-plugin": "^0.7.0", | ||
"mkdirp": "^0.5.1", | ||
"nix-clap": "^1.3.7", | ||
"nyc": "^14.1.1", | ||
"offline-plugin": "^4.6.1", | ||
"optimize-css-assets-webpack-plugin": "^5.0.1", | ||
"optional-require": "^1.0.0", | ||
"prompts": "^2.2.1", | ||
"raw-loader": "^0.5.1", | ||
"regenerator-runtime": "^0.13.2", | ||
"request": "^2.88.0", | ||
"require-at": "^1.0.2", | ||
"rimraf": "^2.4.0", | ||
"serve-index-fs": "^1.10.1", | ||
"style-loader": "^0.20.1", | ||
"subapp-util": "^1.0.3", | ||
"sudo-prompt": "^8.2.5", | ||
"url-loader": "^0.6.2", | ||
"webpack": "^4.41.0", | ||
"webpack-cli": "^3.3.9", | ||
"webpack-config-composer": "^1.1.3", | ||
"webpack-dev-middleware": "^3.4.0", | ||
"webpack-disk-plugin": "0.0.2", | ||
"webpack-hot-middleware": "^2.22.2", | ||
"webpack-stats-plugin": "^0.2.1", | ||
"winston": "^2.3.1", | ||
"xaa": "^1.2.2", | ||
"xclap": "^0.2.38", | ||
|
@@ -127,8 +105,7 @@ | |
"fyn": { | ||
"dependencies": { | ||
"electrode-node-resolver": "../electrode-node-resolver", | ||
"subapp-util": "../subapp-util", | ||
"webpack-config-composer": "../webpack-config-composer" | ||
"subapp-util": "../subapp-util" | ||
}, | ||
"devDependencies": { | ||
"@xarc/app": "../xarc-app", | ||
|
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
Oops, something went wrong.