Skip to content

refactor: replace fileURLToPath with import.meta.dirname - #2366

Merged
ghostdevv merged 1 commit into
npmx-dev:mainfrom
trivikr:file-url-to-path
Apr 4, 2026
Merged

refactor: replace fileURLToPath with import.meta.dirname#2366
ghostdevv merged 1 commit into
npmx-dev:mainfrom
trivikr:file-url-to-path

Conversation

@trivikr

Copy link
Copy Markdown
Contributor

🔗 Linked issue

N/A

🧭 Context

The codebase still had several module-relative filesystem paths built with fileURLToPath(new URL(..., import.meta.url)). Since the project now targets Node.js 24.x, we can use import.meta.dirname directly for these filesystem path constants and simplify that pattern across scripts, config, and tests.

📚 Description

This PR replaces module-relative path constants based on fileURLToPath(new URL(...)) with import.meta.dirname-based path construction where the code is resolving local filesystem paths.

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentApr 3, 2026 3:39am
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewApr 3, 2026 3:39am
npmx-lunariaIgnoredIgnoredApr 3, 2026 3:39am

Request Review

@codecov

codecovBot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 291e2ea5-c085-44f1-8931-edd9ae1c2192

📥 Commits

Reviewing files that changed from the base of the PR and between d3f60cb and 700ec12.

📒 Files selected for processing (9)
  • playwright.config.ts
  • scripts/compare-translations.ts
  • scripts/find-invalid-translations.ts
  • scripts/generate-fixtures.ts
  • scripts/generate-i18n-schema.ts
  • scripts/remove-unused-translations.ts
  • scripts/unocss-checker.ts
  • test/unit/a11y-component-coverage.spec.ts
  • vite.config.ts

📝 Walkthrough

Walkthrough

This pull request refactors path resolution logic across multiple TypeScript configuration and script files. The changes replace instances of fileURLToPath(new URL(..., import.meta.url)) with more modern ESM metadata approaches, primarily using import.meta.dirname combined with join() or resolve() functions. The node:url import is removed from affected files where fileURLToPath was previously required. These modifications affect playwright.config.ts, vite.config.ts, and several utility scripts in the scripts/ and test/ directories. No exported or public entity declarations are altered, and the resulting directory targets remain functionally equivalent.

Suggested reviewers

  • danielroe
  • alexdln
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check nameStatusExplanation
Description check✅ PassedThe pull request description clearly describes the changeset: replacing fileURLToPath with import.meta.dirname across multiple files to simplify path construction, which aligns with the project's Node.js 24.x target.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghostdevvghostdevv changed the title chore: replace fileURLToPath with import.meta.dirnamerefactor: replace fileURLToPath with import.meta.dirnameApr 4, 2026

@ghostdevvghostdevv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good catch! I'm fairly confident this won't cause any issues, and nothing stands out as broken 🙏

@ghostdevv
ghostdevv added this pull request to the merge queueApr 4, 2026
Merged via the queue into npmx-dev:main with commit b9300f4Apr 4, 2026
22 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Apr 4, 2026
@trivikr
trivikr deleted the file-url-to-path branch April 4, 2026 07:11
Sign up for freeto 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

@trivikr@ghostdevv