Skip to content

chore: start a local server for testing when run dev #17868#17882

Merged
Ovilia merged 6 commits into
masterfrom
fix-readme
Nov 8, 2022
Merged

chore: start a local server for testing when run dev #17868#17882
Ovilia merged 6 commits into
masterfrom
fix-readme

Conversation

@Ovilia
Copy link
Copy Markdown
Contributor

@Ovilia Ovilia commented Nov 7, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Start a local server when run npm run dev and update the README. Hopefully, this can better help new contributors to get started.

Fixed issues

#17868

Details

Before: What was the problem?

After: How does it behave after the fixing?

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Nov 7, 2022

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

The pull request is marked to be PR: author is committer because you are a committer of this project.

Copy link
Copy Markdown
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

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

There are two problems with this command,

  1. The former command may block the latter command.
  2. It's not enough to only serve the test folder as the test case requires some external resources, such as dist and node_modules.

So I would like to suggest using the following command,

npx concurrently -n echarts,server \"npm run dev:fast\" \"npx http-server -c-1 -s -o test\"

That is, serve the project root folder and open the test folder automatically.

-c-1 is to disable the cache.
-s is to make the server silent and no access logs. It's optional. Do you think it's good to add that?

@Ovilia
Copy link
Copy Markdown
Contributor Author

Ovilia commented Nov 7, 2022

The former command may block the latter command.

It doesn't seem to be blocked to me. Can you give a more detailed explanation? In my environment, Bundled with esbuild is printed after the command and it prints again on file changes in src.

npx concurrently gives extra prompt for developers to confirm so I think if it works without concurrently, it would be better:

Need to install the following packages:
  concurrently@7.5.0
Ok to proceed? (y)

And there are other problems with your suggestion:

[0] /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
[0] /bin/sh: -c: line 1: syntax error: unexpected end of file
[1] /bin/sh: run: command not found
[0] "npm exited with code 2
[2] /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
[2] /bin/sh: -c: line 1: syntax error: unexpected end of file
[1] run exited with code 127
[2] dev:fast" exited with code 2
[3] /bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
[3] /bin/sh: -c: line 1: syntax error: unexpected end of file
[3] "npx exited with code 2

I'm using Bash on Mac terminal.

@Ovilia
Copy link
Copy Markdown
Contributor Author

Ovilia commented Nov 8, 2022

It seems Windows and Mac shell have some differences. @plainheart 's suggestions works well in scripts in package.json so I used this command. Thanks!

@plainheart
Copy link
Copy Markdown
Member

npx concurrently gives extra prompt for developers to confirm so I think if it works without concurrently, it would be better:

Thanks for accepting the suggestion! Maybe we can pass -y to npx to avoid the installation tip.

@plainheart plainheart linked an issue Nov 8, 2022 that may be closed by this pull request
Copy link
Copy Markdown
Member

@plainheart plainheart left a comment

Choose a reason for hiding this comment

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

LGTM

@Ovilia Ovilia merged commit 0f149dc into master Nov 8, 2022
@Ovilia Ovilia deleted the fix-readme branch November 8, 2022 04:06
@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Nov 8, 2022

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@AntiMoron
Copy link
Copy Markdown

AntiMoron commented Nov 8, 2022

Thanks @Ovilia

That's why echarts' better than other Chinese open source softwares.
This team codes more than debating.

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.

[Feature] Found it hard to get started with README.md

3 participants