File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
packages/@apphosting/adapter-nextjs Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ describe("next.config override", () => {
5757 const standaloneConfigFiles = standaloneFiles . filter ( ( file ) => file . match ( configRegex ) ) ;
5858 assert . strictEqual ( standaloneConfigFiles . length , 2 ) ;
5959 assert . ok (
60- configFiles . some ( ( file ) => file . match ( configOriginalRegex ) ) ,
60+ standaloneConfigFiles . some ( ( file ) => file . match ( configOriginalRegex ) ) ,
6161 "no original config found in standalone" ,
6262 ) ;
6363 } ) ;
Original file line number Diff line number Diff line change @@ -147,27 +147,22 @@ export async function validateNextConfigOverride(
147147 * to leave user code the way we found it.
148148 */
149149export async function restoreNextConfig ( projectRoot : string , nextConfigFileName : string ) {
150- // Check if the file exists in the current working directory
151- const configPath = join ( projectRoot , nextConfigFileName ) ;
152- if ( ! ( await exists ( configPath ) ) ) {
153- return ;
154- }
155-
156150 // Determine the file extension
157151 const fileExtension = extname ( nextConfigFileName ) ;
158152 const originalConfigPath = join ( projectRoot , `next.config.original${ fileExtension } ` ) ;
153+
159154 if ( ! ( await exists ( originalConfigPath ) ) ) {
160- console . warn ( `next config may have been overwritten but original contents not found` ) ;
155+ // No backup file found, nothing to restore.
161156 return ;
162157 }
163158 console . log ( `Restoring original next config in project root` ) ;
164159
160+ const configPath = join ( projectRoot , nextConfigFileName ) ;
165161 try {
166162 await renamePromise ( originalConfigPath , configPath ) ;
167163 } catch ( error ) {
168164 console . error ( `Error restoring Next config: ${ error } ` ) ;
169165 }
170- return ;
171166}
172167
173168/**
You can’t perform that action at this time.
0 commit comments