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

Run extra commands when doing bun run --watch src/index.ts #9216

Open
Blankeos opened this issue Mar 3, 2024 · 1 comment
Open

Run extra commands when doing bun run --watch src/index.ts #9216

Blankeos opened this issue Mar 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Blankeos
Copy link

Blankeos commented Mar 3, 2024

What is the problem this feature would solve?

I want to basically run a codegen script whenever src/index.ts changes. Currently it only runs src/index.ts when src/index.ts's imports change. I think there's no option currently to run custom scripts when src/index.ts changes.

Current scripts in my package.json:

  "scripts": {
    "codegen": "echo 'Running Codegen' && tsc src/routes/_app.ts --declaration --emitDeclarationOnly --outDir ./types --skipLibCheck && dts-bundle --name HonoAPI --out hono.d.ts --main ./types/_app.d.ts",
    "dev": "bun run --watch src/index.ts"
  },

This process is actually pretty straightforward with nodemon. I just need to watch changes in src and then have an exec field for the commands I want to run.

{
  "watch": ["src"],
  "ext": "ts",
  "exec": "bun run src/index.ts && bun run codegen"
}

Since I'm using Bun, I'm kind of staying away from node stuff lol. Is this possible to do without nodemon?

What is the feature you are proposing to solve the problem?

--watch or hot reload.

What alternatives have you considered?

Nodemon

@Blankeos Blankeos added the enhancement New feature or request label Mar 3, 2024
@touhidurrr
Copy link

On windows version 1.1.3, it does not reload even if anything changes. The behavior is so random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants