<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3" -->

---
title: Ten years later, setimmutable finally hit 1.0.0 | daily.dev
description: A maintainer revisited a small JavaScript library, setimmutable, ten years after its first commit, and shipped it as 1.0.0 with no functional changes to its...
canonical: https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Ten years later, setimmutable finally hit 1.0.0 | daily.dev
og:description: A maintainer revisited a small JavaScript library, setimmutable, ten years after its first commit, and shipped it as 1.0.0 with no functional changes to its...
og:url: https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3
og:image: https://api.daily.dev/og/posts/Hn3aIrQe3.png
og:image:alt: Ten years later, setimmutable finally hit 1.0.0
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Ten years later, setimmutable finally hit 1.0.0

**[Jonathan Delgado](https://daily.dev/sources/ccmfsskv5iewk1pmun3oj)** · [@jonathandelgado](https://daily.dev/jonathandelgado) · 6 min read · 0 upvotes · 0 comments

## Summary

A maintainer revisited a small JavaScript library, setimmutable, ten years after its first commit, and shipped it as 1.0.0 with no functional changes to its API. The work focused on infrastructure: automating npm publishing via npm Trusted Publishing (OIDC) with GitHub Actions instead of stored tokens, building a custom multi-engine integration test action that validates the package across Node versions, Bun, and TypeScript type-checking, and migrating the source to TypeScript with path-aware type inference up to 31 levels deep. The build toolchain moved from gulp 3 and babel 6 to a direct bun build command, which fixed a longstanding break on modern Node versions.

## Content

On January 29, 2017, I made the first commit to `setimmutable`, a small library for doing `lodash.set` without mutating anything. I wrote it, shipped a couple of versions that same week, added a `.travis.yml`, and by February 22 of that year basically left it there, frozen at `0.1.9`.

Almost ten years later I opened that repo again. It still worked — `npm install setimmutable` was still serving the same `setImmutable.js` from 2017 — but under the hood it was a time capsule: gulp 3, babel 6, a build that didn't even run on modern Node anymore (`ReferenceError: primordials is not defined`, the classic symptom of `graceful-fs` reaching into places it shouldn't in newer versions of `fs.js`). I decided that instead of rewriting it from scratch, I'd leave its behavior exactly as it was — same API, same results — and give it the infrastructure it never had from day one. Three concrete things: automate the publish, build multi-engine integration tests, and add TypeScript.

## 1. Automating the publish

For nine years, shipping a new version meant `npm publish` by hand, from my machine, with a token stored who knows where. I replaced that with a workflow that triggers when `package.json` changes, and doesn't depend on any secret: it uses [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers) (OIDC), where GitHub Actions proves to npm that the publish is coming from this repo, in this workflow, with no `NPM_TOKEN` stored anywhere.

The interesting part was solving a problem that isn't obvious until you hit it: `npm publish` is one-shot per version — if two different pushes both try to publish `0.2.0-rc.1`, the second one blows up with `E403`. So the workflow doesn't publish the version exactly as it sits in `package.json`; it appends the run number as the real suffix:

```yaml
RAW_VERSION=$(node -e "console.log(require('./package.json').version)")
# ...
VERSION="${BASE_VERSION}-${TAG}.${{ github.run_number }}"
```

With that, every push to a PR mints a fresh, publishable `rc.N`, with no collisions, ever. The dist-tag isn't hardcoded either — it's inferred from the prerelease identifier itself: `0.2.0-rc.1` publishes under `rc`, and only a final version with no suffix (`1.0.0`) publishes under `latest`. And there's an explicit gate before any of that: if master's version already has a GitHub Release, the workflow won't publish again — so a random push to `package.json` without a real version bump can't fire off a phantom release.

The practical result: a PR that bumps the version leaves a comment with an `npm install setimmutable@rc` that installs exactly that code, and merging to `master` publishes it for real on its own, without me having to remember to run anything by hand.

## 2. Multi-engine integration tests

This was the part that worried me the most. `setimmutable` gets installed with `require()`, with static `import`, with dynamic `import()`, with the `setimmutable/map` subpath — and all of that has to work on old Node and current Node alike, and on Bun. There used to be no real guarantee of that; just faith that "nobody's complained yet."

I built a custom GitHub Action (`multi-engine-test`) that takes a list of "cases" — real code snippets that use the library — and runs them against a matrix of engines:

```yaml
engines: |
  node 6
  node 10
  node 12
  node lts
  node latest
  bun latest
  typescript latest
```

Each case actually runs (installing the tarball a real `npm publish` would produce, not the source code) against every engine, and the result is a table the workflow posts as a PR comment: rows by syntax (`require("setimmutable")`, `import set from "setimmutable"`, all three `map()` variants, index-notation paths like `"[0][1][2]"`, even a case with 31 levels of depth — the max TypeScript can infer at the type level, per the README itself), columns by engine, ✅ or ❌ in each cell.

The `typescript` engine is different from the rest: it never executes a case, it only type-checks it with `tsc --noEmit` against a copy renamed to `.mts`/`.cts` — so the same set of cases validates both that the code runs and that the types are correct, without duplicating anything.

