Urigo / WhatsApp-Clone-Client-React

https://www.tortilla.academy/Urigo/WhatsApp-Clone-Tutorial

Home Page:https://tortilla.academy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NPM packages that should be devDependencies installed as dependencies

TVaakanainen opened this issue · comments

For example all @types-packages (e.g. @types/jest, @types/node, etc..)

Also typescript, react-scripts... and possibly others. Not quite yet through the full tutorial so I haven't taken a look at the full package.json

Hi @TVaakanainen , yes I thought so as well, but I decided to follow @gaearon 's advice and the create-react-app standard described here: facebook/create-react-app#4342 (comment)

Please let me know if you think we should still change this?

Well I'm not 100% certain which part of the answer/thread you mean.

The issue is about react-scripts not going into devDependencies, and the comment below one you linked mentions that the package does include polyfills that are going into build which I think is a bit problematic (if true) as I don't think the package name or details-text really convey this, so it could be surprising. But if this is the case that package semantically belongs into dependencies list instead of devDependencies.

However I think this is not the point you are driving for, and you are actually referring to the fact that as React apps, Angular apps, whatever apps, are actually built for production all of the dependencies are in a sense "devDependencies". So yes I think this is a valid point. However I personally prefer following the dependency/devDependency semantic as for me it makes it faster to scan app's package.json-file and see what it actually utilises in run-time when the semantic split is followed.

Also when there is a scenario when this split actually makes a difference (when you're actually developing Node-app) you're more likely to do it right when you're always following the practice :)

yes you got my point right.
I kind of feel similar to you, but reading @gaearon 's comments I actually like this approach for the following reasons:

  1. I don't like more things and concepts being in the developer's mind that are unnecessary or has no affect. I can definitely see beginner developers thinking that just because those dependencies are in devDependencies they should worry about them. minimalism makes sense there to me.
  2. I can also see discussions and time being spent on if specific libraries should be here or there without an actual affect on the app
  3. I think moving away from the standard approach on the React community (create-react-app) would at least need to be communicated upstream (into the thread I've shared) and get some feedback from them. Especially as I don't see something specially different between this project's approach and theirs

So I see 2 possible ways forward:

  1. You convince me why there should be a difference between us and create-react-app
  2. You convince create-react-app to bring devDependencies concept back

I hope my logic makes sense?

If not please feel free to reopen

Personally I think that they've made a wrong decision on create-react-app when they decided not to follow the NodeJS convention (as I think beginners might learn a wrong lesson here). However as it has been pointed out this is a minor difference, in a sense that it has no run-time effect, so this is not a hill I am prepared to die on, so I'm fine to go with your reasoning :)