Skip to content

Cannot get dependencies using different context than process.cwd() #22

@jayu

Description

@jayu

Thank you for this lib!

I've noticed a bug around context option. Searching for dependencies using custom context does not work as expected.

Perhaps it's because you use const currentDirectory = process.cwd(); instead of const currentDirectory = options.context in

const currentDirectory = process.cwd();

To workaround this I had to do the following, but I would rather not :D

// dpdm does not support custom search directory :/
const oldProcessCwd = process.cwd
process.cwd = () => cwd

deps = cleanupDpdmDeps(
  await parseDependencyTree(entryPoints, {
    context: cwd // does not work as expected
  })
)

process.cwd = oldProcessCwd

https://github.com/jayu/rev-dep/blob/master/src/lib/getDepsTree.ts#L15-L25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions