feat: cli flags

This commit is contained in:
evilebottnawi 2020-03-06 20:38:33 +03:00 committed by Tobias Koppers
parent 8d246f7ba3
commit 2a8f79983e
2 changed files with 6 additions and 3 deletions

View File

@ -1,8 +1,7 @@
const fs = require("fs");
const path = require("path");
const prettier = require("prettier");
const schema = require("../schemas/WebpackOptions");
const prettierConfig = prettier.resolveConfig.sync("./bin/cli-flags.js");
const schema = require("../schemas/WebpackOptions.json");
const flags = {};
@ -134,8 +133,11 @@ function traverse(schemaPart, schemaPath = "", depth = 0, inArray = false) {
traverse(schema);
const cliFlagsPath = path.resolve(__dirname, "../bin/cli-flags.js");
const prettierConfig = prettier.resolveConfig.sync(cliFlagsPath);
fs.writeFileSync(
path.resolve(__dirname, "../bin/cli-flags.js"),
cliFlagsPath,
prettier.format(`module.exports = ${JSON.stringify(flags, null, 2)};`, {
...prettierConfig,
parser: "babel"

View File

@ -15,6 +15,7 @@
"include": [
"declarations.d.ts",
"declarations/*.d.ts",
"schemas/*.json",
"bin/*.js",
"lib/**/*.js",
"tooling/**/*.js"