These are chat archives for ciscoheat/haxe-npm-effort

19th
Jul 2015
Clément Charmet
@clemos
Jul 19 2015 18:45
Hi. What is this place :p ?
Andreas
@ciscoheat
Jul 19 2015 18:45
Hello :) Just started it, so we can discuss the npm "normalization" effort
@nadako here's the original discussion: clemos/haxe-js-kit#59
Clément Charmet
@clemos
Jul 19 2015 18:46
Ok there's a lot to talk about :)
Andreas
@ciscoheat
Jul 19 2015 18:47
It sure is!
Clément Charmet
@clemos
Jul 19 2015 18:48
About merging js-kit branches and abandonning node.js externs there is nothing really complicated I think
Andreas
@ciscoheat
Jul 19 2015 18:49
That's nice. And what about merging with abe-npm?
Clément Charmet
@clemos
Jul 19 2015 18:50
Well I don't know the project well enough
But I believe it has a totally different approach
Andreas
@ciscoheat
Jul 19 2015 18:51
They have followed the hxnodejs project very closely
What are the differences?
Clément Charmet
@clemos
Jul 19 2015 18:54
I'm checking it right now, and actually I was thinking about something else
I have to check it more closely
The only difference I can see so far is it doesn't manage npm deps like js-kit
Sorry I don't have time right now, got to go :/
Andreas
@ciscoheat
Jul 19 2015 18:56
Ok no problem, see you later
Clément Charmet
@clemos
Jul 19 2015 18:56
But it is certainly interesting ;)
Andreas
@ciscoheat
Jul 19 2015 18:56
Glad you think so. :)
Andreas
@ciscoheat
Jul 19 2015 19:02
A great thing is that the overlap between the projects is very small: https://www.diffchecker.com/495gh40o
Franco Ponticelli
@fponticelli
Jul 19 2015 20:12
these are express/middleware related
Andreas
@ciscoheat
Jul 19 2015 20:14
Ok! So what do you say about the versioning? Do you mean the externs should be versioned with their respective npm package version?
Franco Ponticelli
@fponticelli
Jul 19 2015 20:14
it would be nice
not sure how
maybe the externs should haxe things like #if npm_express > 4.x
and we could build a macro lib that add the versions from the package.json
I already have one https://github.com/abedev/jsrequire that installs npm modules if needed
Andreas
@ciscoheat
Jul 19 2015 20:17
Franco Ponticelli
@fponticelli
Jul 19 2015 20:18
I don't think it is
abe/npm and hxexpress both use the new @:jsRequire()meta
the jsrequire uses a macro to actually install the modules when they are not found
Andreas
@ciscoheat
Jul 19 2015 20:18
Ah yes, that's nice
It creates a package.json?
(or updates it)
Franco Ponticelli
@fponticelli
Jul 19 2015 20:19
it scans all the jsRequire, checks their existance and call npm install when needed
it updates it and there is an option to create it
if it doesn't exist and the option is off (default) it simply installs the modules
Andreas
@ciscoheat
Jul 19 2015 20:21
Great, it's very similar then, it's just that js-kit uses its own convention for the installation and versioning:
// js/npm/MyPackage.hx
package js.npm;
extern class MyPackage
implements npm.Package.Require<"my-package","^1.1.2">
Franco Ponticelli
@fponticelli
Jul 19 2015 20:21
cool
Andreas
@ciscoheat
Jul 19 2015 20:22
Do you manage specific versions in any way?
Franco Ponticelli
@fponticelli
Jul 19 2015 20:22
not at all
Andreas
@ciscoheat
Jul 19 2015 20:24
I'd prefer to use the @:jsRequire syntax for packages, as in the hxnodejs project, but the versioning in js-kit is quite nice.
Franco Ponticelli
@fponticelli
Jul 19 2015 20:25
it could be nice if you could do it at the function level
you could achieve that with either -D or a custom meta
Andreas
@ciscoheat
Jul 19 2015 20:27
like the #if npm_express > 4.x ?
Franco Ponticelli
@fponticelli
Jul 19 2015 20:27
yup
or
@:npm_version("4.x")
Andreas
@ciscoheat
Jul 19 2015 20:28
I like it, as long as it's simple to also use the latest version with no effort.
Franco Ponticelli
@fponticelli
Jul 19 2015 20:29
not sure how the meta version could prevent you from using the wrong version ... maybe a warning
Andreas
@ciscoheat
Jul 19 2015 20:34
Ok, but it looks promising. But it will take some changes, especially in js-kit... @clemos what are you thoughts about that?
It would be great to unify what we got in abe/js-kit, and include the utils in js-kit, I mean @async is awesome: https://github.com/clemos/haxe-js-kit#asynchronous-programming-experimental
But will this end up in the deprecation of abenpm and js-kit, or will be keep going in one or the other?
Franco Ponticelli
@fponticelli
Jul 19 2015 20:37
I don't know :)
I am massively using abe so I am not very keen on giving up on it unless it is almost a transparent replacement
Andreas
@ciscoheat
Jul 19 2015 20:39
It should be, since you're following the hxnodejs conventions, and that's the intention of js-kit as well I think.