Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support bun and tsx for development #966

Merged
merged 9 commits into from Feb 27, 2024
Merged

feat: support bun and tsx for development #966

merged 9 commits into from Feb 27, 2024

Conversation

mdonnalley
Copy link
Contributor

@mdonnalley mdonnalley commented Feb 21, 2024

@W-15093833@

QA

  • create new CLI with oclif generate my-cli (select CommonJS when prompted)
  • clone this branch and yarn build
  • yarn link @oclif/core into generated CLI
  • rm -rf dist inside of generated CLI
  • Try the following hashbangs in bin/dev.js (you must have tsx and bun installed globally) and run bin/dev.js hello world for each
#!/usr/bin/env tsx
#!/usr/bin/env bun
#!/usr/bin/env node_modules/.bin/ts-node
#!/usr/bin/env node --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings
  • Revert to original bin/dev.js and try the following
bun bin/dev.js hello world
tsx bin/dev.js hello world
  • REPEAT WITH ESM CLI

@mdonnalley mdonnalley mentioned this pull request Feb 21, 2024
@shetzel
Copy link
Contributor

shetzel commented Feb 27, 2024

QA
commonjs:
✅ #!/usr/bin/env tsx --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
✅ #!/usr/bin/env bun --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
✅ #!/usr/bin/env node_modules/.bin/ts-node --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
✅ #!/usr/bin/env node --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
bun bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
tsx bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)

ESM:
✅ #!/usr/bin/env tsx --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
✅ #!/usr/bin/env bun --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
✅ #!/usr/bin/env node_modules/.bin/ts-node --> output of bin/dev.js hello world = warning and error about not being able to autocompile with ts-node, node v20, and ESM.
✅ #!/usr/bin/env node --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings --> output of bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
bun bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)
tsx bin/dev.js hello world = hello world! (./src/commands/hello/world.ts)

@shetzel shetzel merged commit 53aaaf9 into main Feb 27, 2024
69 checks passed
@shetzel shetzel deleted the mdonnalley/bun-tsx branch February 27, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't run development mode with bun
2 participants