Read the statement by Michael Teeuw here.
Any plan to replace "request" and "moment"?
-
@sdetweil I’m trying to get luxon up and running.
Supports Node.js 6+. Install via NPM: npm install --save luxon const { DateTime } = require("luxon");
Do I need to use node_helper to get it going, then?
-
@bkeyport require only works in node_helper
the doc also gives u a < script approach
still npm install
then getScripts to load the file from node_modules folder/luxon folderthe use in modulename.js as shown for browser
-
@sdetweil Oh, so I set up the require in node_helper, and use it accordingly in the main module script? Nice.
-
@bkeyport no. one OR the other
-
@sdetweil OK, I’m lost.
If Moment goes away, I’ll delete my modules.
-
@bkeyport if you don’t have a node_helper, the you use the getScripts approach
if u have both, then u have to do both
-
I give up.
Suggestion for the main app -
Create a date-time service that hides what library you’re using. If you decide to replace the library in the future, you’ll need to update only one file.
That way, we don’t have to move at all - just convert from accessing moment directly to accessing the internal service.
In the meantime, I’m indeed dropping it.
-
@bkeyport I don’t understand dropping the library…
sadly its never that easy. code has to change.
as for the other.
can u do all you app in the browser side (module name.js)if so then u load the new moment library with
npm install --save libname
and then (check syntax)getScripts: return [ this.file("node_modules/libname/....")] // the file is whatever would be in the script tag
of u need to use node_helper, and need moment like stuff,
const ???? = require('libname')
if u need both, then u have to do both
-
Dropping it = Not going to bother until I have to.
-
EDIT: Reference path to luxon.min.js
@bkeyport I think the following should work for you.
Add luxon.min.js to your project in the root of your project.
Then add the following to you project, I have used your MMM-Multimonth as an example project.getScripts: function() { return[this.file("/node_modules/luxon/build/global/luxon.min.js")] },
Once added you should be able to use it like this:
In your project you have the following for moment:monthTitle = moment().add(-1, "month").format("MMMM YYYY")
You an now do the following in luxon:
const luxMonth = luxon.DateTime.now().plus({month: -1}).toFormat("MMMM yyyy")
Hope this gives you a start in the right direction.
You can find luxon.min.js here