Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: use require.resolve to find globby and ts-node
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 30, 2018
1 parent da83b32 commit 0a75d62
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
- v1-yarn-{{checksum ".circleci/config.yml"}}
- run: .circleci/greenkeeper
- run: yarn add -D nyc@11 @oclif/nyc-config@0
- run: cd test/fixtures/typescript && yarn
- run: |
$NYC yarn test
$NYC report --reporter text-lcov > coverage.lcov
Expand Down
3 changes: 2 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export class Plugin implements IPlugin {
if (!this.commandsDir) return []
let globby: typeof Globby
try {
globby = require(`${this.root}/node_modules/globby`)
const globbyPath = require.resolve('globby', {paths: [this.root, __dirname]})
globby = require(globbyPath)
} catch (err) {
this.warn(err, 'not loading commands, globby not found')
return []
Expand Down
3 changes: 2 additions & 1 deletion src/ts_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function registerTSNode(root: string) {
const tsconfig = loadTSConfig(root)
if (!tsconfig) return
debug('registering ts-node at', root)
const tsNode: typeof TSNode = require(`${root}/node_modules/ts-node`)
const tsNodePath = require.resolve('ts-node', {paths: [root, __dirname]})
const tsNode: typeof TSNode = require(tsNodePath)
tsconfigs[root] = tsconfig
typeRoots.push(`${root}/node_modules/@types`)
if (tsconfig.compilerOptions.rootDirs) {
Expand Down

0 comments on commit 0a75d62

Please sign in to comment.