depot/third_party/nixpkgs/pkgs/development/compilers/elm/packages/elm-pages-fix-read-only.patch
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

39 lines
1.3 KiB
Diff

diff --git a/generator/src/codegen.js b/generator/src/codegen.js
index baf5368..e5edf4d 100644
--- a/generator/src/codegen.js
+++ b/generator/src/codegen.js
@@ -37,9 +37,9 @@ export async function generate(basePath) {
copyToBoth("SiteConfig.elm"),
fs.promises.writeFile("./.elm-pages/Pages.elm", uiFileContent),
- fs.promises.copyFile(
- path.join(__dirname, `./elm-application.json`),
- `./elm-stuff/elm-pages/elm-application.json`
+ fs.promises.writeFile(
+ `./elm-stuff/elm-pages/elm-application.json`,
+ fs.readFileSync(path.join(__dirname, `./elm-application.json`))
),
// write `Pages.elm` with cli interface
fs.promises.writeFile(
@@ -82,9 +82,9 @@ function writeFetcherModules(basePath, fetcherData) {
}
async function newCopyBoth(modulePath) {
- await fs.promises.copyFile(
- path.join(__dirname, modulePath),
- path.join(`./elm-stuff/elm-pages/client/.elm-pages/`, modulePath)
+ await fs.promises.writeFile(
+ path.join(`./elm-stuff/elm-pages/client/.elm-pages/`, modulePath),
+ fs.readFileSync(path.join(__dirname, modulePath))
);
}
@@ -197,7 +197,7 @@ async function copyFileEnsureDir(from, to) {
await fs.promises.mkdir(path.dirname(to), {
recursive: true,
});
- await fs.promises.copyFile(from, to);
+ await fs.promises.writeFile(to, fs.readFileSync(from));
}
/**