Skip to content

Feature: add --stdin as an option in webpack.config.js#1767

Closed
EslamHiko wants to merge 2 commits into
webpack:masterfrom
EslamHiko:add-stdin-option
Closed

Feature: add --stdin as an option in webpack.config.js#1767
EslamHiko wants to merge 2 commits into
webpack:masterfrom
EslamHiko:add-stdin-option

Conversation

@EslamHiko

@EslamHiko EslamHiko commented Apr 7, 2019

Copy link
Copy Markdown
Contributor
  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

Test already exist 'should exit the process when SIGINT is detected' test in CLI.test

Motivation / Use-Case

solve these issues : webpack/webpack-cli#789 , #1712

Breaking Changes

No

Additional Info

Minimum reproducible repo : https://github.com/EslamHiko/webpack-dev-server/tree/add-stdin-option
go to examples/cli/stdin and add that config :

'use strict';

module.exports = {
  context: __dirname,
  entry: './app.js',
  devServer:{
    stdin:true
  }
};

Run npm run webpack-dev-server without --stdin flag
The server will accept input and closes when you exit CTRL+C/CTRL+D the same behavior when you add --stdin flag
if you don't add the option and run npm run webpack-dev-server without --stdin it won't accept input

@codecov

codecov Bot commented Apr 7, 2019

Copy link
Copy Markdown

Codecov Report

Merging #1767 into master will decrease coverage by 4.17%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1767      +/-   ##
==========================================
- Coverage   92.52%   88.34%   -4.18%     
==========================================
  Files          28       14      -14     
  Lines        1083      815     -268     
  Branches      324      258      -66     
==========================================
- Hits         1002      720     -282     
- Misses         77       82       +5     
- Partials        4       13       +9
Impacted Files Coverage Δ
lib/utils/createConfig.js 93.39% <100%> (+1.57%) ⬆️
lib/utils/status.js 80.76% <0%> (-9.24%) ⬇️
lib/Server.js 86.33% <0%> (-6.18%) ⬇️
lib/utils/updateCompiler.js 100% <0%> (ø) ⬆️
lib/utils/addEntries.js 100% <0%> (ø) ⬆️
lib/utils/runOpen.js
lib/servers/SockJSServer.js
lib/utils/tryParseInt.js
client-src/clients/SockJSClient.js
lib/utils/defaultPort.js
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7fe3fbd...a2487fb. Read the comment docs.

@hiroppy hiroppy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add stdin to errorMessage.

@hiroppy

hiroppy commented Apr 7, 2019

Copy link
Copy Markdown
Contributor

I don't know this option(--stdin) is necessary. /cc @evilebottnawi

@EslamHiko

Copy link
Copy Markdown
Contributor Author

@hiroppy Done

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, we need add tests

@EslamHiko

Copy link
Copy Markdown
Contributor Author

@evilebottnawi I searched a lot & tried a lot to capture any input but I couldn't find a way to test if the CLI can accept input or not.
But I have a Minimum reproducible repo here: https://github.com/EslamHiko/webpack-dev-server/tree/add-stdin-option
Here is a walkthrough to test it :

go to examples/cli/stdin and add that config :

'use strict';

module.exports = {
  context: __dirname,
  entry: './app.js',
  devServer:{
    stdin:true
  }
};

Run npm run webpack-dev-server without --stdin flag
The server will accept input and closes when you exit CTRL+C/CTRL+D the same behavior when you add --stdin flag
if you don't add the option :

'use strict';

module.exports = {
  context: __dirname,
  entry: './app.js',
};

and run npm run webpack-dev-server without --stdin it won't accept input

@EslamHiko

Copy link
Copy Markdown
Contributor Author

Closed for : #2186

@EslamHiko EslamHiko closed this Sep 25, 2019
@EslamHiko EslamHiko deleted the add-stdin-option branch September 25, 2019 11:26
@alexander-akait

Copy link
Copy Markdown
Member

@EslamHiko you send many PRs to webpack-dev-server, i think we can invite your as contributor, do you want to continue help use?

@EslamHiko

Copy link
Copy Markdown
Contributor Author

@evilebottnawi Yes, sure I want to continue helping.

@alexander-akait

Copy link
Copy Markdown
Member

@EslamHiko now you are member 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants