설치

npm i -D pkg

package.json 설정

{
  "main": "dist/app.js",
  "bin": "dist/app.js",
  "scripts": {
    "build-exe": "rimraf dist && rimraf bin && tsc && pkg . --targets node18-win-x64 --output bin/my-file.exe"
  },
}

예시

{
  "name": "next-gen-js-converter",
  "version": "0.0.1",
  "description": "Next Generation Javascript Converter",
  "main": "dist/app.js",
  "bin": "dist/app.js",
  "scripts": {
    "run": "ts-node src/app.ts",
    "run-dev": "ts-node src/app-dev.ts",
    "run-dev-temp": "ts-node src/app-dev.ts temp",
    "run-dev-all": "ts-node src/app-dev.ts ALL",
    "-------------------------------------------------": "",
    "test-dist": "node dist/app.js _examples/example_temp.js _examples/test_output.tsx",
    "test-exe": "bin\\\\transpiler.exe _examples/example_temp.js _examples/test_output.tsx",
    "--------------------------------------------------": "",
    "build": "tsc",
    "build-exe": "rimraf dist && rimraf bin && tsc && pkg . --targets node18-win-x64 --output bin/transpiler.exe"
  },
  "scripts-no-use": {
    "check": "tsc --noEmit"
  },
  "keywords": [],
  "dependencies": {
    "acorn": "^8.15.0"
  },
  "devDependencies": {
    "@types/node": "^14.14.37",
    "pkg": "^5.8.1",
    "rimraf": "^6.0.1",
    "ts-node": "^9.1.1",
    "typescript": "^5.3.3"
  }
}