Skip to content

Commit 00b5aec

Browse files
committed
Remove analyzer, update logger output
1 parent 64ff2d6 commit 00b5aec

32 files changed

+25
-17256
lines changed

package-lock.json

Lines changed: 5 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
"url": "https://github.com/dojo/cli-build-app.git"
1818
},
1919
"scripts": {
20-
"webpack-bundle-analyzer": "cd src/webpack-bundle-analyzer/client && npm run build:dist && shx mv output/dist ../../../dist/release/webpack-bundle-analyzer/reporter && cd ../../../",
2120
"artifact:build:pwa": "cd test-app && npm run build:dist:pwa:evergreen && shx mv output/dist output/dist-pwa-evergreen && npm run build:dev:pwa:evergreen && shx mv output/dev output/dev-pwa-evergreen && npm run build:dist:pwa && shx mv output/dist output/dist-pwa && npm run build:dev:pwa && shx mv output/dev output/dev-pwa",
2221
"artifact:build:app": "cd test-app && npm run build:dist:evergreen && shx mv output/dist output/dist-app-evergreen && npm run build:dev:evergreen && shx mv output/dev output/dev-app-evergreen && npm run build:dist && shx mv output/dist output/dist-app && npm run build:dev && shx mv output/dev output/dev-app",
2322
"artifact:install": "cd test-app && shx rm -rf node_modules && npm i && npm run install-build-app",
2423
"artifact:package": "cd dist && npm pack -q ./release && shx mv dojo-cli-build-app-* dojo-cli-build-app.tgz && cd ..",
25-
"build:static:dev": "cpx \"{src,tests}/**/*.{d.ts,html,md,json,js,css}\" dist/dev && rimraf dist/dev/src/webpack-bundle-analyzer/client",
26-
"build:static:release": "cpx \"src/**/*.{d.ts,json}\" dist/release && rimraf dist/release/webpack-bundle-analyzer/client",
24+
"build:static:dev": "cpx \"{src,tests}/**/*.{d.ts,html,md,json,js,css}\" dist/dev",
25+
"build:static:release": "cpx \"src/**/*.{d.ts,json}\" dist/release",
2726
"build:cjs": "tsc",
28-
"build": "npm-run-all -p build:** -s webpack-bundle-analyzer -s dojo-package && rimraf src/webpack-bundle-analyzer/client/node_modules",
27+
"build": "npm-run-all -p build:** -s dojo-package",
2928
"clean": "rimraf dist coverage output test-app/output test-app/node_modules",
3029
"dojo-package": "dojo-package",
3130
"dojo-release": "dojo-release",
@@ -69,7 +68,6 @@
6968
"@types/execa": "0.8.0",
7069
"@types/express": "4.11.0",
7170
"@types/express-serve-static-core": "4.16.4",
72-
"@types/fs-extra": "^8.1.0",
7371
"@types/globby": "6.1.0",
7472
"@types/gzip-size": "4.0.0",
7573
"@types/html-webpack-plugin": "3.2.0",
@@ -81,7 +79,6 @@
8179
"@types/log-update": "2.0.0",
8280
"@types/mini-css-extract-plugin": "0.2.0",
8381
"@types/minimatch": "3.0.3",
84-
"@types/mkdirp": "0.5.2",
8582
"@types/mockery": "1.4.29",
8683
"@types/node": "~9.6.5",
8784
"@types/ora": "1.3.1",
@@ -107,7 +104,7 @@
107104
"sinon": "~4.5.0"
108105
},
109106
"dependencies": {
110-
"@dojo/webpack-contrib": "7.0.0-beta.2",
107+
"@dojo/webpack-contrib": "file:~/Projects/opensource/webpack-contrib/dist/release/dojo-webpack-contrib-7.0.0-beta.2.tgz",
111108
"brotli-webpack-plugin": "1.0.0",
112109
"caniuse-lite": "1.0.30000973",
113110
"chalk": "2.4.1",
@@ -124,7 +121,6 @@
124121
"extra-watch-webpack-plugin": "1.0.3",
125122
"file-loader": "2.0.0",
126123
"globby": "7.1.1",
127-
"mkdirp": "0.5.1",
128124
"gzip-size": "4.1.0",
129125
"html-loader": "0.5.5",
130126
"html-webpack-plugin": "3.2.0",

src/logger.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import * as logUpdate from 'log-update';
33
import * as logSymbols from 'log-symbols';
44
import * as typescript from 'typescript';
55
import * as jsonFile from 'jsonfile';
6-
import BundleAnalyzer from './webpack-bundle-analyzer/BundleAnalyzer';
6+
import analyzeBundles from '@dojo/webpack-contrib/webpack-bundle-analyzer/AnalyzeBundles';
7+
import { findLargestPackage } from '@dojo/webpack-contrib/webpack-bundle-analyzer/parseUtils';
78
import chalk from 'chalk';
8-
import { findLargestGroup } from './webpack-bundle-analyzer/parseUtils';
99

1010
const pkgDir = require('pkg-dir');
1111
const columns = require('cli-columns');
@@ -20,13 +20,14 @@ export default function logger(stats: any, config: any, runningMessage: string =
2020

2121
let chunkMap: { [chunk: string]: any };
2222
if (args.mode === 'dist') {
23-
chunkMap = new BundleAnalyzer({
23+
chunkMap = analyzeBundles(stats, config, {
2424
analyzerMode: 'static',
2525
openAnalyzer: false,
2626
generateStatsFile: true,
2727
reportFilename: '../info/report.html',
28-
statsFilename: '../info/stats.json'
29-
}).analyze(stats, config);
28+
statsFilename: '../info/stats.json',
29+
excludeBundles: '(^bootstrap.)|(^runtime/)'
30+
});
3031
}
3132
chunks = (Array.isArray(config)
3233
? loggerStats.children.reduce((chunks: any[], current: any) => [...chunks, ...current.chunks], [])
@@ -37,17 +38,19 @@ export default function logger(stats: any, config: any, runningMessage: string =
3738
return chunkName;
3839
} else {
3940
const chunkStats = chunkMap[chunkName];
40-
const size = chunkStats && (chunkStats.parsedSize || chunkStats.statSize);
41-
const gzipSize = chunkStats && chunkStats.gzipSize;
41+
const size = ((chunkStats && (chunkStats.parsedSize || chunkStats.statSize)) || 0) / 1000;
42+
const gzipSize = ((chunkStats && chunkStats.gzipSize) || 0) / 1000;
4243

43-
const chunkInfo = `${chunkName} ${chalk.yellow(`(${size}kb)`)}${
44-
gzipSize ? `/ ${chalk.blue(`(${gzipSize}kb gz)`)}` : ''
44+
const chunkInfo = `${chunkName} ${chalk.yellow(`(${size}kB)`)}${
45+
gzipSize ? `/ ${chalk.blue(`(${gzipSize}kB gz)`)}` : ''
4546
}`;
4647

47-
if (size > 1000) {
48-
const largestGroup = findLargestGroup(chunkStats, 'node_modules');
49-
if (largestGroup) {
50-
return `${chunkInfo}\nDependency: ${largestGroup.label} is ${largestGroup.statSize}kb`;
48+
if (size > 250) {
49+
const largestPackage = findLargestPackage(chunkStats);
50+
if (largestPackage) {
51+
return `${chunkInfo}\nLargest dependency is ${largestPackage.name} (${chalk.yellow(
52+
`${largestPackage.size / 1000}kB`
53+
)})`;
5154
}
5255
}
5356
return chunkInfo;

src/webpack-bundle-analyzer/BundleAnalyzer.ts

Lines changed: 0 additions & 87 deletions
This file was deleted.

src/webpack-bundle-analyzer/analyzer.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/webpack-bundle-analyzer/client/.dojorc

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/webpack-bundle-analyzer/client/.gitignore

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)