DevFlow logoDevFlow
npm / Node.jsBun RuntimeAutomated Breaking Change Check

Migrate npm package.json to Bun Runtime & Scripts

Instantly migrate npm scripts, dependencies, and configurations to Bun. Optimize script execution speeds and strip obsolete transpilations.

From: npm / Node.js
To: Bun Runtime
Source (npm / Node.js)
419 chars
Migrated Target (Bun Runtime)
1ms351 chars
{
  "name": "enterprise-service",
  "version": "1.0.0",
  "scripts": {
    "dev": "NODE_ENV=development bun src/server.ts",
    "build": "tsc",
    "start": "node dist/server.js",
    "test": "bun run build && jest"
  },
  "dependencies": {
    "express": "^4.19.2",
    "dotenv": "^16.4.5"
  },
  "devDependencies": {
    "typescript": "^5.4.5"
  }
}

Detected Breaking Changes & Semantic Shifts (2)

Removed ts-node Dependency
info

Bun executes TypeScript natively without requiring ts-node runtime transpilations.

Resolution: Remove ts-node from package.json and run files directly via `bun file.ts`.
Removed cross-env Dependency
info

Bun parses .env files automatically and supports cross-platform environment variables natively.

Resolution: Place environment variables in .env or run scripts without cross-env.

How to Migrate from npm / Node.js to Bun Runtime

  1. 1

    Paste your package.json containing npm scripts and Node.js dependencies.

  2. 2

    The migrator replaces `npm run` and `ts-node` with Bun native script invocation.

  3. 3

    Obsolete build dependencies (ts-node, cross-env) are automatically flagged for removal.

  4. 4

    Copy the optimized package.json and run `bun install` to generate bun.lock.

Run Tests on Bun in GitHub Actions

.github/workflows/bun-test.yml
name: Bun CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest
      - run: bun install --frozen-lockfile
      - run: bun test

Run Migration via Terminal CLI

Perform identical migration routines across entire directories or repositories in your local terminal:

devflow migrate npm-to-bun -i package.json

Frequently Asked Questions

Will npm packages with native C++ addons work with Bun?
Bun supports Node-API (N-API) natively, meaning the vast majority of native C++ modules compile and run without modification.
What happens to package-lock.json?
Running `bun install` generates Bun’s binary `bun.lock`. You can safely delete `package-lock.json` once you switch.
Was this guide / tool helpful to you?