metron-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (METRON-1796) [UI] Migrate off moment.js
Date Wed, 03 Oct 2018 13:52:00 GMT


ASF GitHub Bot commented on METRON-1796:

Github user ruffle1986 commented on a diff in the pull request:
    --- Diff: metron-interface/metron-alerts/package.json ---
    @@ -22,17 +22,17 @@
         "@angular/platform-browser": "^6.1.6",
         "@angular/platform-browser-dynamic": "^6.1.6",
         "@angular/router": "^6.1.6",
    +    "@ruffle1986/pikaday-time": "^1.6.1",
         "@types/bootstrap": "^4.1.1",
         "@types/jquery": "^3.3.4",
         "ace-builds": "^1.2.6",
         "ajv": "^6.5.1",
         "angular-confirmation-popover": "^4.2.0",
         "bootstrap": "4.0.0-alpha.6",
         "core-js": "^2.4.1",
    +    "date-fns": "^1.29.0",
         "font-awesome": "^4.7.0",
    -    "moment": "^2.22.2",
         "ng2-dragula": "^1.5.0",
    -    "pikaday-time": "^1.6.1",
    --- End diff --
    pikaday-time is an extension of [Pikaday]( Pikaday
is a great library with zero dependency. Pikaday-time is extends its functionality with time
selection. However moment is just an optional dependency of Pikaday, there's an unpleasant
side-effect in Pikaday-time where moment.js is set as a dependency in the package.json. So
everytime we install pikaday-time, moment.js will be installed as well.
    [I've tried to reach out the maintainer of the pikaday-time](
library but he's not so active on Github and the library is no longer maintained anyway so
it makes things a bit complicated. Hopefully we'll manage this and a patch for this will be
introduced shortly.
    Until then, [I've forked the pikaday-time repo](,
made the changes and [published it on npm under my name](
Originally I wanted to published it under [hortonworks](
but I don't know who have access to give me publish rights. The only change I made is setting
moment.js as a `peerDependency` insteadOf setting it as an `optionalDependency`. Don't let
the name `optionalDependency` mislead you. [It's basically a dependency but if it's cannot
be found on npm on any given registries, npm install doesn't fail](
    As soon as this issue is fixed and published on npm, we can remove the scoped pikaday-time
and switch back to the original package.

> [UI] Migrate off moment.js
> --------------------------
>                 Key: METRON-1796
>                 URL:
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Tamas Fodor
>            Assignee: Tamas Fodor
>            Priority: Minor
> Remove Moment.js and replace with another smaller library.
> Moment.js requires us to import the entire library vs. a few necessary modules.
> Moment.js can prevent bundlers from supporting tree-shaking.
> By removing Moment.js, we can decrease our overall bundle size and prevent issues with
tree-shaking in the future.
> Here you can find the discussion on the mailing list:

This message was sent by Atlassian JIRA

View raw message