Skip to content

Commit

Permalink
feat: support identifying other root types
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayChipps committed Feb 20, 2024
1 parent 6dff17d commit 2011cc1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ function traverseFilePathUntil(filename: string, predicate: (filename: string) =
}

// Update to path.dirname(url.fileURLToPath(import.meta.url)) whenever we update tsconfig target to ES2020
// eslint-disable-next-line unicorn/prefer-module
loadConfig.root = traverseFilePathUntil(require.main?.path ?? module.path, (p) => !p.includes('node_modules'))
/* eslint-disable unicorn/prefer-module */
loadConfig.root = traverseFilePathUntil(
require.main?.path ?? module.path,
(p) => !(p.includes('node_modules') || p.includes('.pnpm') || p.includes('.yarn')),
)
/* eslint-enable unicorn/prefer-module */

export const test = fancy
.register('loadConfig', loadConfig)
Expand Down

0 comments on commit 2011cc1

Please sign in to comment.