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

Commit1992b15

Browse files
committed
chore: use zx for all npm scripts
1 parentf3ed134 commit1992b15

File tree

5 files changed

+33
-70
lines changed

5 files changed

+33
-70
lines changed

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"prepare":"husky install",
1818
"format":"prettier --write .",
1919
"build":"esbuild --bundle index.js --format=cjs --platform=node --outfile=outfile.cjs",
20-
"snapshot":"nodesnapshot.js",
20+
"snapshot":"zx ./scripts/snapshot.mjs",
2121
"pretest":"run-s build snapshot",
22-
"test":"nodetest.js",
22+
"test":"zx ./scripts/test.mjs",
2323
"prepublishOnly":"zx ./scripts/prepublish.mjs"
2424
},
2525
"repository": {

‎scripts/prepublish.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ await $`pnpm snapshot`
66

77
let{ version}=JSON.parse(awaitfs.readFile('./package.json'))
88

9-
cd('./playground')
9+
constplaygroundDir=path.resolve(__dirname,'../playground/')
10+
cd(playgroundDir)
1011

1112
await$`git add -A .`
1213
try{

‎snapshot.jsrenamed to‎scripts/snapshot.mjs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
import{spawnSync}from'child_process'
2-
importpathfrom'path'
1+
#!/usr/bin/env zx
2+
import'zx/globals'
33

4-
const__dirname=path
5-
.dirname(newURL(import.meta.url).pathname)
6-
.substring(process.platform==='win32' ?1 :0)
4+
$.verbose=false
75

8-
constbin=path.resolve(__dirname,'./outfile.cjs')
9-
constplaygroundDir=path.resolve(__dirname,'./playground/')
10-
11-
functioncreateProjectWithFeatureFlags(flags){
12-
constprojectName=flags.join('-')
13-
console.log(`Creating project${projectName}`)
14-
const{ status}=spawnSync(
15-
'node',
16-
[bin,projectName, ...flags.map((flag)=>`--${flag}`),'--force'],
17-
{
18-
cwd:playgroundDir,
19-
stdio:['pipe','pipe','inherit']
20-
}
21-
)
22-
23-
if(status!==0){
24-
process.exit(status)
25-
}
26-
}
6+
constbin=path.resolve(__dirname,'../outfile.cjs')
7+
constplaygroundDir=path.resolve(__dirname,'../playground/')
278

289
constfeatureFlags=['typescript','jsx','router','pinia','with-tests']
2910

@@ -59,6 +40,10 @@ function fullCombination(arr) {
5940
constflagCombinations=fullCombination(featureFlags)
6041
flagCombinations.push(['default'])
6142

43+
cd(playgroundDir)
6244
for(constflagsofflagCombinations){
63-
createProjectWithFeatureFlags(flags)
45+
constprojectName=flags.join('-')
46+
console.log(`Creating project${projectName}`)
47+
48+
await$`node${[bin,projectName, ...flags.map((flag)=>`--${flag}`),'--force']}`
6449
}

‎scripts/test.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env zx
2+
import'zx/globals'
3+
4+
constplaygroundDir=path.resolve(__dirname,'../playground/')
5+
6+
for(constprojectNameoffs.readdirSync(playgroundDir)){
7+
if(projectName.endsWith('with-tests')){
8+
cd(path.resolve(playgroundDir,projectName))
9+
10+
console.log(`Running unit tests in${projectName}`)
11+
await$`pnpm test:unit:ci`
12+
13+
console.log(`Building${projectName}`)
14+
await$`pnpm build`
15+
16+
console.log(`Running e2e tests in${projectName}`)
17+
await$`pnpm test:e2e:ci`
18+
}
19+
}

‎test.js

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp