Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Document npm install fast path

Manav Rathi4ac2be471c59
diff --git a/desktop/README.md b/desktop/README.md
index e7b362c3f8..48611be1e4 100644
--- a/desktop/README.md
+++ b/desktop/README.md
@@ -42,3 +42,7 @@ npm run build
```
That's the gist of it. For more development related documentation, see [docs](docs/README.md).
+
+> [!NOTE]
+>
+> If the relevant `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative. For caveats, see [docs/dev.md](docs/dev.md#npm-ci-npm-install).
diff --git a/desktop/docs/dev.md b/desktop/docs/dev.md
index a34a81cb65..3c7391ce97 100644
--- a/desktop/docs/dev.md
+++ b/desktop/docs/dev.md
@@ -2,9 +2,15 @@
## npm commands
-### npm install
+### npm ci, npm install
-Use `npm ci` when installing dependencies since it uses the lockfile. Use plain `npm install` only when you are intentionally updating dependencies and reviewing the resulting `package-lock.json` changes.
+Use `npm ci` to install dependencies using the committed lockfile. You need this for initial setup, and whenever `package-lock.json` changes (e.g. after pulling the latest upstream).
+
+`npm ci` is the safe default. However, it deletes and recreates `node_modules` each time. For a faster incremental install, you can use `npm install` if you have already run `npm ci` and `package-lock.json` has not changed since then.
+
+> We pin exact versions in `package.json` and commit the lockfile so both `npm install` and `npm ci` should give the same outcome; however, this is not guaranteed, so if `npm install` changes `package-lock.json`, review the diff instead of treating it as incidental churn.
+
+Use `npm install <package>` only when intentionally adding or updating dependencies, and review the resulting `package.json` and `package-lock.json` changes.
The desktop app embeds the Photos web app, so local development also requires installing dependencies in `../web`:
@@ -23,7 +29,7 @@ Launch the app in development mode:
- Runs a development server for the renderer, with hot module reload.
-The renderer scripts check that `../web` dependencies have been installed. If they are missing or stale, run `cd ../web && npm ci`.
+The renderer scripts check that `../web` dependencies have been installed. If they are missing or stale, update them before debugging renderer errors: use `npm install` in `../web` if its `package-lock.json` has not changed since your last `npm ci`, otherwise use `npm ci`.
### npm run build
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index 2cda065263..5a4661e519 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -10,7 +10,7 @@ npm run dev # Start local dev server
npm run build # Build for production
```
-Use plain `npm install` only when intentionally updating dependencies and reviewing the resulting `package-lock.json` changes.
+Use `npm install` only when intentionally adding or updating dependencies, or if `package-lock.json` has not changed since the last `npm ci`.
## Commit messages
diff --git a/infra/staff/README.md b/infra/staff/README.md
index 91004d3b86..1cfba21069 100644
--- a/infra/staff/README.md
+++ b/infra/staff/README.md
@@ -29,6 +29,10 @@ npm run lint # or lint:fix
npm run build
```
+> [!NOTE]
+>
+> If `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative.
+
### Deployment
The app gets redeployed whenever a PR that touches `infra/staff/**` is merged into main. See [web/docs/deploy.md](../../web/docs/deploy.md) for details.
diff --git a/infra/workers/README.md b/infra/workers/README.md
index ad4c57370e..05b061bef9 100644
--- a/infra/workers/README.md
+++ b/infra/workers/README.md
@@ -8,6 +8,10 @@ Workers are organized as npm workspaces sharing a common `package.json` and base
Install dependencies with `npm ci`.
+> [!NOTE]
+>
+> If `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative.
+
Then, to deploy an individual worker
- Login into wrangler (if needed) using `npm exec --workspace health-check -- wrangler login`
diff --git a/rust/apps/ensu/README.md b/rust/apps/ensu/README.md
index c4c1b9b9da..3277ca5baf 100644
--- a/rust/apps/ensu/README.md
+++ b/rust/apps/ensu/README.md
@@ -28,6 +28,10 @@ Desktop app for [Ensu](https://ente.com/ensu/). Built using Tauri.
The dev command starts the Ensu web app on port 3010 and launches Tauri, and changes in the web code will be hot reloaded.
+> [!NOTE]
+>
+> If the relevant `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative for both web and desktop.
+
To create a static build:
```sh
diff --git a/web/CLAUDE.md b/web/CLAUDE.md
index bd23cbe2a2..57a86988bf 100644
--- a/web/CLAUDE.md
+++ b/web/CLAUDE.md
@@ -22,6 +22,9 @@ Format markdown files with Prettier for consistent styling
```sh
# Install dependencies from the committed lockfile
npm ci
+# Fast path when the lock file has not changed since the last npm ci, OR when
+# adding or updating dependencies.
+npm install
# Run development servers
npm run dev # Photos app (port 3000)
@@ -42,8 +45,6 @@ npm run lint # Check formatting, linting, and TypeScript types
npm run lint:fix # Auto-fix linting and formatting issues
```
-Use plain `npm install` only when intentionally updating dependencies and reviewing the resulting `package-lock.json` changes.
-
## Structure
This is a monorepo containing multiple Ente web applications using npm workspaces.
diff --git a/web/README.md b/web/README.md
index 9ee8ce2b95..c1d2237473 100644
--- a/web/README.md
+++ b/web/README.md
@@ -31,7 +31,11 @@ That's it. The web app will automatically hot reload when you make changes.
> [!TIP]
>
-> If you're new to web development and unsure about how to get started, or are facing some problems when running the above steps, see [docs/new](docs/new.md).
+> If you're new to web development and unsure about how to get started, or are facing some problems when running the above steps, see [docs/new.md](docs/new.md).
+
+> [!NOTE]
+>
+> If `package-lock.json` has not changed since your last `npm ci`, you can use `npm install` as a faster incremental alternative. For caveats, see [docs/dev.md](docs/dev.md#npm-ci-npm-install).
## Other apps
diff --git a/web/docs/dev.md b/web/docs/dev.md
index 26b273bcd2..87533b9c8c 100644
--- a/web/docs/dev.md
+++ b/web/docs/dev.md
@@ -13,11 +13,15 @@ Optionally, if you're going to make many changes to the CSS in JS, you might als
Use the npm version from `package.json`.
-### npm ci
+### npm ci, npm install
-Installs dependencies using the committed lockfile. This should be the default for local setup, and whenever there is a change in `package-lock.json` (e.g. when pulling the latest upstream).
+Use `npm ci` to install dependencies using the committed lockfile. You need this for initial setup, and whenever `package-lock.json` changes (e.g. after pulling the latest upstream).
-Use plain `npm install` only when intentionally updating dependencies and reviewing the resulting `package.json` and `package-lock.json` changes.
+`npm ci` is the safe default. However, it deletes and recreates `node_modules` each time. For a faster incremental install, you can use `npm install` if you have already run `npm ci` and `package-lock.json` has not changed since then.
+
+> We pin exact versions in `package.json` and commit the lockfile so both `npm install` and `npm ci` should give the same outcome; however, this is not guaranteed, so if `npm install` changes `package-lock.json`, review the diff instead of treating it as incidental churn.
+
+Use `npm install <package> --workspace <workspace>` only when intentionally adding or updating dependencies, and review the resulting `package.json` and `package-lock.json` changes.
### npm run dev:\*
@@ -49,9 +53,7 @@ There is also a convenience alias, `npm run dev:photos`. See `package.json` for
> Tip: `npm run dev` is a shortcut for `npm run dev:photos`
-Note that npm does not automatically update `node_modules` if you switch to a branch that has added or modified dependencies. So if you encounter unexpected errors on switching branches, make sure that your `node_modules` is up to date by running `npm ci` first.
-
-> Normal development should prefer `npm ci`.
+Note that npm does not automatically update `node_modules` if you switch to a branch that has added or modified dependencies. So if you encounter unexpected errors on switching branches, make sure that your `node_modules` is up to date first: use `npm install` if `package-lock.json` has not changed since your last `npm ci`, otherwise use `npm ci`.
To add a local package as a dependency, use `<package-name>@*`. The "\*" here denotes any version.