From f1f9a2ca726b2bd68a51b3d425a3f5fb255b183d Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Sun, 3 Oct 2021 11:54:25 +0530 Subject: [PATCH] fix: cmds in script.mjs not generating valid package.json on linux --- script.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script.mjs b/script.mjs index 6c9e13c..3626645 100644 --- a/script.mjs +++ b/script.mjs @@ -2,5 +2,10 @@ import { $ } from 'zx'; -await $`echo { \"type\": \"commonjs\" } > dist/cjs/package.json`; -await $`echo { \"type\": \"module\" } > dist/esm/package.json`; +if (process.platform === 'win32') { + await $`echo { "type": "commonjs" } > dist/cjs/package.json`; + await $`echo { "type": "module" } > dist/esm/package.json`; +} else if (process.platform === 'linux') { + await $`echo { \\"type\\": \\"commonjs\\" } > dist/cjs/package.json`; + await $`echo { \\"type\\": \\"module\\" } > dist/esm/package.json`; +}