mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-18 02:44:30 +00:00
elm-pages: set files/dirs as +w when copied during elm-init
This commit is contained in:
parent
800399a2ce
commit
d5b901282e
@ -247,6 +247,7 @@ in lib.makeScope pkgs.newScope (self: with self; {
|
||||
# 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}
|
||||
patch $out/lib/node_modules/elm-pages/generator/src/init.js ${./packages/elm-pages-fix-init-read-only.patch}
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
|
@ -0,0 +1,40 @@
|
||||
diff --git a/generator/src/init.js b/generator/src/init.js
|
||||
index 3d8548c..90ee20d 100644
|
||||
--- a/generator/src/init.js
|
||||
+++ b/generator/src/init.js
|
||||
@@ -3,6 +3,21 @@ const copySync = require("fs-extra").copySync;
|
||||
const path = require("path");
|
||||
const kleur = require("kleur");
|
||||
|
||||
+let walknDo = function(somePath, doStuff) {
|
||||
+ doStuff(somePath, true);
|
||||
+ const dir = fs.readdirSync(somePath)
|
||||
+ dir.forEach((i) => {
|
||||
+ let p = path.join(somePath, i);
|
||||
+ const s = fs.statSync(p)
|
||||
+ if (s.isDirectory()) {
|
||||
+ walknDo(p, doStuff)
|
||||
+ } else {
|
||||
+ doStuff(p);
|
||||
+ }
|
||||
+ });
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
@@ -15,6 +30,13 @@ async function run(name) {
|
||||
if (!fs.existsSync(name)) {
|
||||
try {
|
||||
copySync(template, appRoot);
|
||||
+ walknDo(appRoot, (file, isDir) => {
|
||||
+ if (isDir) {
|
||||
+ fs.chmodSync(file, 0o755);
|
||||
+ } else {
|
||||
+ fs.chmodSync(file, 0o644);
|
||||
+ }
|
||||
+ });
|
||||
fs.renameSync(
|
||||
path.resolve(appRoot, "gitignore"),
|
||||
path.resolve(appRoot, ".gitignore")
|
Loading…
Reference in New Issue
Block a user