bower and many other npm packages, has some dependencies that eventually depends on a package called "wordwrap".
And this "wordwrap" package somehow has its test folder exposed in npm.
The result:
Every single person using bower would have one or more copies of In Praise of Idleness by Bertrand Russell on your local machine, depending on how many of your projects has a npm dependency of this package:
I used to `touch node_modules/.metadata_never_index` to prevent Spotlight from wasting disk cycles by indexing that stupid folder. After searching "In Praise of Idleness", it doesn't seem to prevent it. :/
Anyone knows how to prevent all node_modules folders from getting indexed by Spotlight?
This person is counting the node_modules directory. While JS is a bit insane and this directory will have a ridiculous number of files, they are concerned:
"because my deployment (google app engine) allows only 10K files"
meaning, they don't realize that node_modules is for development and not related to the application they would actually deploy.
Hope this comment stays at the top before all the "wow JS sucks!!!" people arrive :-) Though to be fair a "modern" JS dev environment does use a ton of stuff!
IIRC Angular 2 production builds are actually pretty efficient.
> and not related to the application they would actually deploy.
this.
Granted, it's the same with everything- if you expanded every compressed file and counted every class, most languages and frameworks would just be incredibly nuts, because all of them aren't needed.
But, something could be done about that; you could better differentiate what is there for convenience, and what needs to be there and make the developer more aware of what they are using. It can make development more difficult if done poorly, but good examples of minimalist development are out there, e.g. Sinatra and similar frameworks that said X is too much- just use this.
I started working with Laravel not long ago and found my project folder had 24,000+ files in it. And those don't compile down before you deploy... it makes me feel like I'm working on the tip of an unstable iceberg. Who the hell knows what's going on down there. No one person could possibly hope to know what it all actually does.
babel 6 with jsx transformer used to install a comparable number of files due to module duplication. At one point it was a 100M install with some modules being duplicated 45 times. Much of this was the fault of npm 2. But with latest babel and npm 3 it's now a 35M install with 5700 files over 814 directories. I guess that's considered lean by modern standards.
I've switch from babel 6 to buble recently. buble runs three times faster and its install size is 4.6M with 212 files over 39 directories. The install of buble is literally just "npm install buble" and it runs out of the box without configuration. Competition is a good thing.
Just because of the way npm2 ordered the dependencies, the runtime of babel got incredibly slow [1]. Npm3 fixed that drastically, but I wonder how much is still wasted just because of navigating the file tree to the dependencies.
Is there a "distribution" bundle convention for npm ? Analogous to static linking, it would be one .js file that would bind all dependencies into a bundle (e.g. gulp.dist.js) . In that case you would end up with a much smaller number of dependency files to manage.
There is for your final output (meaning the stuff you would upload to the server and serve to the user). but not for the development.
IMO it's a pretty big anti-pattern to do that. It just hides the problem of managing dependencies (see, it's not 10,000 files, it's just one!), but doesn't fix any of the issues associated with it.
Keeping each dependency small, and having tons of them means that deduplication can work better, tree shaking works better, and it lets you do things like swapping out one package for another with the same API.
Because package-lookup and the package manager are 2 completely separate systems in javascript.
When you `require` or `import` a file in node.js, it looks for a node_modules and looks for that name in there. If it can't find it there, it starts walking up the directory tree until it finds something it can use (to a point).
This is hardcoded and will be extremely difficult to change without a crazy amount of breaking.
The package manager is free to install however, but it needs to put things where the package-lookup can find them.
At first glance, I thought the title was "Huge NO: on files for Angular 2" - a vulnerability report on filesystem capabilities of Angular 2 and why it should be abandoned
Has npm finally figured out how to de-dupe dependencies? In one project, I have something like 47 copies of the same version of the same library, distributed at all levels of the node_modules hierarchy.
I try not to think about that JS tooling too hard, lest I start pulling my hair out and devolve into a screaming crazy person.
Both a and b depend on c version 1.0.0, but since there's a version 2.0.0 in the root node_modules folder c can't be placed there, and has to be duplicated in a and b's own node_modules folder, otherwise Node couldn't find it for each of them.
To me it looks like a silly architectural mistake made by NPM/Node developers, considering that there's already pretty good dependency management solution on the market that does the things right.
Maven repositories have following structure, that allows to avoid duplication and take versions into account:
/<vendor namespace>/<library>/<version>/<library artifact.ext>
Vendor namespace itself is hierarchical and usually related to domain name, e.g. "com/mycompany/myapp".
No idea, why this approach is not yet used in JS world (except the webjars), but it's high time to fix it this way.
My results of the hello world tutorial in Angular2 was 53 requests, 4933.49KB, and loaded in 1.74s on local dev, according to browser dev tools. All for one html file that had one h1 element.
Plus, it started out broken. I had to search elsewhere to find the solution to the error the tutorial produced.
[+] [-] paradite|9 years ago|reply
bower and many other npm packages, has some dependencies that eventually depends on a package called "wordwrap".
And this "wordwrap" package somehow has its test folder exposed in npm.
The result:
Every single person using bower would have one or more copies of In Praise of Idleness by Bertrand Russell on your local machine, depending on how many of your projects has a npm dependency of this package:
https://github.com/substack/node-wordwrap/blob/master/test/i...
Don't believe me? Try searching for "In Praise of Idleness" in Spotlight.
Edit: Someone had already sent a PR about this on GitHub: https://github.com/substack/node-wordwrap/pull/14
[+] [-] pjc50|9 years ago|reply
[+] [-] aaronharnly|9 years ago|reply
[+] [-] zuck9|9 years ago|reply
Anyone knows how to prevent all node_modules folders from getting indexed by Spotlight?
[+] [-] heydenberk|9 years ago|reply
[+] [-] sotojuan|9 years ago|reply
[+] [-] percept|9 years ago|reply
[+] [-] manimalcruelty|9 years ago|reply
[+] [-] justinsaccount|9 years ago|reply
"because my deployment (google app engine) allows only 10K files"
meaning, they don't realize that node_modules is for development and not related to the application they would actually deploy.
[+] [-] sotojuan|9 years ago|reply
IIRC Angular 2 production builds are actually pretty efficient.
[+] [-] DHMO|9 years ago|reply
this.
Granted, it's the same with everything- if you expanded every compressed file and counted every class, most languages and frameworks would just be incredibly nuts, because all of them aren't needed.
But, something could be done about that; you could better differentiate what is there for convenience, and what needs to be there and make the developer more aware of what they are using. It can make development more difficult if done poorly, but good examples of minimalist development are out there, e.g. Sinatra and similar frameworks that said X is too much- just use this.
[+] [-] agconti|9 years ago|reply
[+] [-] huuu|9 years ago|reply
[+] [-] royka118|9 years ago|reply
http://royka.github.io/2016/05/03/front-end-deps.html
[+] [-] k__|9 years ago|reply
[+] [-] keeganjw|9 years ago|reply
[+] [-] ishener|9 years ago|reply
[+] [-] j_jochem|9 years ago|reply
[+] [-] stupidcar|9 years ago|reply
Try exploding every Jar in the JDK and counting how many class files and resources there are.
[+] [-] moderndeveloper|9 years ago|reply
[+] [-] moderndeveloper|9 years ago|reply
[+] [-] maaaats|9 years ago|reply
[1]: https://github.com/babel/babelify/issues/206
[+] [-] currywurst|9 years ago|reply
[+] [-] Klathmon|9 years ago|reply
IMO it's a pretty big anti-pattern to do that. It just hides the problem of managing dependencies (see, it's not 10,000 files, it's just one!), but doesn't fix any of the issues associated with it.
Keeping each dependency small, and having tons of them means that deduplication can work better, tree shaking works better, and it lets you do things like swapping out one package for another with the same API.
[+] [-] jbverschoor|9 years ago|reply
SHARED_DIR/npm_modules/NAME/VERSION
[+] [-] Klathmon|9 years ago|reply
When you `require` or `import` a file in node.js, it looks for a node_modules and looks for that name in there. If it can't find it there, it starts walking up the directory tree until it finds something it can use (to a point).
This is hardcoded and will be extremely difficult to change without a crazy amount of breaking.
The package manager is free to install however, but it needs to put things where the package-lookup can find them.
[+] [-] inaccessible|9 years ago|reply
[+] [-] fernandopj|9 years ago|reply
[+] [-] douche|9 years ago|reply
I try not to think about that JS tooling too hard, lest I start pulling my hair out and devolve into a screaming crazy person.
[+] [-] rplnt|9 years ago|reply
[+] [-] Touche|9 years ago|reply
[+] [-] DCoder|9 years ago|reply
[0]: https://docs.npmjs.com/how-npm-works/npm3-dupe
[1]: https://docs.npmjs.com/how-npm-works/npm3-nondet
[+] [-] k__|9 years ago|reply
[+] [-] ivan_gammel|9 years ago|reply
Maven repositories have following structure, that allows to avoid duplication and take versions into account: /<vendor namespace>/<library>/<version>/<library artifact.ext>
Vendor namespace itself is hierarchical and usually related to domain name, e.g. "com/mycompany/myapp".
No idea, why this approach is not yet used in JS world (except the webjars), but it's high time to fix it this way.
[+] [-] guigar|9 years ago|reply
[+] [-] andrewclunn|9 years ago|reply
[+] [-] talmand|9 years ago|reply
Plus, it started out broken. I had to search elsewhere to find the solution to the error the tutorial produced.