[PR #6686] [MERGED] chore: drop ms package #6825

Closed
opened 2026-03-13 13:13:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6686
Author: @bytaesu
Created: 12/11/2025
Status: Merged
Merged: 12/11/2025
Merged by: @Bekacru

Base: canaryHead: 2025-12-11/chore/drop-ms-package


📝 Commits (6)

  • bf60e4e update our own time converter
  • 195fbba update all places using ms to our own converter
  • afbd42f correct test code
  • 2c1521d test: add test case covering exp convert util
  • 7821c28 chore: remove ms package
  • 5fb3624 Merge branch 'canary' into 2025-12-11/chore/drop-ms-package

📊 Changes

9 files changed (+187 additions, -72 deletions)

View changed files

📝 packages/better-auth/package.json (+0 -1)
📝 packages/better-auth/src/cookies/index.ts (+2 -2)
📝 packages/better-auth/src/plugins/device-authorization/device-authorization.test.ts (+4 -4)
📝 packages/better-auth/src/plugins/device-authorization/index.ts (+8 -7)
📝 packages/better-auth/src/plugins/device-authorization/routes.ts (+1 -1)
📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+54 -1)
📝 packages/better-auth/src/plugins/jwt/utils.ts (+3 -2)
📝 packages/better-auth/src/utils/time.ts (+115 -45)
📝 pnpm-lock.yaml (+0 -9)

📄 Description

This PR removes the ms package and updates the code to use the new sec() and ms() utilities within the better-auth package.

  • According to RFC 7519, JWT should use NumericDate value (seconds), so sec() is added alongside ms().
  • It remains compatible with the existing Device Authorization plugin, so this PR introduces no breaking changes.
  • joseSecs() was an internal, non-exported utility, so this also introduces no breaking changes.
  • Adds test cases for time conversion related utility used in JWT plugin.

Summary by cubic

Removed the external ms package and added internal ms() and sec() utilities to standardize time parsing and ensure JWT exp uses seconds per RFC 7519. Updated usages across the codebase with no breaking changes and added tests for time conversion.

  • Refactors

    • Replaced ms imports with utils/time ms() and sec() in cookies, device-authorization, and JWT.
    • Added TimeString parsing (e.g., "7d", "30m", "1 hour", "1h ago") and used sec() in JWT to produce NumericDate.
    • Added tests for toExpJWT and device authorization option parsing.
  • Dependencies

    • Removed ms from package.json and pnpm-lock.yaml.

Written for commit 7821c2865b. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6686 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 12/11/2025 **Status:** ✅ Merged **Merged:** 12/11/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `2025-12-11/chore/drop-ms-package` --- ### 📝 Commits (6) - [`bf60e4e`](https://github.com/better-auth/better-auth/commit/bf60e4edc0980569d97bc933e6f63c45604ba8bc) update our own time converter - [`195fbba`](https://github.com/better-auth/better-auth/commit/195fbba37cf04a44a3ef1080033c41a8576f0dc2) update all places using ms to our own converter - [`afbd42f`](https://github.com/better-auth/better-auth/commit/afbd42fd86bbc6ae098133b07129841c2b019964) correct test code - [`2c1521d`](https://github.com/better-auth/better-auth/commit/2c1521d1ab44369f0aa9602e7dcbe32a80578cd5) test: add test case covering exp convert util - [`7821c28`](https://github.com/better-auth/better-auth/commit/7821c2865bf65ccc952fa4dc2982b7707cf82966) chore: remove ms package - [`5fb3624`](https://github.com/better-auth/better-auth/commit/5fb3624ca2c441d1558c3c29f4d8eab50403486b) Merge branch 'canary' into 2025-12-11/chore/drop-ms-package ### 📊 Changes **9 files changed** (+187 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/package.json` (+0 -1) 📝 `packages/better-auth/src/cookies/index.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/device-authorization/device-authorization.test.ts` (+4 -4) 📝 `packages/better-auth/src/plugins/device-authorization/index.ts` (+8 -7) 📝 `packages/better-auth/src/plugins/device-authorization/routes.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+54 -1) 📝 `packages/better-auth/src/plugins/jwt/utils.ts` (+3 -2) 📝 `packages/better-auth/src/utils/time.ts` (+115 -45) 📝 `pnpm-lock.yaml` (+0 -9) </details> ### 📄 Description This PR removes the `ms` package and updates the code to use the new `sec()` and `ms()` utilities within the better-auth package. - According to _RFC 7519_, JWT should use NumericDate value (seconds), so `sec()` is added alongside ms(). - It remains compatible with the existing Device Authorization plugin, so this PR introduces no breaking changes. - `joseSecs()` was an internal, non-exported utility, so this also introduces no breaking changes. - Adds test cases for time conversion related utility used in JWT plugin. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removed the external ms package and added internal ms() and sec() utilities to standardize time parsing and ensure JWT exp uses seconds per RFC 7519. Updated usages across the codebase with no breaking changes and added tests for time conversion. - **Refactors** - Replaced ms imports with utils/time ms() and sec() in cookies, device-authorization, and JWT. - Added TimeString parsing (e.g., "7d", "30m", "1 hour", "1h ago") and used sec() in JWT to produce NumericDate. - Added tests for toExpJWT and device authorization option parsing. - **Dependencies** - Removed ms from package.json and pnpm-lock.yaml. <sup>Written for commit 7821c2865bf65ccc952fa4dc2982b7707cf82966. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:13:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6825