Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: path to cid-tool commands (#1866)
Browse files Browse the repository at this point in the history
In the edge case where IPFS is a dependency of a project and the user attempts to use the IPFS CLI, the cid-tool will not be installed at `proj/node_modules/ipfs/node_modules/cid-tool` but will instead be flattened by npm and installed at `proj/node_modules/cid-tool`. i.e. next to `ipfs` in the dependency tree instead of a child of.

This PR fixes this situation by using `require.resolve` to get the path to the `cid-tool` instead of assuming where it is installed.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
Alan Shaw authored Feb 7, 2019
1 parent 7533d76 commit 506f5be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/commands/cid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require('path')

const cidCommandsPath = path.join(
__dirname, '..', '..', '..', 'node_modules', 'cid-tool', 'src', 'cli', 'commands'
path.dirname(require.resolve('cid-tool')), 'cli', 'commands'
)

module.exports = {
Expand Down

0 comments on commit 506f5be

Please sign in to comment.