# Upgrade npm Dependencies in a SolidJS App

Yes. Each week an agent upgrades your SolidJS app's packages, rebuilds with Rollup, opens the built app in a browser to check it still renders, and opens one PR.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-npm-dependencies/solidjs/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the manifest and the build it has to keep working. In an app like solidjs/solid-realworld, `package.json` has two runtime dependencies, `solid-js` ^1.3.3 and `marked` ^0.8.0, and eleven devDependencies for the Rollup build: `rollup` pinned exactly at 2.52.3, `@babel/core` at 7.12.13 with `@babel/plugin-proposal-optional-chaining` and `@babel/plugin-syntax-dynamic-import` at the same vintage, `babel-preset-solid` ^1.3.2, `@rollup/plugin-babel` 5.2.0, `@rollup/plugin-commonjs` 21.0.0, `@rollup/plugin-node-resolve` 13.0.5, `rollup-plugin-delete`, `rollup-plugin-terser` and `serve`. `package-lock.json` is lockfile version 2. There is no test: the `test` script is the literal word `test`, so the only checks the project has are `npm run build` and whether the app works.

`rollup.config.js` shows what an upgrade can break: it bundles `src/index.js` to `public/` as ES modules with `preserveEntrySignatures: false`, compiles JSX with the `solid` Babel preset, enables `terser` only when `--environment production` is set, and deletes everything in `public/` except `index.html` before each build. `public/index.html` loads `./index.js` as a module and pulls its CSS and fonts from CDNs. Twenty-six source files under `src/` make up the RealWorld client, with `src/store/createAgent.js` calling `https://api.realworld.io/api` and `src/pages/Article/Article.js` rendering article bodies with `marked(body, { sanitize: true })`, an option later versions of marked removed. `.github/workflows/gh-pages.yml` builds on Node 14 with `npm install` on every pull request and deploys `public/` to GitHub Pages from `main`.

The agent runs `npm outdated` and works in two passes. First every package moves within its current major, the build runs, and the app is served from `public/` with `serve` and opened in the sandbox browser: the home page must list the global feed from the RealWorld API and an article page must render its markdown body. Then it takes the majors one at a time, rebuilding and reloading after each: `solid-js` with `babel-preset-solid` moved together, since the preset must match the runtime; the Rollup major together with the plugin majors that require it, swapping `rollup-plugin-terser` for `@rollup/plugin-terser` because the old plugin does not load on newer Rollup; the Babel optional-chaining plugin dropped if the targets the preset compiles for no longer need it. `marked` is the exception: past the version that removed `sanitize`, article HTML would go to the page unsanitized, so the agent either holds it at the last release that honours the option or moves up and adds DOMPurify around the output, and says which in the pull request.

An upgrade whose build fails after the fix the changelog suggests, or whose built app no longer renders the feed or an article, is reverted and listed with the error. The lockfile is regenerated for what remains. Because newer Rollup majors require a Node release later than the 14 the workflow uses, the agent bumps `node-version` in `gh-pages.yml` to match and switches its `npm install` to `npm ci` so the deploy builds from the lockfile it just produced. The pull request description carries the before and after version of each package, the browser checks it made with a screenshot of the home page and an article, and the list of what was left out and why.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade the npm dependencies of this SolidJS app. Read package.json, package-lock.json, rollup.config.js, public/index.html, src/index.js, src/store/createAgent.js, src/pages/Article/Article.js and .github/workflows/gh-pages.yml first, and note that there is no test script. Run npm outdated. First upgrade every package within its current major, run npm run build, serve public/ and open the app in the browser to confirm the home page lists articles from the API and an article page renders its body. Then take majors one at a time, rebuilding and reloading after each: move solid-js and babel-preset-solid together, move rollup with the plugin majors it requires and replace rollup-plugin-terser with @rollup/plugin-terser, and drop Babel plugins the preset no longer needs. Treat marked specially: do not move past the release that removed the sanitize option unless you add DOMPurify around the rendered article HTML, and say which you did. Revert any upgrade whose build or browser check fails and list it with the error. Regenerate the lockfile, raise the Node version in the Pages workflow to what the new Rollup needs and use npm ci there, and open one pull request with the version table, screenshots of the two pages and the list of upgrades left out.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is one pull request on its own branch with `package.json`, `package-lock.json`, `rollup.config.js` where a plugin was swapped or dropped, `.github/workflows/gh-pages.yml` with the new Node version and `npm ci`, and, if marked was moved up, `src/pages/Article/Article.js` with DOMPurify around the rendered body. No other source file changes unless a Solid upgrade required it, and any such change is named.

