stackblitz / starters

StackBlitz Starter Project
MIT License
37 stars 16 forks source link

chore: remove package-lock.json in templates #14

Closed fvsch closed 1 year ago

fvsch commented 1 year ago

This PR removes package-lock.json files in starter templates.

For context, package-lock.json files are treated in two different ways by StackBlitz:

  1. In EngineBlock projects, which use the Turbo package manager, they are ignored.
  2. In WebContainer projects, which use the npm package manager by default, they are used to speed up installation of dependencies, provided that the package-lock.json is not stale.

When importing WebContainer projects, the StackBlitz GitHub project importer will automatically generate a package-lock.json if there is none (and there is a package.json), to get the aforementioned install speed boost.

Based on this:

To keep things simple in this repo, and to follow the lead of projects like the Vite example templates, I propose removing the package-lock.json files for templates.

Pros of having package-lock.json

  1. template can be imported by our GH importer a bit faster, since the importer doesn't have to call to a resolver service to generate a package-lock.json.
  2. provides a bit of stability (imported projects are cached for a day, so every day we get a new package-lock.json with potentially updated dependencies that could break if there are breaking changes/bugs in a semver minor).

Cons of having package-lock.json

  1. We don't want a package-lock.json in EngineBlock projects, so we'd have to check that we don't end up adding those.
  2. They can grow stale if we someone updates the package.json but not the package-lock.json, and we don't have any CI checking that.
  3. If the project has a stale package-lock.json, then installing dependencies becomes slower on StackBlitz that if we didn't have one (and were generating a new one on import).
sulco commented 1 year ago

Good one. If we wanted to bring them back, we could probably maneuver around the 1st con, but would definitely have to resolve the two others.