NPM dependencies in keystone js
-
I can scroll for a good twenty seconds ...
-
@lucas1 It's representing a tree as a graph; no wonder it looks excessively large. (For example, I see
isarray@1.0.0
at least twice in there.)
-
@dkf This many dependencies worries me though, but it looks like there is decent separation between my code and the CMS code.
-
@lucas1 those are all dependencies of the test running framework.
-
@ben_lubar said in NPM dependencies in keystone js:
@lucas1 those are all dependencies of the test running framework.
He.... has a point. Indeed they are :)
-
@ben_lubar Those pictured maybe, but there was output of about 20 screens.
-
@dkf said in NPM dependencies in keystone js:
isarray@1.0.0
Ah leftpad thinking.
Array.isArray()
is builtin, unless you're supporting IE <9 (why). And even then, it's a oneliner check.
-
@coderpatsy said in NPM dependencies in keystone js:
@dkf said in NPM dependencies in keystone js:
isarray@1.0.0
Ah leftpad thinking.
Array.isArray()
is builtin, unless you're supporting IE <9 (why). And even then, it's a oneliner check."Array#isArray for older browsers"
-
@coderpatsy said in NPM dependencies in keystone js:
@dkf said in NPM dependencies in keystone js:
isarray@1.0.0
Ah leftpad thinking.
Array.isArray()
is builtin, unless you're supporting IE <9 (why). And even then, it's a oneliner check.isarray - Array#isArray for older browsers.
WTF why is it being used in an npm environment WTF WTF WTF
-
@sloosecannon It has client side JavaScript being a CMS
Trying to run it:
{ Error: Cannot find module '../build/Release/bson' at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/Luke/dev/test-site/node_modules/bson/ext/index.js:15:10) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/Luke/dev/test-site/node_modules/bson/lib/bson/index.js:3:24) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version
FFS I have no idea why this is failing ...
Why do people release things that are broken?
-
@lucas1 said in NPM dependencies in keystone js:
It has client side JavaScript being a CMS
Maybe, but it's showing up as a dependency for your testing framework. Why does a Node testing framework need isarray??? Node is not an "older browser"!
-
@sloosecannon fuck knows. TBH I am not that impressed because the NPM version is broken.
-
@sloosecannon It also needs is-number (version 2.1.0 no less).
-
I have a feeling that if JavaScript was a sane language, there wouldn't be such insane dependency graphs like this. Though part of it is also the desire to support older browsers.
-
@LB_ said in NPM dependencies in keystone js:
Though part of it is also the desire to support older browsers.
Because older browsers run a CMS. Got it.
-
@lucas1 said in NPM dependencies in keystone js:
Why do people release things that are broken?
That doesn't look broken, unless you count having a warning message printed to the client as broken. It's simply saying "oh look I can't find the native version so I'll run the purely interpreted version instead, carry on"
-
@dkf said in NPM dependencies in keystone js:
@LB_ said in NPM dependencies in keystone js:
Though part of it is also the desire to support older browsers.
Because older browsers run a CMS. Got it.
I was talking in a general sense.
-
I'm glad I read about this and leftpad before investing any time learning node. Thank you TDWTF.
-
@ben_lubar I just npm installed it so why didn't it install the module?
-
@lucas1 presumably because it isn't a hard requirement.
-
Okay. Well it seems to be working, it looks more like wordpress replacement than a proper CMS. I have no idea how to make a page.
-
@LB_ said in NPM dependencies in keystone js:
I have a feeling that if JavaScript was a sane language, there wouldn't be such insane dependency graphs like this.
You might be underestimating the amount of "developers" who just glue libraries together.
-
@asdf TBH a lot of the time I tend to do just that at home because it is quicker. At work I tend to have a different mindset, however if there is a complete and reliable lib to do something for me with an acceptable license, why not use it?
-
@lucas1 said in NPM dependencies in keystone js:
if there is a complete and reliable lib to do something for me with an acceptable license, why not use it?
There is always a risk associated with adding a dependency (security/stability/ease of debugging). Also, the project may be abandoned in the future and you may not have the resources to fork it and continue development or fix bugs. (A reasonably complete library is usually more complex than ad-hoc code you would have written yourself.)
This doesn't mean that you should reinvent the wheel, just make sure that every dependency you add is stable enough and worth that risk.
-
@asdf I use all libraries that can help me, but never would use something like leftpad or isarray.
-
@fbmac said in NPM dependencies in keystone js:
isarray
To be fair, it could be useful in situations like the one it was designed for (old browsers that don't support the standard method).
That's not what it's being used for here though.
-
@sloosecannon said in NPM dependencies in keystone js:
Why does a Node testing framework need isarray?
Because a lot of the test frameworks can do client-side and server-side both. Theyr'e full of polyfills, but you;re not supposed to install them in a prod environment anyway.
-
@asdf said in NPM dependencies in keystone js:
You might be underestimating the amount of "developers" who just glue libraries together.
It's better than writing everything from scratch and hoping you don't make any mistakes. Not all micro libraries are as bad as left-pad. IMO gluing libraries together is a great way to rapidly prototype software in the early stages - you don't need to worry too much about the details and can quickly find something that already does what you need. Then later you can vet your dependencies once you have settled on a design.
Though, I am not a web developer and have never touched a JavaScript framework in my life. I speak from prior experience with other software that worked in a similar manner (not related to webdev).
-
@asdf Yeh it has to a popular open source lib or it is backed by a well known company.
-
@lucas1 said in NPM dependencies in keystone js:
Why do people release things that are broken?
Open...
...
...
...
... source.
"Release early, release often, release broken".
-
Well after playing for a while it seems pretty decent so far, it isn't really a CMS it is more of a Content Management Framework.
-
@blakeyrat TBH I used some pretty shitty proprietary CMS systems that were broken.
-
@lucas1 Because if open source software is bad, proprietary software must logically be good. THIS IS HOW MENTAL THINKING WORKS.
-
@blakeyrat If you didn't want people to draw a false dichotomy from your comments, maybe you should have thought about explaining yourself slightly better.
TBH While looking for a simple CMS to build my website with, so far they have been all shite I am seriously thinking of building my own.
-
@lucas1 said in NPM dependencies in keystone js:
Why do people release things that are broken?
Cause all things released have to be made by people, and anything made by people will be broken.
-
@bb36e TBH It was more of a sigh because everything except for Wordpress is an utter pain the arse. I hate wordpress because developing for it is fucking horrible.
-
@sloosecannon What, did you think the Node Package Manager was only for Node packages?
That'd just be silly!
(Seriously, though, Bower is a JavaScript web package manager built on top of NPM.)
-
@powerlord said in NPM dependencies in keystone js:
Seriously, though, Bower is a JavaScript web package manager built on top of NPM
So it's a JavaScript package manager built on top of a JavaScript package manager?
That'd be like if NodeBB required another forum as a backend.
-
@ben_lubar said in NPM dependencies in keystone js:
@powerlord said in NPM dependencies in keystone js:
Seriously, though, Bower is a JavaScript web package manager built on top of NPM
So it's a JavaScript package manager built on top of a JavaScript package manager?
That'd be like if NodeBB required another forum as a backend.
Yes, crazy isn't it?
-
@powerlord It not really being used anymore and was only meant for front end stuff anyway. It isn't such a WTF tbh.
-
@LB_ said in NPM dependencies in keystone js:
It's better than writing everything from scratch and hoping you don't make any mistakes.
That depends on how complex the problem is that the library solves and whether you even need a general solution.
@LB_ said in NPM dependencies in keystone js:
IMO gluing libraries together is a great way to rapidly prototype software in the early stages
True, but prototypes end up becoming the final application way too often. Also, there are too many developers who think a great prototyping technique is also a great development technique.
-
@powerlord said in NPM dependencies in keystone js:
@sloosecannon What, did you think the Node Package Manager was only for Node packages?
That'd just be silly!
(Seriously, though, Bower is a JavaScript web package manager built on top of NPM.)
Yeah I use bower sometimes :)
-
@ben_lubar said in NPM dependencies in keystone js:
That'd be like if NodeBB required another forum as a backend.
Is that why we moved to NodeBB? Because the backend is actually Discourse so you could get all the props for the "difficult" forum migration while really just playing GW2 and flipping a switch for the front-end at the right moment?
-
@blakeyrat bad proprietary software should be unprofitable and disappear.
Unfortunately customers are morons and keep the wtf places I work for profitable
-
@asdf said in NPM dependencies in keystone js:
True, but prototypes always end up becoming the final application
way too often.FTFY
-
@blakeyrat said in NPM dependencies in keystone js:
Because if open source software is bad, proprietary software must logically be good. THIS IS HOW MENTAL THINKING WORKS
LOL. You must be mental if you think that, and/or you failed symbolic logic in college.
- P
- Not P implies asspull.
- Q. E. Dumb.
-
@coderpatsy That one bothered me so much I had to look up the source.
Why does
typeof
need "extensive tests"? NPM has a strange anti-NIH problem. Nothing can ever be invented here, ever, even the language itself (it must be wrapped in modules with extensive tests!)
-
@aapis But let us look inside and we will find:
var typeOf = require('kind-of'); module.exports = function isNumber(num) { var type = typeOf(num); if (type !== 'number' && type !== 'string') { return false; } var n = +num; return (n - n + 1) >= 0 && num !== ''; };
That belongs to the CodeSOD category, but it is most probably the fault of JS:
return (n - n + 1) >= 0 && num !== '';
"is-number" depends on another library:
"dependencies": { "kind-of": "^3.0.2" },
-
-
@aapis said in NPM dependencies in keystone js:
Why does
typeof
need "extensive tests"? NPM has a strange anti-NIH problem. Nothing can ever be invented here, ever, even the language itself (it must be wrapped in modules with extensive tests!)Ah, thanks to js's "fun" design, you can't just assume that any given typeof thing === 'object' will not be numeric. As a contrived example, (function () { return this; }).call(5) !== 5 unless you're running in strict mode. Same with new Number(5), and since this cares about numeric strings, new String(5).
A naive Number(thing) (or unary plus if you want) won't work either since Number([]) === 0.
Those edge cases are pretty much if they actually matter to your code though.