Merge pull request #174985 from NoRedInk/add-elm-pages

elmPackages.elm-pages: init at 2.1.11
This commit is contained in:
Marek Fajkus 2022-05-30 16:48:18 +02:00 committed by GitHub
commit 35fc22e248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1168 additions and 406 deletions

View File

@ -14678,4 +14678,10 @@
github = "snpschaaf";
githubId = 105843013;
};
jali-clarke = {
email = "jinnah.ali-clarke@outlook.com";
name = "Jinnah Ali-Clarke";
github = "jali-clarke";
githubId = 17733984;
};
}

View File

@ -212,6 +212,32 @@ in lib.makeScope pkgs.newScope (self: with self; {
};
};
elm-pages = nodePkgs."elm-pages".overrideAttrs (
old: {
buildInputs = old.buildInputs ++ [ pkgs.makeWrapper ];
# can't use `patches = [ <patch_file> ]` with a nodePkgs derivation;
# need to patch in one of the build phases instead.
# see upstream issue https://github.com/dillonkearns/elm-pages/issues/305 for dealing with the read-only problem
preFixup = ''
patch $out/lib/node_modules/elm-pages/generator/src/codegen.js ${./packages/elm-pages-fix-read-only.patch}
'';
postFixup = ''
wrapProgram $out/bin/elm-pages --prefix PATH : ${
with pkgs.elmPackages; lib.makeBinPath [ elm elm-review elm-optimize-level-2 ]
}
'';
meta = with lib; nodePkgs."elm-pages".meta // {
description = "A statically typed site generator for Elm.";
homepage = "https://github.com/dillonkearns/elm-pages";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack maintainers.jali-clarke ];
};
}
);
inherit (nodePkgs) elm-doc-preview elm-live elm-upgrade elm-xref elm-analyse elm-git-install;
})
)

View File

@ -0,0 +1,59 @@
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

View File

@ -1,4 +1,4 @@
# This file has been generated by node2nix 1.9.0. Do not edit!
# This file has been generated by node2nix 1.11.1. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;

View File

@ -10,6 +10,7 @@
"elm-xref",
"create-elm-app",
"elm-optimize-level-2",
"elm-pages",
"elm-review",
"elm-git-install"
]

File diff suppressed because it is too large Load Diff