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

"Root has devDependencies" #114

Open
theKashey opened this issue Sep 17, 2021 · 5 comments
Open

"Root has devDependencies" #114

theKashey opened this issue Sep 17, 2021 · 5 comments

Comments

@theKashey
Copy link

I would like to raise a concern about this rule mostly due to the problem with npm audit and the general expectation of some underlaying tools that only dependencies should be scanned for vulnerabilities.

Still creates a huge room for some uncertainly of decision which dep should do where, but I would like to have this rule configurable.

@Offirmo
Copy link

Offirmo commented May 1, 2022

I agree with this. The "Root has devDependencies" is too opiniated.

@Offirmo
Copy link

Offirmo commented May 1, 2022

Also the main reason "The root package.json of a monorepo is not published" is incorrect. There are many uses in having root dependencies or not, in prod or dev. Examples:

  • I deploy a portion of my monorepo through Netlify, which insists on installing prod dependencies even when not needed
  • I have build scripts which requires a few core modules to be installed.

Hence my need for "devDependencies" and not "dependencies".

@steve-taylor
Copy link
Contributor

steve-taylor commented Jul 9, 2022

I second this, but would prefer to see this as an option, defaulting to the current behaviour. This would then necessitate another rule for those of us who use Bolt: Ensure that any dependency in a sub-package that's in dependencies is in the root package.json's dependencies, and the same for devDependencies. This would be mutually exclusive with the "Root has devDependencies" rule and perhaps only active for monorepo package managers that require all dependencies be declared in the root. (Bolt is the only one that I know about.) Having said that, I'm aware that @mitchellhamilton recommends Yarn workspaces over Bolt.

My use case: I'm Dockerizing a Next.js app in the monorepo and I want to exclude devDependencies for a smaller Docker image. I have to Dockerize from the root because of symlinks.

@TheDunco
Copy link

I have a similar use case to @Offirmo and @steve-taylor. I want to install certain deps when installing on my machine but need a way to ignore them when installing in a Docker container. The only method of doing so I'm aware of is to pass -P to my pnpm install command in my Docker image's configuration while having the deps I don't want in devDependencies.

I agree this rule is too opinionated and there needs to be a way to ignore it.

I'm using pnpm workspaces.

@TheDunco
Copy link

Although, I just found out that I was able to add this property to my root package.json to ignore this rule. Doing so added --allow-devDependencies to my manypkg check command. Perhaps the methods to ignore this rule just need to be better documented as it wasn't obvious from the README that you can do this.

  "manypkg": {
    "ignoredRules": [
      "ROOT_HAS_DEV_DEPENDENCIES",
    ]
  },

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

4 participants