Fixed sed command in postinstall script to be platform dependent

This commit is contained in:
n1474335 2021-01-22 14:47:33 +00:00
parent e53108c493
commit 345ad741b3
2 changed files with 7 additions and 1 deletions

View File

@ -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
postinstall.sh Executable file
View File

@ -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