metron-issues mailing list archives

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

    [ https://issues.apache.org/jira/browse/METRON-1796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16636993#comment-16636993
] 

ASF GitHub Bot commented on METRON-1796:
----------------------------------------

Github user ruffle1986 commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1219#discussion_r222308215
  
    --- 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](https://github.com/dbushell/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](https://github.com/owenmead/Pikaday/issues/60)
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](https://github.com/owenmead/Pikaday/compare/master...ruffle1986:master),
made the changes and [published it on npm under my name](https://www.npmjs.com/package/@ruffle1986/pikaday-time).
Originally I wanted to published it under [hortonworks](https://www.npmjs.com/org/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](https://docs.npmjs.com/files/package.json#optionaldependencies).
    
    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: https://issues.apache.org/jira/browse/METRON-1796
>             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:
> https://lists.apache.org/thread.html/2e4fafa4256ce14ebcd4433420974e24962884204418ade51f0e3bfb@%3Cdev.metron.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message