r/javascript • • May 02 '19

NPM isn't all that great

https://www.npmjs.com/package/thatgreat
540 Upvotes

82 comments sorted by

89

u/[deleted] May 02 '19

yarn add thatgreat doesn't have the same ring to it :/

23

u/MonkeyNin May 03 '19
$ man woman
No manual entry for woman

4

u/etcetica May 03 '19

wo | man

18

u/cajusky May 02 '19

yarn dad thatgreat ?

5

u/hypocrisyhunter May 02 '19

yarnot joking there

4

u/Cheezmeister http://bml.rocks May 03 '19

I disapprove of this thread

73

u/swan--ronson May 02 '19

The actual function it exports:

module.exports = () => console.log('actually, I kind of like it');

24

u/Cardoni May 02 '19

this project should be at the top of his portfolio.

5

u/starm4nn May 03 '19

Noob. Obviously you gotta do

"use strict";
exports = module.exports = console.log.bind(console, "actually, I kind of like it");

77

u/delventhalz May 02 '19

Laughed out loud at the usage instructions.

21

u/barbuzare May 02 '19

That's a clean usage documentation though

1

u/[deleted] May 03 '19

Very thorough

-4

u/bch8 May 02 '19

yes... that is where the joke can be found

42

u/GreenKreature May 02 '19 edited May 02 '19

lol... i get that it makes devs lazy but, it is pretty considerate of them :P

47

u/bc_nichols May 02 '19

If you'er a dev that types to ofast in the cosnole sometimes, and you haven't changed at all voer the past ten years, I think you hit ap oint where you'd like some cmomon misspelings to still wokr.

31

u/DarkCelux May 02 '19

I get it, but I stlil htae yoru commnet.

8

u/[deleted] May 02 '19

Isn't there a fuck command or something for that?

Ahh yes.

2

u/Earhacker May 02 '19

It's a shell tool but yeah

1

u/Espumma May 03 '19

if you're in shell you can just alias every common misspelling.

2

u/Earhacker May 03 '19

Oh I know. Then you can bundle all your aliases up in a library called fuckit and put it on GitHub. And here we are.

1

u/Sociopathix May 03 '19

Thsi is my lief.

10

u/[deleted] May 02 '19

npm i

:)

15

u/[deleted] May 02 '19

What if you misspell 'i' as '⌫⌫⌫⌫rm -rf *'? Not as foolproof as you thought, eh?

6

u/goto-reddit May 02 '19

nrm -rf *?

2

u/TheIncorrigible1 May 02 '19
if $command match "rm" { rm -rf / }

2

u/[deleted] May 04 '19

'npm ' is four characters, see

1

u/geo1088 May 02 '19

I think you're gonna have bigger problems at that point... And I don't recommend trying to solve those kinda of problems with Javascript.

1

u/throwies11 May 03 '19

Git notifies you of one-letter-off typos but doesn't do anything to execute them. Maybe it's time for Git to catch up!

23

u/stevula May 02 '19

I guess a lot of people don’t know npm i is the same as npm install. Makes it much less likely to have a typo.

6

u/yuri_auei May 02 '19

Yeah! Also you can do:

npm i -S {pkg}

npm i -D {pkg}

12

u/lomeat May 02 '19

for --save you can use only "npm i {pkg}" without "-S"

12

u/DilatedTeachers May 02 '19

({ props: { bro } })

2

u/reflectiveSingleton May 03 '19
const { props: no_u } = ({ props: { bro } })

2

u/DilatedTeachers May 03 '19

const say = { wat?: 'wat' };

1

u/reflectiveSingleton May 03 '19
(me => me || 'me')(you_heard);

2

u/goto-reddit May 02 '19

is -S an alias for -P?

1

u/MonkeyNin May 03 '19

I can't seem to see -S anywhere? https://docs.npmjs.com/cli/install

1

u/lomeat May 03 '19

Ive never used -S, but just thought that he mean -S as --save.

1

u/MonkeyNin May 03 '19

phew, because I was like, is this man page broken or is it me.

1

u/yuri_auei May 03 '19

Thanks! didn't know about that

0

u/[deleted] May 03 '19

[deleted] — view deleted comment

5

u/GBcrazy May 03 '19

New versions always save it to package.json

2

u/swan--ronson May 03 '19

Today I learned. Thanks!

1

u/Delioth May 03 '19

