nixpkgs/pkgs/development/compilers/elm/packages/elm-pages-fix-read-only.patch
Jinnah Ali-Clarke d29cd82bfb elmPackages.elm-pages: init at 2.1.11
`node-packages.nix` was regenerated after having run `generate-node-packages.sh`
in order to pick up dependencies for `elm-pages`.  In addition, we add `elm`,
`elm-review`, and `elm-optimize-level-2` to the `PATH` for `elm-pages` since those
are needed at runtime.

A patch is also included to fix an issue where files are copied from the `nix-store`
as read-only (credit to @bcardiff for that fix).  An upstream issue
https://github.com/dillonkearns/elm-pages/issues/305 has been opened to track this.
2022-05-30 09:56:44 -04:00

59 lines
2.3 KiB
Diff

diff --git a/generator/src/codegen.js b/generator/src/codegen.js
index a0ef8806e..fe00ac904 100644
--- a/generator/src/codegen.js
+++ b/generator/src/codegen.js
@@ -20,33 +20,33 @@ async function generate(basePath) {
const uiFileContent = elmPagesUiFile();
await Promise.all([
- fs.promises.copyFile(
- path.join(__dirname, `./Page.elm`),
- `./.elm-pages/Page.elm`
+ fs.promises.writeFile(
+ `./.elm-pages/Page.elm`,
+ fs.readFileSync(path.join(__dirname, `./Page.elm`))
),
- 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`))
),
- fs.promises.copyFile(
- path.join(__dirname, `./Page.elm`),
- `./elm-stuff/elm-pages/.elm-pages/Page.elm`
+ fs.promises.writeFile(
+ `./elm-stuff/elm-pages/.elm-pages/Page.elm`,
+ fs.readFileSync(path.join(__dirname, `./Page.elm`))
),
- fs.promises.copyFile(
- path.join(__dirname, `./SharedTemplate.elm`),
- `./.elm-pages/SharedTemplate.elm`
+ fs.promises.writeFile(
+ `./.elm-pages/SharedTemplate.elm`,
+ fs.readFileSync(path.join(__dirname, `./SharedTemplate.elm`))
),
- fs.promises.copyFile(
- path.join(__dirname, `./SharedTemplate.elm`),
- `./elm-stuff/elm-pages/.elm-pages/SharedTemplate.elm`
+ fs.promises.writeFile(
+ `./elm-stuff/elm-pages/.elm-pages/SharedTemplate.elm`,
+ fs.readFileSync(path.join(__dirname, `./SharedTemplate.elm`))
),
- fs.promises.copyFile(
- path.join(__dirname, `./SiteConfig.elm`),
- `./.elm-pages/SiteConfig.elm`
+ fs.promises.writeFile(
+ `./.elm-pages/SiteConfig.elm`,
+ fs.readFileSync(path.join(__dirname, `./SiteConfig.elm`))
),
- fs.promises.copyFile(
- path.join(__dirname, `./SiteConfig.elm`),
- `./elm-stuff/elm-pages/.elm-pages/SiteConfig.elm`
+ fs.promises.writeFile(
+ `./elm-stuff/elm-pages/.elm-pages/SiteConfig.elm`,
+ fs.readFileSync(path.join(__dirname, `./SiteConfig.elm`))
),
fs.promises.writeFile("./.elm-pages/Pages.elm", uiFileContent),
// write `Pages.elm` with cli interface