Skip to content

@ekino/config 2.0#43

Merged
tduyng merged 48 commits into
ekino:masterfrom
tduyng:2.0
Apr 30, 2026
Merged

@ekino/config 2.0#43
tduyng merged 48 commits into
ekino:masterfrom
tduyng:2.0

Conversation

@tduyng
Copy link
Copy Markdown
Contributor

@tduyng tduyng commented Feb 25, 2025

Summary

Rewrite @ekino/config for v2.0

Motivation

  • It's been so long time the library is not maintained
  • Rewrite this library for adapting the modern Node.js (Typescript, ESM)

What has changed?

Here are the key changes made in this PR:

  • Rewritten in ESM and support for dual package (CommonJS and ESM)
  • Removed lodash and other unnecessary dependencies
  • Replaced yarn with pnpm, which is faster and more convenient with different commands and management
  • Update GitHub Actions and use git-cliff on GitHub Actions for easily customizable CHANGELOG
  • Replaced ESLint + Prettier with Biome, which is faster, has sufficient rules, and is easier to set up
  • Rewrote all tests from jest + nyc to vitest (compatible with ESM)

Test plan

  • All unit tests have been remained the same and fix correctly with Vitest syntax

Also close issue #40

For the NPM release, now we use: "Trusted publishing for npm packages"
https://docs.npmjs.com/trusted-publishers#supported-cicd-providers

tduyng and others added 30 commits October 29, 2024 20:57
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 3, 2025

Coverage Status

coverage: 97.08% (+5.7%) from 91.358%
when pulling 8ed188f on tduyng:2.0
into fb6a80f on ekino:master.

Comment thread README.md Outdated
Comment thread .github/ISSUE_TEMPLATE/bug_report.yml Outdated
Comment thread package.json Outdated
Copy link
Copy Markdown

@halimatou-cpu halimatou-cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

tduyng added 6 commits April 3, 2026 11:06
isNullsy returns a boolean; 'boolean == null' is always false in JS,
making the left side of the || permanently dead. The null-traversal
path was only protected by the 'typeof current !== object' branch,
which silently misses an explicit null value assigned mid-path.

Replace '== null' with direct boolean evaluation so both null and
non-object intermediaries are caught correctly.

Adds a regression test for null intermediate node traversal.
The Internals type declared cast as accepting an optional boolean value,
but the implementation only handles string | number as input (it produces
boolean output, it does not consume it). The mismatch let TypeScript
silently accept boolean env vars at the call site despite the runtime
function never handling that case.

- Remove boolean and the optional marker from the Internals cast type
- Narrow envVal to string | number at the call site (ProcessEnv index
  signature includes boolean for test assignment ergonomics, not runtime)
The previous guard cast the input to its target type before checking,
which means an object with key explicitly set to undefined would pass
the !== undefined test and be misidentified as an advanced config.

Using typeof .key === 'string' checks the runtime shape without
assuming the cast is safe, making the guard correct by construction.
mergeWithDeep mutates the target when it is an object, which made the
call sites work in practice. However the return value is the canonical
result and discarding it creates a hidden coupling to the internal
mutation behaviour.

Assigning the return value back to internals.cfg makes the data-flow
explicit and correct even if the target were ever a wrapped primitive,
where the mutation would have been silently lost.
TypeScript 6 removed implicit typeRoots auto-inclusion. Previously, listing
'./node_modules/@types' in typeRoots was enough to pull in @types/node globally.
TS6 requires an explicit types: ['node'] entry in compilerOptions.
@tduyng tduyng force-pushed the 2.0 branch 2 times, most recently from e94eab5 to a8302a6 Compare April 3, 2026 09:26
- Remove allowSyntheticDefaultImports, esModuleInterop, strict, noImplicitAny:
  all now default to true/enabled in TS6, explicit values are redundant
- Remove typeRoots: superseded by explicit types:[node] added previously
- Add rootDir:./src to tsconfig.lib.json: TS6 no longer infers rootDir from
  input files; without it tsc errors (TS5011) and would emit to lib/src/ instead of lib/
@tduyng tduyng force-pushed the 2.0 branch 3 times, most recently from 51ee926 to c34e022 Compare April 7, 2026 09:35
@tduyng tduyng merged commit f547428 into ekino:master Apr 30, 2026
3 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.

5 participants