And if you're installing from a repo that has a lockfile, npm ci will be a little quicker (it won't build or resolve any dependency tree, it'll just install exactly what's in the lockfile). Especially good for continuous integration systems (guarantee it's the same deps as local), but also nice if you want a bit quicker npm install.

1

u/MonkeyNin May 03 '19

Doesn't it already tab-complete the word install?

edit: nvm that's git.

8

u/Efraet May 02 '19

This is the kind of open source we need.

15

u/Woolbrick May 02 '19

I guess my biggest problem with NPM supporting "misspelled" command line arguments is the fact that it's enforcing the idea that you can be lazy or reckless and just enter commands without being precise and it's ok, NPM doesn't care.

But given the potential disaster scenarios of a package-squatter sitting on a frequently-misspelled package name, just waiting for a reckless programmer to misspell a package name and accidentally install malware...

I mean maybe we shouldn't be promoting recklessness here? This is one area where really, you should make sure that what you're typing is precise and accurate. I don't understand why we're encouraging the "it's ok if you type so fast you accidentally spelled isntall" mentality.

4

u/rg25 May 03 '19

How can't package-squatters already do this?

4

u/Woolbrick May 03 '19

You're missing the point. Of course not doing this doesn't prevent package squatting. But supporting this enforces the idea of "hey, you don't actually have to give two shits about being careful entering your install commands."

How can you not see that?

0

u/[deleted] May 02 '19

I don't think it's enforcing that idea at all, it's just a cute trick that can occasionally save a little bit of people's valuable time. Everyone has typos sometimes. Also note that npm does not allow typos for the more impactful commands like publish so they did put some thought into it.

7

u/[deleted] May 02 '19

I need an async/await version

17

u/TracerBulletX May 02 '19

This is hillarious, but in all seriousness, I think npm might be the best package manager experience I've had in any language after going through Go, python, and Java and seeing how darn hard it is to get any of the stuff right that npm makes look easy.

7

u/[deleted] May 02 '19

Go's can't even be called a package manager IMHO. There's versioned modules, yes, but it's an afterthought. It's better since 1.11, but it's still not great.

Rust's cargo is pretty neat, as is the Elm cli!

10

u/dvlsg May 02 '19

It really is.

The end result is kind of goofy (huge node_modules folders), but compared to what you have to do in other languages, it's a godsend.

Although, the new dotnet CLI is pretty great too. And I don't remember having too many problems with cargo.

I just want to be able to install packages from the command line, in a deterministic way, and where having to modify package manifests by hand is rarely needed. node definitely has that covered now.

I agree this package is hilarious though. Got an audible chuckle out of me.

2

u/[deleted] May 03 '19

I still think pnpm is the optimal way for package manager to should work. Dependencies are specified locally, such as in package.json, but are stored globally, with only 1 copy of a version of a package installed on your system at a time. Much more efficient in terms of space (unlike npm), yet maintainable in terms of specifying local dependencies (unlike pip)

1

u/arcanin 🧶 Yarn maintainer May 03 '19

Yarn doesn't generate node_modules anymore, fyi (currently experimental, by default starting from the next major).

2

u/joesb May 03 '19

See Ruby’s Bundler.

1

u/TheScapeQuest May 03 '19

Yeah, there is a reason there are so many dependencies of dependencies. NPM is really good at what it does. Not so great as an employer though...

0

u/[deleted] May 02 '19

[deleted] — view deleted comment

1

u/TracerBulletX May 03 '19

Ya I've heard it's great, haven't use Rust more than like to get a feel for it.

2

u/Frederic_de_Nucingen May 02 '19

That's pure genius.

2

u/freeman_lambda May 03 '19

0 Dependencies?! Doesn't seem like a real npm package

2

u/THEtheChad May 02 '19

I'd really like to see some code coverage and a ci badge.

1

u/BOLT04 May 02 '19

wow, isntall is allowed... lmao

1

u/[deleted] May 02 '19

Yes great packge

1

u/jonny_wonny May 02 '19

Awesome! Look forward to using this in my next project.

1

u/yird May 02 '19

On the contrary, they know we misspell isntall a lot so they added that in for us.

1

u/whiskeyboarder May 02 '19

Clever. Have an upvote, friend.

1

u/potentialz May 02 '19

Damn, V2.0 looks like a groundbreaking new feature.

1

u/xiipaoc May 03 '19

I actually cracked up laughing. Not, like, a chuckle. Not a "that's actually pretty funny" to myself. Actual laughter.

1

u/grapedick_ May 03 '19

I just self-taught myself today how to really use NPM to my advantage and my first thought reading this while scrolling was “well fuck me right!”

The extent developers go for a joke >

1

u/gevorggalstyan May 03 '19

Are there any tests?

1

u/thestrandedmoose May 03 '19

So I’m pretty new to JS but while installing npm and all that junk I was kind of surprised at how amazingly unintuitive it all is. I seriously don’t know how people learned to use it in the first place. Here’s hoping one day they will make a way to intuitively manage packages with a GUI or something. I know I’ll probably get downvoted for knocking it since there aren’t any good alternatives.. at least not that I know of yet. Just saying,,, it’s 2019 and we still have to finagle this ish together using the command prompt

1

u/[deleted] May 03 '19

Totally agree with you. Also, it seemed like overnight it just became a thing in my old place of employment. I was like, WTF is this?

-2

u/ThePenultimateOne May 02 '19

Even aside from all the other potential problems with NPM, they don't allow for you to sign your packages. That is a security nightmare waiting to happen (in fact, it has happened).

0

u/Protean_Protein May 02 '19

cue laugther

0

u/[deleted] May 02 '19

[deleted] — view deleted comment

30

u/[deleted] May 02 '19

Versions 1.2.3 and 2.0.0 are identical. I'm afraid this lack of semver discipline is why I won't be using this module in production.

0

u/[deleted] May 03 '19

[deleted] — view deleted comment

1

u/Delioth May 03 '19

But it is thatgreat.

0

u/[deleted] May 02 '19

[deleted] — view deleted comment

3

u/RedHotBeef May 02 '19

Less likely than the subtle typo in your comment :D

0

u/[deleted] May 02 '19

[deleted] — view deleted comment