create-vue icon indicating copy to clipboard operation
create-vue copied to clipboard

feat: generate start and test npm scripts

Open szgabsz91 opened this issue 1 year ago • 5 comments

Resolves #303

szgabsz91 avatar Nov 25 '23 11:11 szgabsz91

Thanks for the quick review, @cexbrayat, I added a new commit with the modifications, keeping the old commit just for reference. (If the PR gets accepted in the future, a squash might be necessary.)

Just some comments:

  • I eliminated the addNpmScript function, but without it, I could only use the same value for the dev and test scripts as their referenced scripts, because I do not know in the template which package manager the developer uses. With the previous solution, if you used npm, it generated npm run dev for instance, or yarn dev in case of yarn, etc.
  • I also needed to modify the order of rendered templates. Now the E2E test related templates are rendered first so that they do not overwrite the test script if unit tests are also generated.
  • I tried to test the modified CLI locally and I think the generated scripts work correctly as you suggested in the issue, but maybe using real references (like npm run dev, npm run test:unit) would be more elegant. However, I don't have an idea how to do so without using a custom function or implementing some kind of template parameters like using mustache or a similar lib in the render function.

I don't know if the current solution is OK with you, but if not, I'll try to modify it later as you suggest.

szgabsz91 avatar Nov 25 '23 15:11 szgabsz91

@szgabsz91 Can you rebase the PR on the latest main branch, please? I'll then take a look.

cexbrayat avatar Nov 27 '23 19:11 cexbrayat

I did the rebase yesterday, if I see it correctly, the branch is up to date with the remote main. I also resolved the conflicts around the nightwatch package.json files.

szgabsz91 avatar Nov 28 '23 08:11 szgabsz91

Thanks!

szgabsz91 avatar Nov 28 '23 10:11 szgabsz91