-
Notifications
You must be signed in to change notification settings - Fork 506
feat: generate start and test npm scripts #387
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
feat: generate start and test npm scripts #387
Conversation
c6fd31d to
6ae5c5d
Compare
@cexbrayat
cexbrayat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @szgabsz91
I think you can do simpler than this, by just adding the script directly to the template/base/package.json for start. You can probably do the same for test with the template/**/package.json of each library, and that would avoid adding the addNpmScript function.
You can then generate the snapshots locally with pnpm snapshot and check if the result is OK.
szgabsz91
commented
Nov 25, 2023
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
addNpmScriptfunction, but without it, I could only use the same value for thedevandtestscripts 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 generatednpm run devfor instance, oryarn devin 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
testscript 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.
@cexbrayat
cexbrayat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I like this way better 👍
7c9431d to
8db43ce
Compare
cexbrayat
commented
Nov 27, 2023
@szgabsz91 Can you rebase the PR on the latest main branch, please? I'll then take a look.
8db43ce to
0982194
Compare
szgabsz91
commented
Nov 28, 2023
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.
@cexbrayat
cexbrayat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @szgabsz91
I'll let @sodatea take a look and merge if he feels this is interesting
szgabsz91
commented
Nov 28, 2023
Thanks!
0982194 to
bf64fed
Compare
szgabsz91
commented
Jun 2, 2024
FYI: I just rebased the branch, now it's up-to-date again. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you may be able to dynamically obtain the corresponding script commands generated by the package manager.
Lines 569 to 576 in 9a4dd95
Resolves #303