Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Oct 17, 2020
1 parent cc081a2 commit e032ef8
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 188 deletions.
2 changes: 2 additions & 0 deletions packages/webpack-cli/lib/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const logger = require('./utils/logger');
const { isCommandUsed } = require('./utils/arg-utils');
const cliExecuter = require('./utils/cli-executer');
const argParser = require('./utils/arg-parser');

require('./utils/process-log');

process.title = 'webpack-cli';

// Create a new instance of the CLI object
Expand Down
167 changes: 0 additions & 167 deletions packages/webpack-cli/lib/utils/Compiler.js

This file was deleted.

13 changes: 4 additions & 9 deletions packages/webpack-cli/lib/utils/interactive.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { gray, bold, white, cyan, yellow } = require('colorette');
const webpack = require('./Compiler');
const ansiEscapes = require('ansi-escapes');
const readline = require('readline');

Expand Down Expand Up @@ -96,19 +95,16 @@ const ENTER_KEY = '\n';
const B_KEY = 'b';
const C_KEY = 'c';

module.exports = async function (config, outputOptions) {
module.exports = async function (compiler, config, outputOptions) {
const stdin = process.stdin;
stdin.setEncoding('utf-8');
stdin.setRawMode(true);
readline.emitKeypressEvents(stdin);

outputOptions.interactive = false;

const webpackCompilation = await webpack({ options: config, outputOptions });
/* if(errors) {
Hngggg
} */
state.push(webpackCompilation);
state.push(compiler);

setupInteractive();

const isExitCtrl = (key) => key.ctrl && key.name === 'c';
Expand Down Expand Up @@ -164,8 +160,7 @@ module.exports = async function (config, outputOptions) {
if (state.length) {
state.pop();
}
const webpackCompilation = await webpack({ options: config, outputOptions });
state.push(webpackCompilation);
state.push(compiler);
informActions();
isSub = true;
return;
Expand Down
Loading

0 comments on commit e032ef8

Please sign in to comment.