Skip to content

Commit

Permalink
add v8-compile-cache and fix error with pluginSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Dec 21, 2017
1 parent 7e57314 commit 0564ceb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/webpack.js
Expand Up @@ -4,7 +4,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/

require("v8-compile-cache");
var resolveCwd = require("resolve-cwd");
// Local version replace global one
var localCLI = resolveCwd.silent("webpack-cli/bin/webpack");
Expand Down
24 changes: 20 additions & 4 deletions lib/generators/add-generator.js
Expand Up @@ -293,14 +293,30 @@ module.exports = class AddGenerator extends Generator {
pluginsSchemaPath.indexOf("optimize") >= 0
? "webpack.optimize"
: "webpack";
const pluginSchema = Object.keys(
require(path.resolve(pluginsSchemaPath)).properties
).map(p => p);
const resolvePluginsPath = path.resolve(pluginsSchemaPath);
const pluginSchema = resolvePluginsPath
? require(resolvePluginsPath)
: null;
let pluginsSchemaProps = ["other"];
if (pluginSchema) {
Object.keys(pluginSchema)
.filter(p => Array.isArray(pluginSchema[p]))
.forEach(p => {
Object.keys(pluginSchema[p]).forEach(n => {
if (pluginSchema[p][n].properties) {
pluginsSchemaProps = Object.keys(
pluginSchema[p][n].properties
);
}
});
});
}

return this.prompt([
List(
"pluginsPropType",
`What property do you want to add ${pluginExist}?`,
pluginSchema
pluginsSchemaProps
)
]).then(pluginsPropAnswer => {
return this.prompt([
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -67,6 +67,7 @@
"recast": "^0.13.0",
"resolve-cwd": "^2.0.0",
"supports-color": "^4.4.0",
"v8-compile-cache": "^1.1.0",
"webpack-addons": "^1.1.5",
"yargs": "^9.0.1",
"yeoman-environment": "^2.0.0",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Expand Up @@ -5932,6 +5932,10 @@ uuid@^3.0.0, uuid@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"

v8-compile-cache@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-1.1.0.tgz#1dc2a340fb8e5f800a32bcdbfb8c23cd747021b9"

v8flags@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"
Expand Down

0 comments on commit 0564ceb

Please sign in to comment.