Skip to content

Commit 51ab19f

Browse files
committedMar 23, 2018
feat: add envinfo as webpack-cli info command
1 parent 8787043 commit 51ab19f

File tree

6 files changed

+31
-2
lines changed

6 files changed

+31
-2
lines changed
 

‎.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
**If this is a feature request, what is motivation or use case for changing the behavior?**
1414

15-
**Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.**
15+
**Please paste the results of `webpack-cli info` here, and mention other relevant information such as programming language.**

‎bin/webpack.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
*/
3131
"serve",
3232
"generate-loader",
33-
"generate-plugin"
33+
"generate-plugin",
34+
"info"
3435
];
3536

3637
const NON_COMPILATION_CMD = process.argv.find(arg => {

‎lib/commands/info.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
3+
const envinfo = require("envinfo");
4+
5+
/**
6+
* Prints debugging information for webpack issue reporting
7+
*/
8+
9+
module.exports = function info() {
10+
console.log(
11+
envinfo.run({
12+
System: ["OS", "CPU"],
13+
Binaries: ["Node", "Yarn", "npm"],
14+
Browsers: ["Chrome", "Firefox", "Safari"],
15+
npmPackages: "*webpack*",
16+
npmGlobalPackages: ["webpack", "webpack-cli"],
17+
})
18+
);
19+
};

‎lib/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ module.exports = function initialize(command, args) {
5353
case "generate-plugin": {
5454
return require("./generate-plugin/index.js")();
5555
}
56+
case "info": {
57+
return require("./commands/info.js")();
58+
}
5659
default: {
5760
throw new Error(`Unknown command ${command} found`);
5861
}

‎package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"cross-spawn": "^6.0.5",
8585
"diff": "^3.5.0",
8686
"enhanced-resolve": "^4.0.0",
87+
"envinfo": "^4.4.2",
8788
"glob-all": "^3.1.0",
8889
"global-modules": "^1.0.0",
8990
"got": "^8.2.0",

0 commit comments

Comments
 (0)
Please sign in to comment.