1
- import { join } from 'path' ;
2
- import { rm , cp , readFile , writeFile } from 'fs/promises' ;
1
+ import { join } from 'path' ;
2
+ import { rm , cp , readFile , writeFile } from 'fs/promises' ;
3
3
import yargs from 'yargs' ;
4
- import { hideBin } from 'yargs/helpers' ;
5
- import { globSync as glob } from 'tinyglobby' ;
6
- import { executeCommand } from '../runner/utils/exec.js' ;
4
+ import { hideBin } from 'yargs/helpers' ;
5
+ import { globSync as glob } from 'tinyglobby' ;
6
+ import { executeCommand } from '../runner/utils/exec.js' ;
7
7
8
8
const root = join ( import . meta. dirname , '..' ) ;
9
9
const runnerSource = join ( root , 'runner' ) ;
@@ -28,7 +28,7 @@ const args = yargs(hideBin(process.argv))
28
28
console . log ( 'Building release output...' ) ;
29
29
30
30
// Clear out the target directory.
31
- await rm ( targetDirectory , { recursive : true , force : true } ) ;
31
+ await rm ( targetDirectory , { recursive : true , force : true } ) ;
32
32
33
33
// Build the runner. This also creates `dist`.
34
34
await executeCommand ( 'pnpm build-runner' , runnerSource , undefined , {
@@ -38,7 +38,7 @@ const args = yargs(hideBin(process.argv))
38
38
// Generate the package.json.
39
39
await writeFile (
40
40
join ( targetDirectory , 'package.json' ) ,
41
- await getPackageJson ( join ( root , 'package.json' ) , args . version )
41
+ await getPackageJson ( join ( root , 'package.json' ) , args . version ) ,
42
42
) ;
43
43
44
44
// Copy the readme and license.
@@ -50,18 +50,10 @@ const args = yargs(hideBin(process.argv))
50
50
glob ( '**/*' , {
51
51
cwd : join ( root , 'examples' ) ,
52
52
dot : true ,
53
- ignore : [
54
- '**/node_modules/**' ,
55
- '**/dist/**' ,
56
- '**/.vinxi/**' ,
57
- '**/.output/**' ,
58
- ] ,
59
- } ) . map ( ( agentFile ) =>
60
- cp (
61
- join ( root , 'examples' , agentFile ) ,
62
- join ( targetDirectory , 'examples' , agentFile )
63
- )
64
- )
53
+ ignore : [ '**/node_modules/**' , '**/dist/**' , '**/.vinxi/**' , '**/.output/**' ] ,
54
+ } ) . map ( agentFile =>
55
+ cp ( join ( root , 'examples' , agentFile ) , join ( targetDirectory , 'examples' , agentFile ) ) ,
56
+ ) ,
65
57
) ;
66
58
67
59
// The user journey testing requires various files to work.
@@ -71,12 +63,12 @@ const args = yargs(hideBin(process.argv))
71
63
cwd : join ( root , browserAgentRelativePath ) ,
72
64
dot : true ,
73
65
ignore : [ '*.ts' , 'README.md' ] ,
74
- } ) . map ( ( agentFile ) =>
66
+ } ) . map ( agentFile =>
75
67
cp (
76
68
join ( root , browserAgentRelativePath , agentFile ) ,
77
- join ( targetDirectory , browserAgentRelativePath , agentFile )
78
- )
79
- )
69
+ join ( targetDirectory , browserAgentRelativePath , agentFile ) ,
70
+ ) ,
71
+ ) ,
80
72
) ;
81
73
82
74
if ( ! args . runnerOnly ) {
@@ -86,28 +78,24 @@ const args = yargs(hideBin(process.argv))
86
78
} ) ;
87
79
88
80
// Copy the report artifacts into the `dist`.
89
- await cp ( reportAppDist , targetDirectory , { recursive : true } ) ;
81
+ await cp ( reportAppDist , targetDirectory , { recursive : true } ) ;
90
82
}
91
83
92
84
console . log ( `Release output has been built in ${ targetDirectory } ` ) ;
93
85
} ) ( ) ;
94
86
95
- async function getPackageJson (
96
- path : string ,
97
- version : string | null
98
- ) : Promise < string > {
87
+ async function getPackageJson ( path : string , version : string | null ) : Promise < string > {
99
88
const content = await readFile ( path , 'utf8' ) ;
100
89
const parsed = JSON . parse ( content ) as {
101
90
version : string ;
102
91
scripts ?: unknown ;
103
92
devDependencies ?: unknown ;
93
+ engines ?: unknown ;
104
94
} ;
105
95
106
96
if ( version ) {
107
97
if ( version === parsed . version ) {
108
- throw new Error (
109
- `Specified version is the same version as the current one.`
110
- ) ;
98
+ throw new Error ( `Specified version is the same version as the current one.` ) ;
111
99
} else {
112
100
parsed . version = version ;
113
101
}
@@ -116,6 +104,7 @@ async function getPackageJson(
116
104
// Delete some fields that aren't relevant for end users.
117
105
delete parsed . scripts ;
118
106
delete parsed . devDependencies ;
107
+ delete parsed . engines ;
119
108
120
109
return JSON . stringify ( parsed , undefined , 2 ) ;
121
110
}
0 commit comments