Browse Source

Fixed sed command in postinstall script to be platform dependent

n1474335 4 năm trước cách đây
mục cha
commit
345ad741b3
2 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 1 1
      package.json
  2. 6 0
      postinstall.sh

+ 1 - 1
package.json

@@ -172,7 +172,7 @@
     "testui": "grunt testui",
     "testuidev": "npx nightwatch --env=dev",
     "lint": "grunt lint",
-    "postinstall": "find ./node_modules/crypto-api/src/ \\( -type d -name .git -prune \\) -o -type f -print0 | xargs -0 sed -i '' -e '/\\.mjs/!s/\\(from \"\\.[^\"]*\\)\";/\\1.mjs\";/g'",
+    "postinstall": "sh postinstall.sh",
     "newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs"
   }
 }

+ 6 - 0
postinstall.sh

@@ -0,0 +1,6 @@
+# Add file extensions to Crypto-Api imports
+if [[ "$OSTYPE" == "darwin"* ]]; then
+  find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i '' -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g'
+else
+  find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g'
+fi