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

Commit7c9431d

Browse files
committed
feat: add the dev and test scripts to the template files (#303)
1 parent6ae5c5d commit7c9431d

File tree

9 files changed

+22
-63
lines changed

9 files changed

+22
-63
lines changed

‎index.ts

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import getCommand from './utils/getCommand'
1818
importgetLanguagefrom'./utils/getLanguage'
1919
importrenderEslintfrom'./utils/renderEslint'
2020
import{FILES_TO_FILTER}from'./utils/filterList'
21-
importaddNpmScriptfrom'./utils/addNpmScript'
2221

2322
functionisValidPackageName(projectName){
2423
return/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName)
@@ -349,24 +348,24 @@ async function init() {
349348
if(needsPinia){
350349
render('config/pinia')
351350
}
352-
if(needsVitest){
353-
render('config/vitest')
354-
}
355351
if(needsCypress){
356352
render('config/cypress')
357353
}
358-
if(needsCypressCT){
359-
render('config/cypress-ct')
360-
}
361354
if(needsNightwatch){
362355
render('config/nightwatch')
363356
}
364-
if(needsNightwatchCT){
365-
render('config/nightwatch-ct')
366-
}
367357
if(needsPlaywright){
368358
render('config/playwright')
369359
}
360+
if(needsVitest){
361+
render('config/vitest')
362+
}
363+
if(needsCypressCT){
364+
render('config/cypress-ct')
365+
}
366+
if(needsNightwatchCT){
367+
render('config/nightwatch-ct')
368+
}
370369
if(needsTypeScript){
371370
render('config/typescript')
372371

@@ -492,20 +491,6 @@ async function init() {
492491
constuserAgent=process.env.npm_config_user_agent??''
493492
constpackageManager=/pnpm/.test(userAgent) ?'pnpm' :/yarn/.test(userAgent) ?'yarn' :'npm'
494493

495-
// Extend the package.json with the test script
496-
constpackageJsonPath=path.resolve(root,'package.json')
497-
addNpmScript('start',packageManager,'dev',packageJsonPath)
498-
if(
499-
(needsCypress||needsNightwatch||needsPlaywright)&&
500-
!needsVitest&&
501-
!needsCypressCT&&
502-
!needsNightwatchCT
503-
){
504-
addNpmScript('test',packageManager,'test:e2e',packageJsonPath)
505-
}elseif(needsVitest||needsCypressCT||needsNightwatchCT){
506-
addNpmScript('test',packageManager,'test:unit',packageJsonPath)
507-
}
508-
509494
// README generation
510495
fs.writeFileSync(
511496
path.resolve(root,'README.md'),

‎template/base/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"private":true,
33
"scripts": {
44
"dev":"vite",
5+
"start":"vite",
56
"build":"vite build",
67
"preview":"vite preview"
78
},

‎template/config/cypress-ct/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"scripts": {
33
"test:unit":"cypress run --component",
4-
"test:unit:dev":"cypress open --component"
4+
"test:unit:dev":"cypress open --component",
5+
"test":"cypress run --component"
56
},
67
"dependencies": {
78
"vue":"^3.3.8"

‎template/config/cypress/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"scripts": {
33
"test:e2e":"start-server-and-test preview http://localhost:4173 'cypress run --e2e'",
4-
"test:e2e:dev":"start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'"
4+
"test:e2e:dev":"start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'",
5+
"test":"start-server-and-test preview http://localhost:4173 'cypress run --e2e'"
56
},
67
"devDependencies": {
78
"cypress":"^13.5.1",

‎template/config/nightwatch-ct/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"scripts": {
3-
"test:unit":"nightwatch src/components/**/__tests__/*"
3+
"test:unit":"nightwatch src/components/**/__tests__/*",
4+
"test":"nightwatch src/components/**/__tests__/*"
45
},
56
"dependencies": {
67
"vue":"^3.3.8"

‎template/config/nightwatch/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"scripts": {
3-
"test:e2e":"nightwatch tests/e2e"
3+
"test:e2e":"nightwatch tests/e2e",
4+
"test":"nightwatch tests/e2e"
45
},
56
"devDependencies": {
67
"nightwatch":"^3.3.2",

‎template/config/playwright/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"scripts": {
3-
"test:e2e":"playwright test"
3+
"test:e2e":"playwright test",
4+
"test":"playwright test"
45
},
56
"devDependencies": {
67
"@playwright/test":"^1.40.0"

‎template/config/vitest/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"scripts": {
3-
"test:unit":"vitest"
3+
"test:unit":"vitest",
4+
"test":"vitest"
45
},
56
"dependencies": {
67
"vue":"^3.3.8"

‎utils/addNpmScript.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp