File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ interface BuildOptions {
68
68
* @default "."
69
69
*/
70
70
appPath ?: string ;
71
+
72
+ /**
73
+ * The path to the package.json file. This path is relative from the current process.cwd().
74
+ */
75
+ packageJsonPath ?: string ;
71
76
}
72
77
73
78
const require = topLevelCreateRequire ( import . meta. url ) ;
@@ -117,7 +122,16 @@ function normalizeOptions(opts: BuildOptions, root: string) {
117
122
const appPath = path . join ( process . cwd ( ) , opts . appPath || "." ) ;
118
123
const buildOutputPath = path . join ( process . cwd ( ) , opts . buildOutputPath || "." ) ;
119
124
const outputDir = path . join ( buildOutputPath , ".open-next" ) ;
120
- const nextPackageJsonPath = findNextPackageJsonPath ( appPath , root ) ;
125
+
126
+ let nextPackageJsonPath : string ;
127
+ if ( opts . packageJsonPath ) {
128
+ const _pkgPath = path . join ( process . cwd ( ) , opts . packageJsonPath ) ;
129
+ nextPackageJsonPath = _pkgPath . endsWith ( "package.json" )
130
+ ? _pkgPath
131
+ : path . join ( _pkgPath , "./package.json" ) ;
132
+ } else {
133
+ nextPackageJsonPath = findNextPackageJsonPath ( appPath , root ) ;
134
+ }
121
135
return {
122
136
openNextVersion : getOpenNextVersion ( ) ,
123
137
nextVersion : getNextVersion ( nextPackageJsonPath ) ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ build({
12
12
buildCommand : args [ "--build-command" ] ,
13
13
buildOutputPath : args [ "--build-output-path" ] ,
14
14
appPath : args [ "--app-path" ] ,
15
+ packageJsonPath : args [ "--package-json" ] ,
15
16
minify : Object . keys ( args ) . includes ( "--minify" ) ,
16
17
streaming : Object . keys ( args ) . includes ( "--streaming" ) ,
17
18
dangerous : {
You can’t perform that action at this time.
0 commit comments