-
-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: add an option to watch messaging. Add .idea to .gitignore #200
Changes from 7 commits
ae41587
21807e0
e59afb3
dc92d8b
a76975c
261d54f
0b05716
2695ec1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,12 @@ | |
type: "boolean", | ||
group: DISPLAY_GROUP, | ||
describe: "Show more details" | ||
}, | ||
"info-verbosity": { | ||
type: "string", | ||
default: "info", | ||
group: DISPLAY_GROUP, | ||
describe: "Controls the output of lifecycle messaging e.g. Started watching files... (verbose, info, none)" | ||
} | ||
}); | ||
|
||
|
@@ -399,6 +405,12 @@ | |
} | ||
}); | ||
|
||
ifArg("info-verbosity", function(value) { | ||
if (!["none", "info", "verbose"].includes(value)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ev1stensberg can we keep this check until schema lands so there is no misuse? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you create an issue for it? Mergeable after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done #249 @ev1stensberg |
||
throw new Error("Invalid configuration object. \n configuration['info-verbosity'] should be one of these:\n \"none\" | \"info\" | \"verbose\""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we've got a error helper for this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I maybe misunderstood, but couldnt find the usage in codebase of error helper, could you please point me into the right direction here? All i've found is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, okay, so if you look in the function inside the bin folder that I believe is called convert-argv, there's a processing of the options, and if it's not matching the schema, it throws. At least that is what I think it's doing under the hood. I'm not on a computer right now, so let me get back to you in a bit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah but seems it doesnt support enum which could substitue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should only be a string |
||
outputOptions.infoVerbosity = value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If You should send a PR to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will modify within this scope (the schema), completely forgot about it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. schema added and pr's linked in description section There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool beans 🐻 |
||
}); | ||
|
||
var webpack = require("webpack/lib/webpack.js"); | ||
|
||
var lastHash = null; | ||
|
@@ -428,6 +440,15 @@ | |
); | ||
} | ||
|
||
if (outputOptions.infoVerbosity === "verbose") { | ||
compiler.hooks.beforeCompile.tap("WebpackInfo", (compilation) => { | ||
console.log("\nCompilation starting…\n"); | ||
}); | ||
compiler.hooks.afterCompile.tap("WebpackInfo", (compilation) => { | ||
console.log("\nCompilation finished\n"); | ||
}); | ||
} | ||
|
||
function compilerCallback(err, stats) { | ||
if (!options.watch || err) { | ||
// Do not keep cache anymore | ||
|
@@ -465,7 +486,8 @@ | |
process.stdin.resume(); | ||
} | ||
compiler.watch(watchOptions, compilerCallback); | ||
console.log("\nWebpack is watching the files…\n"); | ||
if (outputOptions.infoVerbosity !== "none") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
console.log("\nWebpack is watching the files…\n"); | ||
} else compiler.run(compilerCallback); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"use strict"; | ||
|
||
module.exports = function testAssertions(code, stdout, stderr) { | ||
expect(stderr[3]).toContain("Error: Invalid configuration object."); | ||
expect(stderr[4]).toContain("configuration['info-verbosity'] should be one of these:"); | ||
expect(stderr[5]).toContain("\"none\" | \"info\" | \"verbose\""); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--entry ./index.js | ||
--config ./webpack.config.js | ||
--output-filename [name].js | ||
--output-chunk-filename [id].chunk.js | ||
--info-verbosity false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var path = require("path"); | ||
|
||
module.exports = { | ||
entry: path.resolve(__dirname, "./index") | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use strict"; | ||
|
||
module.exports = function testAssertions(stdout, stderr, done) { | ||
expect(stdout).toEqual(expect.anything()); | ||
expect(stdout[0]).toContain(""); | ||
expect(stdout[1]).not.toContain("Webpack is watching the files…"); | ||
expect(stdout[1]).toContain("Version: webpack"); | ||
|
||
expect(stderr).toHaveLength(0); | ||
done(); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--entry ./index.js | ||
--config ./webpack.config.js | ||
--output-filename [name].js | ||
--output-chunk-filename [id].chunk.js | ||
--target async-node | ||
--watch | ||
--info-verbosity none |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var path = require("path"); | ||
|
||
module.exports = { | ||
entry: path.resolve(__dirname, "./index") | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
|
||
module.exports = function testAssertions(stdout, stderr, done) { | ||
expect(stdout).toEqual(expect.anything()); | ||
expect(stdout[0]).toContain(""); | ||
expect(stdout[1]).toContain("Compilation starting…"); | ||
expect(stdout[2]).toContain(""); | ||
expect(stdout[3]).toContain(""); | ||
expect(stdout[4]).toContain("Webpack is watching the files…"); | ||
expect(stdout[5]).toContain(""); | ||
expect(stdout[6]).toContain(""); | ||
expect(stdout[7]).toContain("Compilation finished"); | ||
expect(stdout[8]).toContain(""); | ||
|
||
expect(stderr).toHaveLength(0); | ||
done(); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--entry ./index.js | ||
--config ./webpack.config.js | ||
--output-filename [name].js | ||
--output-chunk-filename [id].chunk.js | ||
--target async-node | ||
--watch | ||
--info-verbosity verbose |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var path = require("path"); | ||
|
||
module.exports = { | ||
entry: path.resolve(__dirname, "./index") | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between
info
andverbose
? Seems to do the same thing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well within this PR yes, but the next one should add two more messages they will be verbose only (see linked issues)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make it in this PR as well? Ask any of the maintainers if you got any questions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it will stretch out for another month in that case, any good reason for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving code unfinished is a bad habit 💃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you promise to respond quickly im on it! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinky Promise 😆