jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No install @types packages of devDependencies (Like the `flow-typed --ignoredeps-deps dev`)

arx-8 opened this issue · comments

commented

Thank you for this very useful tool!

Can I NOT install devDependencies's @types/* ?
Like the flow-typed --ignoredeps-deps dev.
https://github.com/flow-typed/flow-typed/tree/72d88e1dffd146f2f6fc1424bd7c9d991632cd3f#flow-typed-install-package-specification---ignoredeps-deps

For example

I don't want to install these.

  "devDependencies": {
    "eslint-config-prettier": "6.0.0",
    "prettier": "1.18.2"
  },

Reasons

  • I don't want to increase the number of managed packages.
  • Packages of devDependencies are not used in product code.
    • Because those @types/* are unnecessary.
  • (Maybe a little) These increase npm install time.

I thought about this earlier but I have a lot of dev deps for testing where I do want the typings, so I didn't add it.

An ignore flag would make sense, but why on earth is theirs called --ignoredeps-deps? Why "deps-deps"? That makes no sense to me.

commented

I understand.
Thank you for your explanations.

I’m not ruling it out 😀

If you still think it’ll be useful, it can happen. But can you explain to me why they call it ignoredeps-deps?

Came to discuss this too. The reasons provided by OP are good enough.

  • A new option/parameter can be introduced as -dep with options:
value description
prod production dependencies
dev development dependencies
peer peer dependencies
optional optional dependencies
  • By default ignore types for devDependencies?

  • Similarly an option could be introduced to install after syncing, e.g. -install

I think the default should remain to install typings for all dependencies. We've had the inverse problem of missing dependency sections before. The added installation time is negligible as typings packages have no deps, and in a production build they would be excluded anyway.

I'm not opposed to adding a flag to ignore certain sections. If we do this, it would be using an --ignore-style switch, but I want to know why Flow chose the name they did (--ignoredeps-deps, why the double deps? What's the meaning of it?)

I'm not going to add an install switch, because adding complexity in terms of figuring out which package manager to invoke, then invoking it and redirecting IO is is simply not worth it when you can simply do typesync && yarn or typesync && npm i. If you really want to, you can create an alias in your favorite shell. 😄

I think this flag is like:

--ignoredeps deps ignore dependencies, prod dependencies
--ignoredeps devdeps ignore dependencies, dev dependcies

i.e. ignoredeps is short for ignore dependencies and value shows which type (prod, dev, peer etc) of dependencies to ignore

Gotcha! I'm a bit swamped right now so not sure when I'll get to it.

commented

--ignoredeps-deps is just an example.
It does not mean that I want this OPTION name.

I think @mubaidr's (--ignoredeps) idea is a good!

the default should remain to install typings for all dependencies.

I agree.