create-vue
create-vue copied to clipboard
Use well-defined npm script names instead of custom
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 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?
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 tostart
, - keep the current
test:unit
andtest: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
andtest:e2e
if unit AND E2E tests are generated
-
What do you think?
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
alongdev
- keep the current
test:unit
andtest:e2e
scripts if they are generated - add
test
as an alias oftest:unit
, except if only e2e tests are generated, and in that case, as an alias oftest:e2e
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.