Read the statement by Michael Teeuw here.
Any plan to replace "request" and "moment"?
-
@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…
-
@sdetweil doing this in some of my own modules so I’m allowed to say this ;)
-
@karsten13 doing it ON PURPOSE is a hack!!
-
@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.
-
@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) -
@sdetweil yeah, I guess, I was not clear enough. And I think we are saying the same thing.
Installing “request” in the MM root folder solves the problem, and this is how I do run my magic mirror from the development branch at this very moment.
What I mean is that if the module is removed from the “MM/node_modules” folder (the last “parent” level for all modules), every single module will most likely need to install it on its own node_modules folder. This is where I meant it may blow up the size of the MM installation (modules included!)
I hope this clarifies my prev post :)
-
@0m4r said in Any plan to replace "request" and "moment"?:
What I mean is that if the module is removed from the “MM/node_modules” folder (the last “parent” level for all modules), every single module will most likely need to install it on its own node_modules folder. This is where I meant it may blow up the size of the MM installation (modules included!)
yeh, you have NO idea how big other stuff is already…
but, this is the design… there is virtual memory, and paging and … to offset these
now, remember, we are NOT making an installable bundle from all this, just a runtime layout
-
God, the alternatives to moment are head spinning. I don’t understand 'em, and can’t even get basic functions to work right within jsfiddle.net (Example: Date1 <= Date2 crashes jsfiddle)
For now, I’ve added package.json to both modules, and if needed, will update my install instructions.
-
For the
moment
, maybeluxon
ordate-fns
could be the alternative. (And there are several other modules also.)However, After releasing TC39’s new proposal (currently stage 3. https://tc39.es/ecma402/), Browsers and NodeJS will have the native features of handling dates. So I would recommend waiting.
At this moment, native implementing
moment
’s features is not easy. ThoughIntl
could handle many aspects ofmoment
already, the unsolved big issue is, currentDate
andIntl
features are still not perfect for localization, likeweekOfYear
,startdayOfWeek
and so on. (Those will be solved by ECMA402) -
@mmrize agree to support native browser APIs, but I do also believe we cannot assume everyone is running an up-to-date system for their magic mirror.
One idea could be to provide a wrapper module to abstract the “behind the scene” tool to manipulate dates, but it may turn out to be quite of an effort and limiting the module developer.