Skip to content

Remove @node-red/util dependency#7768

Open
Steve-Mcl wants to merge 3 commits into
mainfrom
7765
Open

Remove @node-red/util dependency#7768
Steve-Mcl wants to merge 3 commits into
mainfrom
7765

Conversation

@Steve-Mcl

Copy link
Copy Markdown
Contributor

Description

This pull request removes the dependency on the external @node-red/util package by introducing a local utility module and updating references to use it.

This reduces transient dependencies (and make the codebase more self-contained).

Package Version Why it went
@node-red/util 5.0.1 the module you removed (direct dep)
jsonata 2.0.6 top-level, only referenced by @node-red/util
fs-extra 11.3.0 nested under @node-red/util
i18next 25.8.14 nested
moment 2.30.1 nested
moment-timezone 0.5.48 nested
chalk 4.1.2 nested
ansi-styles 4.3.0 nested (via chalk)
color-convert 2.0.1 nested (via chalk)
color-name 1.1.4 nested (via chalk)
has-flag 4.0.0 nested (via chalk)
supports-color 7.2.0 nested (via chalk)

NOTE:

there are minimal existing "happy path" tests in test/unit/forge/ee/routes/staticAssets/index_spec.js that touch red_util getObjectProperty & setObjectProperty - let me know if you want more extensive tests.

NOTE 2:

There is an additional fix for path..normalize added to the stub driver at forge/containers/stub/index.js:12
It was changed to use path.posix.normalize so that .split('/') works consistently on Windows and Linux.

This was a pre-existing bug, not something you introduced here - it was latent because CI is Linux-only. My env is Windows.
Since it's the stub driver only (used for local dev/tests, not production containers), the impact was limited to running these tests on Windows - but the posix fix should make this portable.


Dependency removal and refactoring:

  • Removed @node-red/util from the package.json dependencies.

New utility module:

  • Added forge/containers/stub/red_util.js, which provides the implementation required to pass tests. NOTE: the code was linted to permit clean lint check. See original code in NR repo util/lib/util.js for reference.

Related Issue(s)

closes #7765

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@Steve-Mcl

Copy link
Copy Markdown
Contributor Author

FlowFuse/nr-launcher#577

With these 2 PRs, we remove a lots of deps - most importantly, jsonata

@Steve-Mcl Steve-Mcl requested a review from knolleary July 7, 2026 14:29
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.76836% with 119 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.06%. Comparing base (cababe3) to head (7abb089).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
forge/containers/stub/red_util.js 32.00% 119 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7768      +/-   ##
==========================================
- Coverage   75.39%   75.06%   -0.34%     
==========================================
  Files         428      429       +1     
  Lines       22540    22715     +175     
  Branches     5945     6013      +68     
==========================================
+ Hits        16994    17050      +56     
- Misses       5546     5665     +119     
Flag Coverage Δ
backend 75.06% <32.76%> (-0.34%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Steve-Mcl

Copy link
Copy Markdown
Contributor Author

odd seemingly unrelated test fail:

  2682 passing (15m)
  24 pending
  1 failing

  1) DeviceCommsHandler
       Device Status
         suppresses the transient stopped broadcast while restarting, but still records the state:

      AssertionError: expected 'restarting' to be 'stopped'
      + expected - actual

      -restarting
      +stopped
      
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at Context.<anonymous> (test/unit/forge/comms/devices_spec.js:264:37)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)

updating branch to main so tests re-run

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.

chore: Remove runtime dependency to @node-red/util

2 participants