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

Use well-defined npm script names instead of custom

Open aentwist opened this issue 1 year ago • 5 comments

Description

npm provides both npm start and npm test. Use these instead of npm run dev and npm run test:unit.

Considerations

Maybe there are different layers of tests. So then keep test:unit + others, and add "test": "run-p test:unit ..."

aentwist avatar Jun 23 '23 18:06 aentwist

@aentwist Thanks for the suggestion

Maybe we could add npm start as an alias for npm run dev and npm test as an alias for npm run test:unit. This is what Angular CLI does for example.

Would you like to try and open a PR?

cexbrayat avatar Nov 10 '23 07:11 cexbrayat

Hi @cexbrayat,

If this issue is still available, I think I could open a PR.

However, I'm not sure if I understand correctly that you suggest we should keep the dev script, too? Wouldn't it be weird if a newly generated package.json contained two scripts for the same command?

When I saw this issue, I thought about the following steps:

  • rename the dev script to start,
  • keep the current test:unit and test:e2e scripts if they are generated,
  • generate a new test script that either executes
    • test:unit if only unit tests are generated (vitest, cypress-ct or nightwatch-ct)
    • test:e2e if only E2E tests are generated (cypress, nightwatch or playwright)
    • both test:unit and test:e2e if unit AND E2E tests are generated

What do you think?

szgabsz91 avatar Nov 18 '23 17:11 szgabsz91

I was thinking that it would be better to keep the existing ones to avoid all the tooling/docs/blog posts/books to reference commands that no longer exist.

So I would:

  • add start along dev
  • keep the current test:unit and test:e2e scripts if they are generated
  • add test as an alias of test:unit, except if only e2e tests are generated, and in that case, as an alias of test:e2e

cexbrayat avatar Nov 20 '23 11:11 cexbrayat

OK, it's clear now. :) Then I'll take a look into it and open a PR soon, adding you as the reviewer if that's OK.

szgabsz91 avatar Nov 20 '23 20:11 szgabsz91