-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(deps): remove moment
dep and usage
#12611
Conversation
This was finally merged in late August, so this PR can now be finalized |
34678ed
to
4c62f08
Compare
Apparently |
`moment` has been [deprecated since Sep 2020](https://momentjs.com/docs/#/-project-status/) and recommends using native `Intl` or newer libraries that make use of native `Intl`, such as `luxon` and `dayjs` - `moment` is also a very large dependency and hence is ripe for pruning and replacement as well - replace all usage of `moment` with regular `Date` functions - `valueOf()` works the same way for `Date` and `moment` - `diff` doesn't exist, but it's a one-liner helper - `format` doesn't exist, but we can also use a simple helper for that - shave off X kb by replacing ~15 LoC Signed-off-by: Anton Gilgur <[email protected]>
Signed-off-by: Anton Gilgur <[email protected]>
41d4fa4
to
3c33a21
Compare
Fixed conflicts |
Signed-off-by: Anton Gilgur <[email protected]> (cherry picked from commit 2f3d6a6)
Partial fix for #12059, but removing / replacing a large dep entirely.
chart.js
in the deps, so it instead got code-split into theReports
page bundle, see "Notes to Reviewers" belowFollow-up to #12097
Motivation
moment
has been deprecated since Sep 2020 and recommends using nativeIntl
or newer libraries that make use of nativeIntl
, such asluxon
andday.js
moment
is also a very large dependency and hence is ripe for pruning and replacement as wellshave off ~634KB / 260KB minified / 73KB gzipped from the main bundle by replacing ~15 LoC
Modifications
replace all usage of
moment
with regularDate
functionsvalueOf()
works the same way forDate
andmoment
diff
doesn't exist, but it's a one-liner helperformat
doesn't exist, but we can also use a simple helper for thatUpdate
argo-ui
to latest include refactor(deps)!: removemoment
dep and usage argo-ui#535. See full diff: argoproj/argo-ui@6de6bfe...54f36c7Verification
make start UI=true
View a specific node of a workflow;
workflow-node-info
looks correct to me. Screenshot:Bundle Analysis
before:
after:
Notes to Reviewers
moment
was removed as a dep in this PR from our own usage and fromargo-ui
's usage (argoproj/argo-ui#535), but apparently it is still depended on by the old version ofchart.js
in the deps, so it got code-split out to theReports
bundle from #12061.Future Work
chart.js
andreact-chartjs-2
to more modern versions with tree-shaking and no direct dependence onmoment