Skip to content

Commit

Permalink
refactor: minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Dec 19, 2024
1 parent 98728ee commit 6a646aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
10 changes: 2 additions & 8 deletions packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ This folder is the collection of those packages.
## Packages

1. [configtest](https://github.com/webpack/webpack-cli/tree/master/packages/configtest)
2. [generators](https://github.com/webpack/webpack-cli/tree/master/packages/generators)
2. [create-webpack-app](https://github.com/webpack/webpack-cli/tree/master/packages/create-webpack-app)
3. [info](https://github.com/webpack/webpack-cli/tree/master/packages/info)
4. [serve](https://github.com/webpack/webpack-cli/tree/master/packages/serve)
5. [webpack-cli](https://github.com/webpack/webpack-cli/tree/master/packages/webpack-cli)

## Generic Installation

1. Standalone installation of packages

```shell
npm install @webpack-cli/<package>
```

2. Installation of respective `package` with `webpack-cli` [Recommended]
Standalone installation of packages (except `create-webpack-app`, it is a self-sufficient package)

```shell
npm install webpack-cli @webpack-cli/<package>
Expand Down
3 changes: 0 additions & 3 deletions test/build/config-format/typescript-esnext/typescript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ describe("webpack cli", () => {
env,
});

console.log(stderr);
console.log(stdout);

expect(stderr).not.toBeFalsy(); // Deprecation warning logs on stderr
expect(stdout).toBeTruthy();
expect(exitCode).toBe(0);
Expand Down
3 changes: 0 additions & 3 deletions test/build/config-name/config-name.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ describe("--config-name flag", () => {
false,
);

console.log(stdout);
console.log(stderr);

expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toContain("first");
Expand Down
10 changes: 5 additions & 5 deletions test/create-webpack-app/test.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ function createPathDependentUtils(cli) {
};
/*
* runPromptWithAnswers
* @param {string} location location of current working directory
* @param {string} location of current working directory
* @param {string[]} args CLI args to pass in
* @param {string[]} answers answers to be passed to stdout for inquirer question
* @param {string[]} answers to be passed to stdout for inquirer question
*/
const runPromptWithAnswers = (location, args, answers) => {
const process = runAndGetProcess(location, args);

process.stdin.setDefaultEncoding("utf-8");

const delay = 2000;
const delay = 1000;
let outputTimeout;
let currentAnswer = 0;

Expand All @@ -162,12 +162,12 @@ function createPathDependentUtils(cli) {
write(chunk, encoding, callback) {
const output = chunk.toString("utf8");

if (output) {
if (output.length > 0) {
if (outputTimeout) {
clearTimeout(outputTimeout);
}

// we must receive new stdout, then have 2 seconds
// we must receive new stdout, then have 1 second
// without any stdout before writing the next answer
outputTimeout = setTimeout(() => {
writeAnswer(output);
Expand Down

0 comments on commit 6a646aa

Please sign in to comment.