Skip to content

Commit

Permalink
feat: switch to polling if in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zAlweNy26 committed Oct 13, 2024
1 parent 6d812e1 commit a52d30f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import '@total-typescript/ts-reset'

declare module 'nodemon' {
interface NodemonSettings {
legacyWatch?: boolean
}
}

declare global {
type TODO = any
type Nullable<T> = T | null | undefined
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { semver } from 'bun'
import isDocker from 'is-docker'
import nodemon from 'nodemon'
import { log } from './logger.ts'
import { parsedEnv } from './utils.ts'

const inDocker = isDocker()
const { watch, verbose } = parsedEnv

if (!semver.satisfies(Bun.version, '>=1.1.19')) {
Expand All @@ -15,6 +17,7 @@ nodemon({
watch: ['src/**', '.env'],
exec: 'bun',
script: 'src/main.ts',
legacyWatch: inDocker,
ignoreRoot: watch ? ['**/settings.json', 'src/plugins/**', 'src/assets/**'] : ['**/**'],
env: {
NODE_ENV: watch ? 'development' : 'production',
Expand Down

0 comments on commit a52d30f

Please sign in to comment.