question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating lock file for individual package

See original GitHub issue

We have a lerna monorepo which contains our packages and projects that use those packages.

We can deploy just using the package.json file in our project and that works fine (on Netlify), however we’d like to deploy the projects in a way where we know what the packages and dependencies will be when we deploy them - ie. with a lock file.

If we use the root lock file then we’re missing the dependencies from the project. If we use the package file in the project then we don’t get the benefit of the locked down packages.

If we generate a lock file (package-lock.json) for the project by using lerna exec -- npm install --package-lock then we get the locked files and can deploy fine, however we’ve had weird issues with dependencies happening that stop it working properly, plus releasing new packages means we need to re run lerna exec -- npm install --package-lock after a bump so the package lock is up to date!

Does anyone have any ideas, workflow suggestions or general tips to help out

Project structure is

packages/internal-package-1
packages/internal-package-2
packages/internal-package-3...
projects/app-1
projects/app-2
lerna.json
package.json
yarn.lock

We build the apps as part of the Netlify deployment. They are Create React Apps. Currently we’re running it with the package.json option with no lock file and that works, just with the downside of no locked packages.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ux-engineercommented, Jun 6, 2019

@evocateur it seems Lerna 3.14.1 is not creating workspace-specific yarn.lock file, which is especially bad for production build systems / pipelines…

2reactions
ux-engineercommented, Jun 6, 2019

It seems Yarn workspaces indeed is missing that feature: https://github.com/yarnpkg/yarn/issues/5428

Read more comments on GitHub >

github_iconTop Results From Across the Web

package-lock.json - npm Docs
package -lock.json is automatically generated for any operations where npm ... Describe a single representation of a dependency tree such that teammates, ...
Read more >
Lerna not generating package-lock.json for every package
Below are 2 ways to generate package-lock.json file for all packages:- ... Use "lerna exec -- npm i" ------ This will generate the...
Read more >
What is package lock json? Lockfiles for yarn & npm ... - Snyk
A package lock file is first introduced into a project when a fresh dependencies install is performed in that project. At the time...
Read more >
The Complete Guide to package-lock.json - Medium
package -lock.json file is essentially used to lock dependencies to a specific version number. This file is automatically generated (or re-generated) when there ......
Read more >
Lock File | Developer Experience Knowledge Base
Why should your source repository always contain a lock file? Package managers would miss important imformation about installed packages without a lock file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found