@@ -24,12 +24,17 @@ export async function runBuildCommand(app: AppCommand) {
24
24
const isPreviewBuild = app . args . includes ( 'preview' ) ;
25
25
const buildLibScript = getScript ( 'build.lib' ) ;
26
26
const isLibraryBuild = ! ! buildLibScript ;
27
- const buildClientScript = getScript ( 'build.client' ) ;
28
- const buildPreviewScript = isPreviewBuild ? getScript ( 'build.preview' ) : undefined ;
29
- const buildServerScript = ! isPreviewBuild ? getScript ( 'build.server' ) : undefined ;
30
- const buildStaticScript = getScript ( 'build.static' ) ;
27
+ const buildClientCommand = app . getArg ( "client-script" ) || "build.client"
28
+ const buildTypesCommand = app . getArg ( "types-script" ) || "build.types"
29
+ const buildPreviewCommand = app . getArg ( "preview-script" ) || "build.preview"
30
+ const buildServerCommand = app . getArg ( "server-script" ) || "build.server"
31
+ const buildStaticCommand = app . getArg ( "static-script" ) || "build.static"
32
+ const buildClientScript = getScript ( buildClientCommand ) ;
33
+ const buildPreviewScript = isPreviewBuild ? getScript ( buildPreviewCommand ) : undefined ;
34
+ const buildServerScript = ! isPreviewBuild ? getScript ( buildServerCommand ) : undefined ;
35
+ const buildStaticScript = getScript ( buildStaticCommand ) ;
31
36
const runSsgScript = getScript ( 'ssg' ) ;
32
- const buildTypes = getScript ( 'build.types' ) ;
37
+ const buildTypes = getScript ( buildTypesCommand ) ;
33
38
const lint = getScript ( 'lint' ) ;
34
39
const mode = app . getArg ( 'mode' ) ;
35
40
@@ -55,12 +60,12 @@ export async function runBuildCommand(app: AppCommand) {
55
60
56
61
if ( ! isLibraryBuild && ! buildClientScript ) {
57
62
console . log ( pkgJsonScripts ) ;
58
- throw new Error ( `"build.client " script not found in package.json` ) ;
63
+ throw new Error ( `"${ buildClientCommand } " script not found in package.json` ) ;
59
64
}
60
65
61
66
if ( isPreviewBuild && ! buildPreviewScript && ! buildStaticScript ) {
62
67
throw new Error (
63
- `Neither "build.preview " or "build.static " script found in package.json for preview`
68
+ `Neither "${ buildPreviewCommand } " or "${ buildStaticCommand } " script found in package.json for preview`
64
69
) ;
65
70
}
66
71
0 commit comments