docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Delete package-lock.json

Open trusktr opened this issue 6 years ago • 8 comments

I think libraries should not include package-lock.json.

  • The npm command does not publish them to npmjs.com, so end users don't get benefit from them.
  • We shouldn't attempt to lock dependencies using shrinkwrap anyways (increases the chance of duplicate dependencies in end user projects, which can cause issues, I can provide some links if curious).
  • The main reason to remove package-lock.json is because as we authors develop Docsify, we can catch in-range breaking changes to any dependencies and fix them before users receive the errors. Having package-lock.json otherwise prevents us from catching those bugs sooner.
  • We can manually pin dependencies as a last resort in package.json if we really need to.

Wdyt? Any reason to keep it?

trusktr avatar Jun 13 '20 04:06 trusktr

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/44415l3p5 ✅ Preview: https://docsify-preview-git-delete-package-lock.docsify-core.vercel.app

vercel[bot] avatar Jun 13 '20 04:06 vercel[bot]

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9842b804ae21bf83fbc85503a35ab310559f2f6f:

Sandbox Source
wonderful-khayyam-opwkm Configuration

codesandbox-ci[bot] avatar Jun 13 '20 04:06 codesandbox-ci[bot]

If we are removing this, I guess we should remove the lockfile for packages/docsify-server-renderer as well and put them in .gitignore

Good catch! Thanks for reminding me! Good to have multiple :eyes: . :)

trusktr avatar Jun 13 '20 20:06 trusktr

There we go. I added the config in .npmrc which tells npm not to generate package-lock.json files, but some tools (like Lerna) don't obey this option so in any other cases beside using npm the .gitignore addition will help.

trusktr avatar Jun 13 '20 20:06 trusktr

Let me fix the ironic conflict with package-lock.json. :)

trusktr avatar Jun 13 '20 20:06 trusktr

I think there is some problem with CI related to monorepo (lerna). Does lerna requires the lock file in order to have the same env ?

anikethsaha avatar Jun 14 '20 06:06 anikethsaha

Ah, the tests fail because Lerna is running in ci mode (uses npm ci in the case of npm) which requires package-lock.json. ci mode is good for applications but not necessarily libraries (for the same above reasons).

I'll make an update.

trusktr avatar Jun 15 '20 07:06 trusktr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 16 '20 07:08 stale[bot]