mirror of https://github.com/webpack/webpack.git
feat: cli flags
This commit is contained in:
parent
8d246f7ba3
commit
2a8f79983e
|
@ -1,8 +1,7 @@
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const prettier = require("prettier");
|
const prettier = require("prettier");
|
||||||
const schema = require("../schemas/WebpackOptions");
|
const schema = require("../schemas/WebpackOptions.json");
|
||||||
const prettierConfig = prettier.resolveConfig.sync("./bin/cli-flags.js");
|
|
||||||
|
|
||||||
const flags = {};
|
const flags = {};
|
||||||
|
|
||||||
|
@ -134,8 +133,11 @@ function traverse(schemaPart, schemaPath = "", depth = 0, inArray = false) {
|
||||||
|
|
||||||
traverse(schema);
|
traverse(schema);
|
||||||
|
|
||||||
|
const cliFlagsPath = path.resolve(__dirname, "../bin/cli-flags.js");
|
||||||
|
const prettierConfig = prettier.resolveConfig.sync(cliFlagsPath);
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.resolve(__dirname, "../bin/cli-flags.js"),
|
cliFlagsPath,
|
||||||
prettier.format(`module.exports = ${JSON.stringify(flags, null, 2)};`, {
|
prettier.format(`module.exports = ${JSON.stringify(flags, null, 2)};`, {
|
||||||
...prettierConfig,
|
...prettierConfig,
|
||||||
parser: "babel"
|
parser: "babel"
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"include": [
|
"include": [
|
||||||
"declarations.d.ts",
|
"declarations.d.ts",
|
||||||
"declarations/*.d.ts",
|
"declarations/*.d.ts",
|
||||||
|
"schemas/*.json",
|
||||||
"bin/*.js",
|
"bin/*.js",
|
||||||
"lib/**/*.js",
|
"lib/**/*.js",
|
||||||
"tooling/**/*.js"
|
"tooling/**/*.js"
|
||||||
|
|
Loading…
Reference in New Issue