Skip to content

Commit

Permalink
fix: use cjs for cli (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
helmturner authored Aug 20, 2023
1 parent fc4fb09 commit 3f647f6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"
Expand All @@ -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": {
Expand Down Expand Up @@ -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",
Expand All @@ -89,14 +91,14 @@
]
},
"devDependencies": {
"@commander-js/extra-typings": "^11.0.0",
"@vitest/coverage-v8": "^0.34.2",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"typescript": "^5.1.6",
"vitest": "^0.34.2"
},
"dependencies": {
"@commander-js/extra-typings": "^11.0.0",
"commander": "^11.0.0"
}
}
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -141,19 +141,22 @@ 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,
DISABLE_WARN_DYNAMIC_LOAD: verbose ? "0" : "1",
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);
Expand Down

0 comments on commit 3f647f6

Please sign in to comment.