From 4e747b3697dae787095ea9c4ead99d33b13f2c61 Mon Sep 17 00:00:00 2001 From: Parker Mauney Date: Sun, 22 Jan 2023 18:57:57 -0500 Subject: [PATCH] Use process.platform to detect OS during postinstall --- Gruntfile.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 78c26532..de9b8144 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -390,13 +390,14 @@ module.exports = function (grunt) { stdout: false, }, fixCryptoApiImports: { - command: [ - `[[ "$OSTYPE" == "darwin"* ]]`, - "&&", - `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'`, - "||", - `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'` - ].join(" "), + command: function () { + switch (process.platform) { + case "darwin": + return `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'`; + default: + return `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'`; + } + }, stdout: false } },