diff --git a/packages/info/package.json b/packages/info/package.json index 02d8ccb2ecd..5c91e993860 100644 --- a/packages/info/package.json +++ b/packages/info/package.json @@ -12,7 +12,6 @@ "dependencies": { "@types/yargs": "13.0.0", "chalk": "3.0.0", - "cli-table3": "0.5.1", "envinfo": "7.3.1", "prettyjson": "1.2.1", "yargs": "13.2.2" diff --git a/packages/info/src/index.ts b/packages/info/src/index.ts index 410eb351790..5dc34bd6d96 100644 --- a/packages/info/src/index.ts +++ b/packages/info/src/index.ts @@ -5,7 +5,6 @@ import { argv } from './options'; import { AVAILABLE_COMMANDS, AVAILABLE_FORMATS, IGNORE_FLAGS } from './commands'; import { configReader, fetchConfig, resolveFilePath, getNameFromPath } from './configParser'; -import { renderTable } from './renderTable'; interface Information { Binaries?: string[]; @@ -56,9 +55,6 @@ export default async function info(customArgv: object): Promise { const config = fetchConfig(fullConfigPath); const parsedConfig = configReader(config); - const stringifiedTable = renderTable(parsedConfig, fileName); - if (args.config) return parsedConfig; - else process.stdout.write(stringifiedTable + '\n'); } else { Object.keys(args).forEach((flag: string) => { if (IGNORE_FLAGS.includes(flag)) { diff --git a/packages/info/src/renderTable.ts b/packages/info/src/renderTable.ts deleted file mode 100644 index 9431f720bb4..00000000000 --- a/packages/info/src/renderTable.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Table from "cli-table3"; -import chalk from "chalk"; -export function renderTable(data, fileName): string { - const table = new Table({ - head: [chalk.blueBright("Config"), chalk.blueBright(fileName)] - }); - - data.map( - (elm: Table.Cell[] & Table.VerticalTableRow & Table.CrossTableRow): void => { - table.push(elm); - } - ); - - return table.toString(); -} diff --git a/packages/webpack-cli/README.md b/packages/webpack-cli/README.md index d4ba01ef022..8cb633924c5 100644 --- a/packages/webpack-cli/README.md +++ b/packages/webpack-cli/README.md @@ -50,7 +50,6 @@ Options -h, --hot Enables Hot Module Replacement -s, --sourcemap string Determine source maps to use --prefetch string Prefetch this request - --pretty Prints a fancy output -j, --json Prints result as JSON --standard Prints standard output -d, --dev Run development build diff --git a/packages/webpack-cli/lib/groups/StatsGroup.js b/packages/webpack-cli/lib/groups/StatsGroup.js index 563b76ff8a4..1091dd2d288 100644 --- a/packages/webpack-cli/lib/groups/StatsGroup.js +++ b/packages/webpack-cli/lib/groups/StatsGroup.js @@ -27,10 +27,6 @@ class StatsGroup extends GroupHelper { this.opts.options.stats = this.args.stats; } } - - if (this.args.pretty) { - this.opts.outputOptions.pretty = true; - } } run() { diff --git a/packages/webpack-cli/lib/utils/Compiler.js b/packages/webpack-cli/lib/utils/Compiler.js index 2994ae4e4f9..77780a25b7f 100644 --- a/packages/webpack-cli/lib/utils/Compiler.js +++ b/packages/webpack-cli/lib/utils/Compiler.js @@ -77,19 +77,8 @@ class Compiler { return process.stdout.isTTY && process.platform === 'darwin'; } - generateOutput(outputOptions, stats, statsErrors, processingMessageBuffer) { - if (outputOptions.pretty) { - const statsObj = stats.toJson(outputOptions); - if (statsObj.children && Array.isArray(statsObj.children) && this.compilerOptions && Array.isArray(this.compilerOptions)) { - statsObj.children.forEach(child => { - this.output.generateFancyOutput(child, statsErrors, processingMessageBuffer); - }); - return; - } - this.output.generateFancyOutput(statsObj, statsErrors, processingMessageBuffer); - } else { - this.output.generateRawOutput(stats, this.compilerOptions); - } + generateOutput(outputOptions, stats) { + this.output.generateRawOutput(stats, this.compilerOptions); process.stdout.write('\n'); if (outputOptions.watch) { logger.info('watching files for updates...'); diff --git a/packages/webpack-cli/lib/utils/CompilerOutput.js b/packages/webpack-cli/lib/utils/CompilerOutput.js index 817b5f16e49..0bd64c273f2 100644 --- a/packages/webpack-cli/lib/utils/CompilerOutput.js +++ b/packages/webpack-cli/lib/utils/CompilerOutput.js @@ -1,115 +1,4 @@ -const chalk = require('chalk'); -const Table = require('cli-table3'); -const webpack = require('webpack'); -const logger = require('./logger'); - class CompilerOutput { - generateFancyOutput(statsObj, statsErrors, processingMessageBuffer) { - const { assets, entrypoints, time, builtAt, warnings, outputPath, hash, chunks } = statsObj; - - const visibleEmojies = this._showEmojiConditionally() ? ['✅', '🌏', '⚒️ ', '⏱ ', '📂', '#️⃣'] : new Array(6).fill(''); - - process.stdout.write('\n'); - process.stdout.write(`${visibleEmojies[0]} ${chalk.underline.bold('Compilation Results')}\n`); - process.stdout.write('\n'); - process.stdout.write(`${visibleEmojies[1]} Version: ${webpack.version}\n`); - process.stdout.write(`${visibleEmojies[2]} Built: ${new Date(builtAt).toString()}\n`); - process.stdout.write(`${visibleEmojies[3]} Compile Time: ${time}ms\n`); - process.stdout.write(`${visibleEmojies[4]} Output Directory: ${outputPath}\n`); - process.stdout.write(`${visibleEmojies[5]} Hash: ${hash}\n`); - process.stdout.write('\n'); - - const assetsTble = new Table({ - head: ['Entrypoint', 'Bundle'], - style: { compact: true, 'padding-left': 1, head: [] }, - }); - - let compilationTableEmpty = true; - - Object.keys(entrypoints).forEach(entry => { - const entrypoint = entrypoints[entry]; - entrypoint.assets.forEach(assetName => { - const asset = assets.find(asset => { - return asset.name === assetName; - }); - if (asset) { - const entrypointChunks = entrypoint.chunks.map(id => { - return chunks.find(chunk => chunk.id === id); - }); - - const chunksOutput = this._createChunksOutput(entrypointChunks); - const kbSize = `${(asset.size / 1000).toFixed(2)} kb`; - const hasBeenCompiled = asset.comparedForEmit; - const bundleTbl = new Table({ - chars: { - top: '', - 'top-mid': '', - 'top-left': '', - 'top-right': '', - bottom: '', - 'bottom-mid': '', - 'bottom-left': '', - 'bottom-right': '', - left: '', - 'left-mid': '', - mid: '', - 'mid-mid': '', - right: '', - 'right-mid': '', - }, - style: { compact: true }, - }); - bundleTbl.push({ 'Bundle Name': asset.name }); - bundleTbl.push({ 'Compared For Emit': hasBeenCompiled }); - bundleTbl.push({ 'Bundle size': kbSize }); - const bundleOutput = bundleTbl.toString() + `\n\nModules:\n${chunksOutput}`; - assetsTble.push([entrypoint.name, bundleOutput]); - compilationTableEmpty = false; - } - }); - }); - - if (!compilationTableEmpty) { - process.stdout.write(assetsTble.toString()); - } - - if (processingMessageBuffer.length > 0) { - processingMessageBuffer.forEach(buff => { - if (buff.lvl === 'warn') { - warnings.push(buff.msg); - } else { - statsErrors.push(buff.msg); - } - }); - } - - if (warnings) { - warnings.forEach(warning => { - process.stdout.write('\n\n'); - - if (warning.message) { - logger.warn(warning.message); - process.stdout.write('\n'); - logger.debug(warning.stack); - return; - } - logger.warn(warning); - }); - process.stdout.write('\n'); - } - - if (statsErrors) { - statsErrors.forEach(err => { - if (err.loc) logger.warn(err.loc); - if (err.name) { - process.stdout.write('\n'); - logger.error(err.name); - } - }); - } - return statsObj; - } - generateRawOutput(stats, options) { process.stdout.write(stats.toString(options.stats)); } diff --git a/packages/webpack-cli/lib/utils/cli-flags.js b/packages/webpack-cli/lib/utils/cli-flags.js index ff6da9acffa..dc90ea2873c 100644 --- a/packages/webpack-cli/lib/utils/cli-flags.js +++ b/packages/webpack-cli/lib/utils/cli-flags.js @@ -258,13 +258,6 @@ module.exports = { description: 'Prints result as JSON', group: DISPLAY_GROUP, }, - { - name: 'pretty', - usage: 'webpack --pretty', - type: Boolean, - description: 'Prints a fancy output', - group: DISPLAY_GROUP, - }, { name: 'dev', usage: '--dev', diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index 85023c5efff..45cbb4edd17 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -27,7 +27,6 @@ "@webpack-cli/package-utils": "^1.0.1-alpha.4", "ansi-escapes": "^4.2.1", "chalk": "^3.0.0", - "cli-table3": "^0.5.1", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", "enquirer": "^2.3.4", diff --git a/test/output/pretty/pretty.test.js b/test/output/pretty/pretty.test.js deleted file mode 100644 index 6f552bfc15f..00000000000 --- a/test/output/pretty/pretty.test.js +++ /dev/null @@ -1,12 +0,0 @@ -const { run } = require('../../utils/test-utils'); - -describe('pretty output', () => { - it('should output file given as flag instead of in configuration', () => { - const { stdout } = run(__dirname, ['--pretty']); - expect(stdout).toBeTruthy(); - expect(stdout).toContain('Entrypoint'); - expect(stdout).toContain('Bundle'); - expect(stdout).toContain('Built'); - expect(stdout).toContain('Version'); - }); -}); diff --git a/test/output/pretty/src/index.js b/test/output/pretty/src/index.js deleted file mode 100644 index 0a3380fcdec..00000000000 --- a/test/output/pretty/src/index.js +++ /dev/null @@ -1 +0,0 @@ -console.log('Fancy output'); diff --git a/yarn.lock b/yarn.lock index 609f9a400d7..1b341a13070 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3877,16 +3877,6 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" -cli-table3@0.5.1, cli-table3@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.5.1.tgz#0252372d94dfc40dbd8df06005f48f31f656f202" - integrity sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw== - dependencies: - object-assign "^4.1.0" - string-width "^2.1.1" - optionalDependencies: - colors "^1.1.2" - cli-table@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cli-table/-/cli-table-0.3.1.tgz#f53b05266a8b1a0b934b3d0821e6e2dc5914ae23"