Skip to content

fix: clean copy_assets output with fs.rm() so it works on Node.js 25+ - #1796

Merged
jorenbroekema merged 1 commit into
style-dictionary:mainfrom
b84330808:fix/copy-assets-clean-node-25
Oct 28, 2026
Merged

jorenbroekema merged 1 commit into
style-dictionary:mainfrom
b84330808:fix/copy-assets-clean-node-25

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

Issue #, if available: none

Description of changes:

On Node.js 25 and later, cleaning a platform that uses the copy_assets action fails (cleanPlatform(), cleanAllPlatforms() or style-dictionary clean):

TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.recursive' is no longer supported. Received true

The undo step removes the copied assets directory with fs.promises.rmdir(path, { recursive: true }). Node.js 25 moved DEP0147 to end-of-life, so rmdir() now throws when it gets the recursive option. Node.js 24 only printed a deprecation warning.

  • Use fs.promises.rm(path, { recursive: true }) instead. memfs supports it too, so the browser build keeps working.
  • Add a test that cleans a platform with copy_assets and checks the assets directory is gone. It fails on Node.js 26 without the fix and passes on 24 and 26 with it.
  • Add a patch changeset.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

I used Claude Code to write this change.

The undo step of the copy_assets action removed the copied assets
directory with fs.promises.rmdir() and its `recursive` option. Node.js 25
removed that option (DEP0147) and now throws ERR_INVALID_ARG_VALUE, so
cleaning a platform with copy_assets failed. Use fs.promises.rm() with
`recursive: true` instead, which memfs supports too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@netlify

netlify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for styledictionaryjs ready!

Name Link
🔨 Latest commit 169adea
🔍 Latest deploy log https://app.netlify.com/projects/styledictionaryjs/deploys/6ae1dc5373cdbc134517c655
😎 Deploy Preview https://deploy-preview-1796--styledictionaryjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 169adea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
style-dictionary Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jorenbroekema

Copy link
Copy Markdown
Collaborator

Tests also pass on node 22, both linux/windows, so then yeah I'm happy to merge :) thanks

@jorenbroekema
jorenbroekema merged commit 52d9d7d into style-dictionary:main Oct 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants