refactor: replace ms with in-house formatMs/parseDuration#5641
refactor: replace ms with in-house formatMs/parseDuration#5641
Conversation
Remove dead dependencies that are listed in package.json but never imported: - @ant-design/plots, d3-array, react-is, svix, @vercel/og, free-email-domains (dashboard) - @mendable/firecrawl-js, ai (billing) - @axiomhq/js, ts-semaphore (migrate) - knip, cz-conventional-changelog (root) - @dagger.io/dagger (clickhouse) - eslint, eslint-config-next (dashboard) Also removes dead code: - axiom.ts migration script (dead) - k6 load testing tool (unused) - eslint config + lint script - commitizen config - Slack alerting from WorkOS webhook (unused)
Replace the slugify npm package with a simple 8-line utility in lib/slugify.ts. Consolidates two implementations (one was already hand-rolled in use-workspace-step.tsx) into a single shared function.
Replace the ms npm package with two focused utilities:
- lib/ms.ts: formatMs(n) for displaying durations ("1d", "2 hours")
- lib/duration.ts: parseDuration(s) for parsing strings like "24h" to ms
Also removes @types/ms and ms from the migrate tool.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe pull request removes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|

Summary
Replace the
msnpm package (+@types/ms) with two focused utilities:lib/ms.ts—formatMs(n, { long? })for displaying durations (86400000→"1d"or"1 day")lib/duration.ts—parseDuration(s)for parsing strings like"24h"→86400000The original
mspackage is 163 lines with an overloadedms()function that does both parsing and formatting. Splitting into two explicit functions makes the intent clear at each call site.5 files updated:
cancel-alert.tsx—formatMs(timeRemaining, { long: true })overrides-table.tsx—formatMs(override.duration)override-indicator.tsx—formatMs(log.override.duration)namespace-card.tsx—formatMs(Date.now() - timestamp, { long: true })use-deployments.ts—parseDuration(values.at(0))Also removes
msfrom the migrate tool where it was listed but never imported.Test plan
pnpm buildsucceeds