From 458aaf6d109a7f18f52db3be620b7ff6917c2942 Mon Sep 17 00:00:00 2001 From: Claas Ahlrichs Date: Tue, 15 Jan 2019 12:47:10 +0100 Subject: [PATCH] write JSON (not object) to package.json --- build/index.js | 5 ++++- build/index.js.map | 2 +- src/index.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/index.js b/build/index.js index bca9327..3b728d5 100644 --- a/build/index.js +++ b/build/index.js @@ -179,7 +179,10 @@ init_package_json_1.default(dir, initFile, configData, function(_er, _data) { "pre-commit": "pretty-quick --staged" } }; - fs_1.default.writeFileSync(packageFile, __assign({ husky: husky }, _data)); + fs_1.default.writeFileSync( + packageFile, + JSON.stringify(__assign({ husky: husky }, _data), null, 2) + ); (function() { return __awaiter(_this, void 0, void 0, function() { return __generator(this, function(_a) { diff --git a/build/index.js.map b/build/index.js.map index 2f3d81b..566bea3 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAA0B;AAC1B,wEAAqC;AACrC,8CAAwB;AACxB,0CAAoB;AAEpB,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC;AACrC,+DAA+D;AAC/D,2CAA2C;AAC3C,IAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAEjD,kCAAkC;AAClC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1B,gEAAgE;AAChE,mEAAmE;AACnE,YAAY;AACZ,IAAM,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAE/C,uEAAuE;AACvE,oEAAoE;AACpE,YAAY;AACZ,6CAA6C;AAC7C,0CAA0C;AAC1C,4CA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AAE,CAAC;AAE1B,gEAAgE;AAChE,mEAAmE;AACnE,YAAY;AACZ,IAAM,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAE/C,uEAAuE;AACvE,oEAAoE;AACpE,YAAY;AACZ,6CAA6C;AAC7C,0CAA0C;AAC1C,4CAA4C;AAE5C,2BAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAS,GAAG,EAAE,KAAK;IAAnB,iBAsB/B;IArBC,wDAAwD;IACxD,+BAA+B;IAC/B,IAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACtD,IAAM,KAAK,GAAG;QACZ,KAAK,EAAE;YACL,YAAY,EAAE,uBAAuB;SACtC;KACF,CAAC;IACF,YAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,YAAG,KAAK,OAAA,IAAK,KAAK,GAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE5E,CAAC;;;wBACC,qBAAM,eAAK,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,EAAA;;oBAA1E,SAA0E,CAAC;oBAC3E,qBAAM,eAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAA;;oBAA9B,SAA8B,CAAC;oBAC/B,qBAAM,eAAK,CAAC,KAAK,EAAE;4BACjB,SAAS;4BACT,UAAU;4BACV,cAAc;4BACd,OAAO;4BACP,YAAY;yBACb,CAAC,EAAA;;oBANF,SAME,CAAC;;;;SACJ,CAAC,EAAE,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 91583ed..7d45dfc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,7 @@ init(dir, initFile, configData, function(_er, _data) { "pre-commit": "pretty-quick --staged" } }; - fs.writeFileSync(packageFile, { husky, ..._data }); + fs.writeFileSync(packageFile, JSON.stringify({ husky, ..._data }, null, 2)); (async () => { await execa("npm", ["install", "typescript", "@types/node", "--save-dev"]);