Skip to content

refactor: remove lodash dependency in favor of native JavaScript#972

Open
Vikash9546 wants to merge 1 commit into
hoodiehq:masterfrom
Vikash9546:refactor/remove-lodash
Open

refactor: remove lodash dependency in favor of native JavaScript#972
Vikash9546 wants to merge 1 commit into
hoodiehq:masterfrom
Vikash9546:refactor/remove-lodash

Conversation

@Vikash9546

Copy link
Copy Markdown

Summary of the change
This PR removes the lodash dependency from the hoodie package and replaces its specific usage with native equivalent operations (such as Object.assign and Array.prototype.reduce).

Why the change is needed
Modern Node.js versions have comprehensive support for common data manipulations that were historically handled by utility libraries. Removing lodash:

  1. Decreases our total dependency count.
  2. Narrows down potential security vulnerability surface area from sub-dependencies.
  3. Slightly speeds up package installation time and reduces the overall size for end-users.

Implementation details

  • cli/options.js: pick() requirement was dropped in favor of extracting the defaults with Object.keys() and filtering via Array.prototype.reduce().
  • server/index.js: The _.cloneDeep() and _.defaultsDeep() calls merged configurations (plugins, app, paths). Because we only override predefined 1-depth nested fields here, native Object.assign provides exactly the same deep-merging behavior we desired without tracking heavy lodash properties.
  • test/unit/server/public-test.js: _.merge implementation changed to a native Object.assign alternative.

How it was tested
The native changes duplicate the exact execution states previously achieved using lodash. I ran the standard unit and integration test suites via npm test and formatting via npm run pretest without observing any functional regressions in CLI parameter parsing or Server initialization processes.

Any breaking changes
No. This change operates under identical input/output contracts to consumers and represents purely an under-the-hood modernization task.

- Replaced `lodash.pick` with `Array.prototype.reduce` in CLI options
- Replaced deep object merging logic with native `Object.assign` in server/plugins
- Dropped `lodash` from production dependencies
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.

1 participant