-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure
required-server-files
test can exit cleanly
- Loading branch information
1 parent
0fee50e
commit 96d5c9a
Showing
6 changed files
with
73 additions
and
110 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
test/production/standalone-mode/required-server-files/patch-server-file.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from 'fs-extra' | ||
|
||
export interface PatchServerFileOptions { | ||
readonly minimalMode: boolean | ||
} | ||
|
||
export async function patchServerFile( | ||
serverFilename: string, | ||
options: PatchServerFileOptions | ||
): Promise<void> { | ||
const { minimalMode } = options | ||
const content = await fs.readFile(serverFilename, 'utf8') | ||
|
||
await fs.writeFile( | ||
serverFilename, | ||
content.replace( | ||
/(startServer\({\s*)(minimalMode: (true|false),\n {2})?/, | ||
`$1minimalMode: ${minimalMode},\n ` | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters