Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
szgabsz91 wants to merge1 commit intovuejs:main
base:main
Choose a base branch
Loading
fromszgabsz91:feature/303-generate-start-and-test-npm-scripts

Conversation

szgabsz91
Copy link

Resolves#303

@szgabsz91szgabsz91force-pushed thefeature/303-generate-start-and-test-npm-scripts branch fromc6fd31d to6ae5c5dCompareNovember 25, 2023 11:40
Copy link
Member

@cexbrayatcexbrayat left a 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 thetemplate/base/package.json forstart. You can probably do the same fortest with thetemplate/**/package.json of each library, and that would avoid adding theaddNpmScript function.

You can then generate the snapshots locally withpnpm snapshot and check if the result is OK.

marcosdissotti reacted with thumbs up emoji
@szgabsz91
Copy link
Author

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 theaddNpmScript function, but without it, I could only use the same value for thedev andtest 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 generatednpm run dev for instance, oryarn 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 thetest 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 (likenpm 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.

marcosdissotti reacted with thumbs up emoji

Copy link
Member

@cexbrayatcexbrayat left a 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 👍

@szgabsz91szgabsz91force-pushed thefeature/303-generate-start-and-test-npm-scripts branch from7c9431d to8db43ceCompareNovember 26, 2023 09:00
@cexbrayat
Copy link
Member

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

@szgabsz91szgabsz91force-pushed thefeature/303-generate-start-and-test-npm-scripts branch from8db43ce to0982194CompareNovember 27, 2023 20:17
@szgabsz91
Copy link
Author

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.

Copy link
Member

@cexbrayatcexbrayat left a 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 reacted with thumbs up emoji
@szgabsz91
Copy link
Author

Thanks!

@szgabsz91szgabsz91force-pushed thefeature/303-generate-start-and-test-npm-scripts branch from0982194 tobf64fedCompareJune 2, 2024 08:22
@szgabsz91
Copy link
Author

FYI: I just rebased the branch, now it's up-to-date again. :)

@@ -3,6 +3,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"start": "npm run dev",
Copy link
Collaborator

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.

create-vue/index.ts

Lines 569 to 576 in9a4dd95

constuserAgent=process.env.npm_config_user_agent??''
constpackageManager=/pnpm/.test(userAgent)
?'pnpm'
:/yarn/.test(userAgent)
?'yarn'
:/bun/.test(userAgent)
?'bun'
:'npm'

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

@bteabteabtea left review comments

@cexbrayatcexbrayatcexbrayat approved these changes

@marcosdissottimarcosdissottimarcosdissotti approved these changes

@haoqunjianghaoqunjiangAwaiting requested review from haoqunjiang

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Use well-defined npm script names instead of custom
4 participants
@szgabsz91@cexbrayat@marcosdissotti@btea

[8]ページ先頭

©2009-2025 Movatter.jp