The description has a table of every package with its old and new version and whether it was a minor or a major move, the two screenshots from the sandbox browser, and a section for upgrades not taken, each with the build error or the rendering failure that stopped it. Every `npm`, `rollup` and browser command the agent ran is in the session transcript at `GET /o/{org}/sessions/{id}/messages`, and the Pages workflow runs the build on the pull request itself.

Before merging, a reviewer reads the marked decision, checks the Node version against what the team deploys with, and opens the deploy preview or runs `npm start` locally once to click through login and the editor, which the agent's browser check does not cover because they need an account. A follow-up message to the same session can take the next major that was left out once its blocker is understood.

## Run it on every Monday morning

A scheduled workflow sends `POST /o/{org}/sessions` with this request and your repository in `resources`, with the org key as the bearer token and a `request_id` that is a UUID v5 of the repository and the week, so a re-run returns the run already started instead of a second pull request.

Set a webhook URL on the key. When the turn finishes your endpoint receives `run.completed` with `session_url`, reads the pull request link from the session and posts it where the front-end work is reviewed, so the Monday review starts with a tested upgrade rather than a dozen bot pull requests.

## Why run it on Rush?

An app with no tests can only be checked by building it and looking at it, and a Rollup major that pulls four plugin majors along with it needs that check after every step. The agent has its own sandbox with Node, the repository and a browser, so it can rebuild and reload as many times as the sequence needs without touching a developer's machine, and it reads the rendered page rather than trusting a green build.

Every build output and every page it opened is kept in the session record, with the screenshots, so the pull request's claim that the app still renders is something a reviewer can see rather than take on faith. Several front-end repositories can run the same request at once, each in its own sandbox, each producing one pull request.

## Frequently asked questions

### How can it upgrade safely with no test suite?

By doing what a developer would do, in order: build, serve, open the app, read the page. The home page must show the global feed and an article page must render its markdown body after every step, and a step that breaks either is reverted and reported. It is a weaker check than a test suite, and the pull request says so and suggests a smoke test as a follow-up.

### Why is marked treated differently from the other packages?

Because `Article.js` relies on `marked(body, { sanitize: true })` to strip HTML from article bodies that come from the public API, and later marked releases removed that option without failing. Upgrading past it would ship an XSS quietly. The agent either stays on the last release that honours the option or adds DOMPurify and moves up, and the pull request states which.

### Will the deploy still work?

The agent changes `gh-pages.yml` only as far as the upgrades require: the Node version newer Rollup needs and `npm ci` so the deploy uses the committed lockfile. The workflow runs the build on the pull request, so a failing deploy build shows up as a failing check before merge.

### What if the RealWorld API is down during the run?

The agent loads the original build first, so it knows whether the feed renders before any upgrade. If the API fails on both, it reports that the network check was inconclusive and leans on the build alone for that run rather than reverting upgrades for a failure they did not cause.

## More SolidJS jobs

- [Write Component Tests for a SolidJS App](https://getrush.ai/run/write-component-tests/solidjs/)
- [Write Playwright Tests for a SolidJS App](https://getrush.ai/run/write-playwright-tests/solidjs/)
- [Add a Bundle Size Check to a SolidJS App](https://getrush.ai/run/add-bundle-size-check/solidjs/)

## The same job on other stacks

- [Upgrade npm Dependencies in a Temporal TypeScript Project](https://getrush.ai/run/upgrade-npm-dependencies/temporal/)
- [Upgrade npm Dependencies in a Turborepo Monorepo](https://getrush.ai/run/upgrade-npm-dependencies/turborepo/)
- [Upgrade npm Dependencies in a Vite React App](https://getrush.ai/run/upgrade-npm-dependencies/vite-react/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
