Skip to content

Commit

Permalink
fix: corrected import
Browse files Browse the repository at this point in the history
  • Loading branch information
info-arnav committed Apr 8, 2024
1 parent cea8d22 commit 075b38c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/bin/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const viewer = require("../viewer");
const Logger = require("../Logger");
const utils = require("../utils");

const { options } = require("./bundle-analyzer-flags.js");
const options = require("./bundle-analyzer-flags.js");
const { cli } = require("webpack");

const SIZES = new Set(["stat", "parsed", "gzip"]);
Expand Down Expand Up @@ -106,8 +106,10 @@ try {
process.exit(1);
}

options.forEach((option) => {
cli.option(option.path, option.description, option.defaultValue);
Object.entries(options).forEach(([key, optionConfig]) => {
optionConfig.configs.forEach((config) => {
cli.option(config.path, config.description, config.defaultValue);
});
});

if (typeof reportTitle === "undefined") {
Expand Down
18 changes: 12 additions & 6 deletions src/bin/bundle-analyzer-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = {
type: "enum",
values: ["server", "static", "json"],
multiple: false,
description: "The mode to run the analyzer in: server, static, or json.",
description:
"The mode to run the analyzer in: server, static, or json.",
path: "mode",
defaultValue: "server",
},
Expand All @@ -34,12 +35,14 @@ module.exports = {
{
type: "string",
multiple: false,
description: 'Path to bundle report file that will be generated in "static" mode.',
description:
'Path to bundle report file that will be generated in "static" mode.',
path: "report",
defaultValue: "report.html",
},
],
description: 'Path to bundle report file that will be generated in "static" mode.',
description:
'Path to bundle report file that will be generated in "static" mode.',
simpleType: "string",
multiple: false,
},
Expand Down Expand Up @@ -91,7 +94,8 @@ module.exports = {
{
type: "number",
multiple: false,
description: "Port that will be used in `server` mode, default is 8888.",
description:
"Port that will be used in `server` mode, default is 8888.",
path: "port",
defaultValue: 8888,
},
Expand All @@ -105,12 +109,14 @@ module.exports = {
{
type: "string",
multiple: false,
description: "Host that will be used in `server` mode, default is 127.0.0.1.",
description:
"Host that will be used in `server` mode, default is 127.0.0.1.",
path: "host",
defaultValue: "127.0.0.1",
},
],
description: "Host that will be used in `server` mode, default is 127.0.0.1.",
description:
"Host that will be used in `server` mode, default is 127.0.0.1.",
simpleType: "string",
multiple: false,
},
Expand Down

0 comments on commit 075b38c

Please sign in to comment.