To avoid every case reimplementing its own assertions, each generated file automatically gets `assert` (Node's built-in module) and `expectTypeOf` from `expect-type` injected, without the case having to import either — under Node/Bun, `expectTypeOf` no-ops at runtime (so the same case runs everywhere with no special-casing), and under TypeScript it's a real compile-time type check.

## 3. Adding TypeScript

The third piece was migrating the source from plain JS to TypeScript, with one detail that took more work than expected: making the types *path-aware*. It's not enough to type `set(object, path, value)` generically — I wanted that if I write `set(obj, 'a.b.c', 1)`, the compiler infers the exact resulting shape, including keys created along the way, up to 31 levels deep.

That's documented in the CHANGELOG with its real limits, not just what works:

- Index-notation paths (`'[0][1][2]'`) aren't parsed at the type level — typed array indexing needs the array-of-keys form instead.
- `customClone`'s effect on the result type isn't tracked.
- `map()`'s two function-based syntaxes (imperative callback and object-literal builder) stay untyped.
- The package published on npm is still plain JS — no `.d.ts` — so these types live in the source, not (yet) in what `npm install setimmutable` actually installs.

Along the way, the build moved from gulp 3 + babel 6 to `bun build src/setImmutable.ts --outfile setImmutable.js --target node --format cjs --no-bundle` — no bundler, transpile only — which is what finally killed the `ReferenceError: primordials is not defined` that had the build broken on modern Node.

## What made it into 1.0.0

None of these three changes touched the behavior of `set()`, `map()`, or `clone()` — the CHANGELOG says so explicitly.

> "No functional changes since 0.2.0 — this release promotes the existing API to 1.0.0."

The API is the same one I wrote in 2017. What changed is everything around that API: how it ships, how I prove it works where it says it works, and how confident I can be that it'll still be true the next time I touch it — even if another ten years go by.

**Repo:** [github.com/JonDotsoy/setImmutable.js](https://github.com/JonDotsoy/setImmutable.js) · MIT License

## Similar posts on daily.dev

- [TypeScript 6.0 is your final warning](https://daily.dev/posts/typescript-6-0-is-your-final-warning-2tbdrcemi) · Bytes by ui.dev · 144 upvotes · 15 comments
- [Issue \#794: npm 12, TypeScript 7, and Bun in Rust — JavaScript Weekly](https://daily.dev/posts/issue-794-npm-12-typescript-7-and-bun-in-rust-javascript-weekly-83kbt2vgr) · JavaScript Weekly · 3 upvotes · 0 comments
- [Issue \#639: Bun now passes 80.5% of Node's test suite — Node Weekly](https://daily.dev/posts/issue-639-bun-now-passes-80-5-of-node-s-test-suite-node-weekly-dvlllatcu) · Node Weekly · 1 upvotes · 0 comments
- [Anthropic bakes memory fixes into Bun 1.1.13 as developers complain of leaks](https://daily.dev/posts/anthropic-bakes-memory-fixes-into-bun-1-1-13-as-developers-complain-of-leaks-nnyc5gjq0) · DEVCLASS · 0 upvotes · 0 comments

---

Tags: [#cicd](https://daily.dev/tags/cicd), [#github-actions](https://daily.dev/tags/github-actions), [#npm](https://daily.dev/tags/npm), [#open-source](https://daily.dev/tags/open-source), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3","headline":"Ten years later, setimmutable finally hit 1.0.0","text":"A maintainer revisited a small JavaScript library, setimmutable, ten years after its first commit, and shipped it as 1.0.0 with no functional changes to its API. The work focused on infrastructure: automating npm publishing via npm Trusted Publishing (OIDC) with GitHub Actions instead of stored tokens, building a custom multi-engine integration test action that validates the package across Node versions, Bun, and TypeScript type-checking, and migrating the source to TypeScript with path-aware type inference up to 31 levels deep. The build toolchain moved from gulp 3 and babel 6 to a direct bun build command, which fixed a longstanding break on modern Node versions.","url":"https://daily.dev/posts/ten-years-later-setimmutable-finally-hit-1-0-0-hn3airqe3","datePublished":"2026-09-07T06:20:12.370Z","dateModified":"2026-10-14T02:23:35.864Z","author":{"@type":"Person","name":"Jonathan Delgado","url":"https://daily.dev/jonathandelgado","image":"https://avatars.githubusercontent.com/u/3086539?v=4","description":"A software enginner","worksFor":{"@type":"Organization","name":"Apply Digital","logo":"https://res.cloudinary.com/daily-now/image/upload/s--dPm9XRjU--/f_auto/v1728569477/companies/applydigital"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"image":"https://media.daily.dev/image/upload/s--CyllcxL6--/f_auto/v1788762012/posts/Hn3aIrQe3?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/ccmfsskv5iewk1pmun3oj","name":"Jonathan Delgado"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Jonathan Delgado","item":"https://daily.dev/sources/ccmfsskv5iewk1pmun3oj"},{"@type":"ListItem","position":3,"name":"Ten years later, setimmutable finally hit 1.0.0"}]}
```

