From c9892dbd1d201504ba2fdca988ee14729675c780 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 8 Oct 2018 14:23:10 -0400 Subject: [PATCH] adjust package.json rewriting --- npm2git.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/npm2git.sh b/npm2git.sh index e08b524..54b9f87 100755 --- a/npm2git.sh +++ b/npm2git.sh @@ -7,12 +7,9 @@ ORIG_COMMIT="$(git rev-parse HEAD)" # extract version from package.json, and remove scripts.prepare cp package.json package.json_orig PKG_VERSION="$(node -e ' - const fs = require("fs"); - const pkg = JSON.parse(fs.readFileSync("package.json")); - if (pkg.scripts && pkg.scripts.prepare) { - delete pkg.scripts.prepare; - fs.writeFileSync("package.json", JSON.stringify(pkg, null, "\t") + "\n"); - } + const pkg = require("./package.json"); + pkg.scripts && delete pkg.scripts.prepare; + require("fs").writeFileSync("package.json", JSON.stringify(pkg)); console.log(pkg.version); ')"