about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/elm/packages/elm-pages-fix-read-only.patch
blob: 547f89f86f69ceb80d73b8fab7bf388d5097f637 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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));
 }
 
 /**