Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#validateDependencies doesn't work well with monorepo environment #42

Open
bmstefanski opened this issue Aug 20, 2021 · 0 comments
Open

Comments

@bmstefanski
Copy link

Hi guys, great library, it definitely saved me some time! 👍🏻

I encountered one issue while implementing it to the large mono-repo app: the validateDependencies method does not respect dependencies inheritance. So, if our application has the following structure:

<root>
packages/
  someService/package.json
  someOtherService/package.json
package.json

and both someService and someOtherService inherit the dependencies from the root's package.json. It will exit with process.exit(-1) and display [preact] Missing/incorrect dependencies.. That is because neither of these packages has preact, next-plugin-preact, or any required library in the package.json - it is inherited from the root.

What's troubling me is the result of process.cwd(). It points to packages/someService/, but we run the start command from the root level, so it might be a bad lerna configuration 🤔 .

Anyhow, I managed to fix this by replacing join(process.cwd(), 'package.json') with join(__dirname, '..', '..', 'package.json');

const pkg = require(join(process.cwd(), 'package.json'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant