MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Any plan to replace "request" and "moment"?

    Scheduled Pinned Locked Moved Unsolved Feature Requests
    61 Posts 8 Posters 35.2k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sdetweil @0m4r
      last edited by sdetweil

      @0m4r we have already moved away from request… it was removed in 2.16

      I hadn’t seen moment status
      I think we moved to moment.tz in calendar

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • karsten13K Offline
        karsten13 @0m4r
        last edited by

        I think we should open an issue in the github repo to discuss the moment stuff there, if it should be replaced and with what. Found this article.

        In the current mm release 2.16.0 request is still a dev dependency but it is now totally removed on the develop branch (and so in the next release).

        0m4r0 1 Reply Last reply Reply Quote 1
        • BKeyportB Offline
          BKeyport Module Developer
          last edited by

          My concern as a module handler that has two modules that currently use Moment, how do I switch, either now or later?

          The "E" in "Javascript" stands for "Easy"

          S cowboysdudeC 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @BKeyport
            last edited by

            @bkeyport now, and later, use the new library in your module and add it to your package.json.

            then if the system provides it npm install will say ‘done’
            and if the system doesn’t, then it will load it for your module…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            mumblebajM 1 Reply Last reply Reply Quote 2
            • mumblebajM Offline
              mumblebaj Module Developer @sdetweil
              last edited by

              @sdetweil Just a question from myself, is there a preference from the platform side on what to use to replace request? I have just updated my module to use node-fetch. Are there preferences from the MMM platform side?

              Check out my modules at: https://github.com/mumblebaj?tab=repositories
              Check my blog-post: https://mumblebaj.xyz/
              Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

              S 0m4r0 2 Replies Last reply Reply Quote 0
              • S Offline
                sdetweil @mumblebaj
                last edited by

                @mumblebaj no preference…

                I use axios

                see this list
                https://github.com/request/request/issues/3143

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                mumblebajM 1 Reply Last reply Reply Quote 1
                • mumblebajM Offline
                  mumblebaj Module Developer @sdetweil
                  last edited by

                  @sdetweil Thanks Sam. Yeah, I saw there are a few replacements for request. I had a look at axios previously as well.

                  Check out my modules at: https://github.com/mumblebaj?tab=repositories
                  Check my blog-post: https://mumblebaj.xyz/
                  Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                  1 Reply Last reply Reply Quote 0
                  • 0m4r0 Offline
                    0m4r Module Developer @mumblebaj
                    last edited by

                    @mumblebaj there are many options. I am planning to replace all with node-fetch (https://github.com/node-fetch/node-fetch), and concerning moment, I think I’d go for date-fns: https://date-fns.org/

                    https://github.com/0m4r

                    1 Reply Last reply Reply Quote 0
                    • 0m4r0 Offline
                      0m4r Module Developer @0m4r
                      last edited by

                      @sdetweil ah, I had an old version that still included “request”. ID’ migrate my modules over to node-fetch!

                      About moment, I’d recommend taking a look at date-fns, many are moving over to it to replace moment - even tho the refactoring effort may not be trivial, the advantages seem to be more (including the smaller size of the final bundle)!

                      https://github.com/0m4r

                      BKeyportB 1 Reply Last reply Reply Quote 0
                      • 0m4r0 Offline
                        0m4r Module Developer @karsten13
                        last edited by

                        @karsten13 said in Any plan to replace "request" and "moment"?:

                        In the current mm release 2.16.0 request is still a dev dependency but it is now totally removed on the develop branch (and so in the next release).

                        this would be a breaking change for many modules, what’s the plan to communicate it to the module developers (and potentially, to the users?)

                        https://github.com/0m4r

                        karsten13K 1 Reply Last reply Reply Quote 0
                        • karsten13K Offline
                          karsten13 @0m4r
                          last edited by

                          @0m4r we had similar discussions already here

                          swvalentiS 1 Reply Last reply Reply Quote 0
                          • swvalentiS Offline
                            swvalenti Project Sponsor @karsten13
                            last edited by

                            How can I tell if a module will be compatible prior to the fall upgrade of 2.17.0? I don’t want to upgrade and half of my modules break.

                            0m4r0 1 Reply Last reply Reply Quote 0
                            • 0m4r0 Offline
                              0m4r Module Developer @swvalenti
                              last edited by

                              @swvalenti if your module uses “request” to issue HTTP calls then it is.
                              so, if you import it in your node_helper.js (or an alike node pice of code).

                              i.e.
                              const request = require('request');
                              or
                              import request from 'request'

                              on way to preserve it is to add “request” as a dependency to your module, but your end-users will need to install them on their own.
                              To add it to your module, from its folder you can do:
                              npm install request ; this will update your package.json file (and package-lock.json) - commit the change to your git repo (this is most likely a breaking change and would require a major version increase - if you version your code!)

                              Once this is done, your existing (and new) end-user will need to update their copy of your module and run npm install on their own to download request and enable them to use it.

                              https://github.com/0m4r

                              swvalentiS 1 Reply Last reply Reply Quote 0
                              • swvalentiS Offline
                                swvalenti Project Sponsor @0m4r
                                last edited by

                                @0m4r said in Any plan to replace "request" and "moment"?:

                                const request = require(‘request’);

                                thank you for the explanation I understand better now

                                karsten13K 1 Reply Last reply Reply Quote 0
                                • karsten13K Offline
                                  karsten13 @swvalenti
                                  last edited by

                                  @swvalenti one addition: Only modules are affected which rely on that request is intalled in core mm (which is a dirty hack of the module developer), modules which install request on their own are not!

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sdetweil @karsten13
                                    last edited by

                                    @karsten13 said in Any plan to replace "request" and "moment"?:

                                    which is a dirty hack of the module developer

                                    no… don’t say it that way…

                                    lack of experience on the part of the developer…

                                    it just worked, so they didn’t know to ask if there was a more correct way…

                                    I had that problem early on in my nodejs development too…

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    karsten13K 1 Reply Last reply Reply Quote 1
                                    • karsten13K Offline
                                      karsten13 @sdetweil
                                      last edited by

                                      @sdetweil doing this in some of my own modules so I’m allowed to say this ;)

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        sdetweil @karsten13
                                        last edited by

                                        @karsten13 doing it ON PURPOSE is a hack!!

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        0m4r0 1 Reply Last reply Reply Quote 0
                                        • 0m4r0 Offline
                                          0m4r Module Developer @sdetweil
                                          last edited by

                                          @sdetweil @sdetweil I am not convinced about both of your points of view. I mean technically yes.

                                          But… looking into the modules themselves, they are solely made to work with the MagicMirror code base (99% of the cases)
                                          What is the point to bloat the size of the installation with the same node module installed over and over again? when on, “global” can be used and relied upon? (well, yeah, I agree, “this situation” is one reason for it!). But why trade-off convenience over complexity?

                                          I see it as a part of the Magic Mirror ecosystem, provide some common “code” to be used by everyone to both ease the development and the set-up of it.

                                          As mentioned in the other thread, old legacy modules will probably stop working - forking them or re-doing them will fix them. This not only pushes forward the advancement of the whole MagicMirror tech stack, but it may strengthen the community and really push it to hold together and upgrade, modernize the code of the modules.

                                          bottom line, nobody says it is going to be easy, but it is a big opportunity.

                                          https://github.com/0m4r

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Offline
                                            sdetweil @0m4r
                                            last edited by

                                            @0m4r said in Any plan to replace "request" and "moment"?:

                                            What is the point to bloat the size of the installation with the same node module installed over and over again

                                            it is NOT installed over and over

                                            npm install start with the module folder and says

                                            is it here?   
                                               no   
                                                 look in the parent folders, 1 by 1, looking for a node_modules folder
                                                   is it there?
                                                      yes, stop
                                               yes, 
                                                 stop. 
                                            

                                            so it will only be installed once…

                                            in the near term with all the old modules ‘assuming’ is was installed,
                                            it’ll have to be installed in the MM/node_modules (but only once)

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            0m4r0 1 Reply Last reply Reply Quote 1

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 3 / 4
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy