Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --copy option to the serve command #1355

Merged
merged 5 commits into from
May 29, 2018
Merged

Conversation

morrislaptop
Copy link
Contributor

This feature will copy the local url to the clipboard.

I use this feature of https://poi.js.org/ quite a lot.

It's not as aggressive as --open but just as convenient :)

@morrislaptop
Copy link
Contributor Author

Thoughts?

docs/config.md Outdated
@@ -66,6 +66,7 @@ module.exports = {
// configure webpack-dev-server behavior
devServer: {
open: process.platform === 'darwin',
copy: false,
Copy link
Member

Choose a reason for hiding this comment

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

devServer is used to configure webpack-dev-server, I don't think adding a non webpack-dev-server option here is a good idea.

@@ -10,12 +10,15 @@ const defaults = {
https: false
}

const clipboardy = require('clipboardy')
Copy link
Member

Choose a reason for hiding this comment

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

This should be lazy-required only when copy is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -149,10 +152,16 @@ module.exports = (api, options) => {
return
}

let copied = ''
if (isFirstCompile && (args.copy || projectDevServerOptions.copy)) {
Copy link
Member

Choose a reason for hiding this comment

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

As @jkzing suggested I think we should keep it a command line flag only. --open is supported in devServer because webpack-dev-server also supports it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@morrislaptop
Copy link
Contributor Author

@yyx990803 done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants