diff --git a/package-lock.json b/package-lock.json index 40ccfb8..ff75f06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,13 @@ "version": "0.0.3", "license": "ISC", "dependencies": { + "@commander-js/extra-typings": "^11.0.0", "commander": "^11.0.0" }, "bin": { - "hotenv": "dist/index.js" + "hotenv": "dist/index.mjs" }, "devDependencies": { - "@commander-js/extra-typings": "^11.0.0", "@vitest/coverage-v8": "^0.34.2", "prettier": "^3.0.2", "tsup": "^7.2.0", @@ -49,7 +49,6 @@ "version": "11.0.0", "resolved": "https://registry.npmjs.org/@commander-js/extra-typings/-/extra-typings-11.0.0.tgz", "integrity": "sha512-06ol6Kn5gPjFY6v0vWOZ84nQwyqhZdaeZCHYH3vhwewjpOEjniF1KHZxh18887G3poWiJ8qyq5pb6ANuiddfPQ==", - "dev": true, "peerDependencies": { "commander": "11.0.x" } diff --git a/package.json b/package.json index 22fdba2..b89332c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "clean": "rm -rf dist && rm -rf coverage && rm -rf node_modules" }, "main": "dist/index.js", - "module": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/*" @@ -28,9 +27,11 @@ }, "exports": { ".": { - "import": "./dist/index.js", - "require": "./dist/index.cjs", - "types": "./dist/index.d.ts" + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/index.d.ts", + "node": "./dist/index.js", + "default": "./dist/index.js" } }, "repository": { @@ -64,14 +65,15 @@ "minifyIdentifiers": true, "minifySyntax": true, "minifyWhitespace": true, - "skipNodeModulesBundle": true, - "treeshake": true, + "skipNodeModulesBundle": false, + "treeshake": false, "clean": true, "dts": true, "sourcemap": true, "globalName": "hotenv", "noExternal": [ - "commander" + "commander", + "@commander-js/extra-typings" ], "platform": "node", "target": "node18", @@ -89,7 +91,6 @@ ] }, "devDependencies": { - "@commander-js/extra-typings": "^11.0.0", "@vitest/coverage-v8": "^0.34.2", "prettier": "^3.0.2", "tsup": "^7.2.0", @@ -97,6 +98,7 @@ "vitest": "^0.34.2" }, "dependencies": { + "@commander-js/extra-typings": "^11.0.0", "commander": "^11.0.0" } } diff --git a/src/index.ts b/src/index.ts index 5dff41f..9e09888 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ import { readdirSync } from "fs"; import { basename, resolve, join } from "path"; -import { spawnSync } from "child_process"; +import { spawn } from "child_process"; import { program, createArgument } from "@commander-js/extra-typings"; import { watermark } from "./watermark"; import { @@ -141,7 +141,7 @@ const config = commands.config process.exit(1); } - const child = spawnSync(cmd, args, { + const child = spawn(cmd, args, { env: Object.assign({}, process.env, { TAMAGUI_TARGET: platform, NODE_ENV: env, @@ -149,11 +149,14 @@ const config = commands.config SHOW_FULL_BUNDLE_ERRORS: verbose ? "1" : "0", DISABLE_EXTRACTION: env === "production" ? "0" : "1" }), + shell: true, stdio: "inherit", cwd: process.cwd() }); - process.exit(child.status ?? 1); + child.on("close", code => { + process.exit(code ?? 1); + }); }); export const cli = hotenv.addCommand(generate).addCommand(config);