@bigbinary/neeto-commons-frontend 4.13.80 → 4.13.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,4 +39,10 @@ const BABEL_CONFIG = {
39
39
  ],
40
40
  };
41
41
 
42
- module.exports = { BABEL_CONFIG, VITE_BABEL_CONFIG };
42
+ const DEFAULT_VISUALIZER_TEMPLATE = "treemap";
43
+
44
+ module.exports = {
45
+ BABEL_CONFIG,
46
+ VITE_BABEL_CONFIG,
47
+ DEFAULT_VISUALIZER_TEMPLATE,
48
+ };
@@ -3,6 +3,7 @@ const path = require("path");
3
3
  const fs = require("fs");
4
4
  const { execSync, spawn } = require("child_process");
5
5
  const { pick } = require("ramda");
6
+ const { DEFAULT_VISUALIZER_TEMPLATE } = require("./constants");
6
7
 
7
8
  // colors for console output
8
9
  const consoleColors = {
@@ -28,7 +29,7 @@ const writeMetafile = (metafile, outdir) => {
28
29
  return metaFilePath;
29
30
  };
30
31
 
31
- const generateBundleReport = async (metaFilePath, outdir) => {
32
+ const generateBundleReport = async ({ metaFilePath, outdir, template }) => {
32
33
  try {
33
34
  console.info(
34
35
  `${consoleColors.info}[bundle-analyzer]${consoleColors.reset} Generating bundle report...`
@@ -36,7 +37,7 @@ const generateBundleReport = async (metaFilePath, outdir) => {
36
37
 
37
38
  const htmlFilePath = path.join(outdir, "bundle-report.html");
38
39
  execSync(
39
- `npx esbuild-visualizer --metadata ${metaFilePath} --filename ${htmlFilePath}`,
40
+ `npx esbuild-visualizer --metadata ${metaFilePath} --filename ${htmlFilePath} --template ${template}`,
40
41
  { stdio: "inherit" }
41
42
  );
42
43
 
@@ -69,6 +70,10 @@ const build = async config => {
69
70
  ? process.argv[process.argv.indexOf("--entrypoint") + 1]
70
71
  : null;
71
72
 
73
+ const template = process.argv.includes("--template")
74
+ ? process.argv[process.argv.indexOf("--template") + 1]
75
+ : DEFAULT_VISUALIZER_TEMPLATE;
76
+
72
77
  const buildConfig = entrypoint
73
78
  ? { ...config, entryPoints: pick([entrypoint], config.entryPoints) }
74
79
  : config;
@@ -77,7 +82,11 @@ const build = async config => {
77
82
 
78
83
  if (result.metafile) {
79
84
  const metaFilePath = writeMetafile(result.metafile, buildConfig.outdir);
80
- await generateBundleReport(metaFilePath, buildConfig.outdir);
85
+ await generateBundleReport({
86
+ metaFilePath,
87
+ outdir: buildConfig.outdir,
88
+ template,
89
+ });
81
90
  }
82
91
 
83
92
  console.info(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "4.13.80",
3
+ "version": "4.13.81",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",