0.0.1 • Published 1 year ago
moment2dayjs v0.0.1
moment2dayjs
https://github.com/yanaemon/moment-to-dayjs-codemod
inspired by moment-dayjs-codemod
A collection of codemods for migrating from moment.js to day.js
使用@typescript-eslint/parser
()处理jsx|tsx
,其遵循estree标准, typescript
并不遵循estree规范, 而@babel/parser
会将注释解析成node导致问题
Usage
Config
strict
:- true -> replace method only the caller is
moment(...)
, - false -> replace method as the method is belong to moment
- true -> replace method only the caller is
Feature
- replace
moment
todayjs
latest version in package.json - work in
js|ts|jsx|tsx
- api use transform
- ts type transform
- import type
- asset type
- 泛型
Code Transform
- All listed in
You-Dont-Need-Momentjs
- import / require
- mutable to immutable
- api transform
moment()
->dayjs()
moment.isMoment()
->dayjs.isDayjs
- ts type transform
- import type
-
Moment
type asset
- import type
-
Installation
- clone the repo
- change into the repo directory
pnpm i
Running tests
yarn test
References
0.0.1
1 year ago