Read the statement by Michael Teeuw here.
Any plan to replace "request" and "moment"?
-
@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.
-
@mmrize Well we all know how ‘browsers supporting’ all work out LOL
Some do…some don’t.
-
@cowboysdude AND for mm, the calendar date work is done OUTSIDE the browser in the node helper. soooooo, still need something
-
@cowboysdude @sdetweil
Fortunately, We need to consider only ‘Chromium’ and ‘node’ at most. (Firefox already implements almost-completeIntl
features. For Safari… who cares.)
And in this case,Intl
(and theTemporal
in the future) suggests the STANDARD WAY how to handle date/time for L10N/I18N in Javascript environments(includes browsers and nodeJS). So I believe it has worthy looking inside.Once (yesterday), I’ve tried to rewrite
clock
module andcalendar
module withoutmomentjs
or any other3rd party library
, only withDate
andIntl
.The start was not so bad. I could rewrite many features with only
Date
andIntl
.
Where I stuck was theshowWeek
config feature. It has to show the ordinal number of weeks of the year. To calculate ISOweek is not difficult. But in some areas, like the US. they never use the ISO system. damn!. To calculate the conventional US week number, additional pieces of information are needed. (read this.) CurrentIntl
has not yet that feature. I’m waiting forTemporal
and enhancedIntl
releasing.One solution might be to obtain additional information needed for conventional calculation from the user by configuration. At this point, I stopped rewriting. It needs to change
config.js
and that was not my first intention.A usual solution might be to use 3rd party library like
momentjs
orluxon
. It is easier.However it’s good to read this from the
momentjs
(https://momentjs.com/docs/#/-project-status/future/) I agree to him, In the near future, native JS featuresDate
,Intl
,Temporal
will be a standard. -
@mmrize i don’t see whats so hard on week of the year.
what day of the week is 1/1, subtract that from 7, and then that is the start of the weekly cycle.
til you run out of days to count.we don’t use it normally, but its still the week of the year. has nothing to do with month. that is a different scheme
my science teacher in high school had a great topic, measurement…
you can measure anything with anything… just record what the tool waswe were required to measure everything in broomstick handles, broomstick #1 in the lab to be precise.
we could subdivide broomstick #1 however we wanted to provide more accuracy, as long as we wrote down the algorithm. (divide by 3, 6, 10?.. , 1000 ml beaker height, whatever)
the last week doesn’t run over into a new year, it ENDS when the year ends.
just so happens that week #1 of the NEXT year is the same logical week, but who cares, as we started counting from 1 again.