-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds auto-remove types to plugin-typescript #99
Conversation
@@ -5,7 +5,9 @@ | |||
"dependencies": { | |||
"@berry/builder": "workspace:*", | |||
"@berry/core": "workspace:*", | |||
"@berry/plugin-essentials": "workspace:*" | |||
"@berry/plugin-essentials": "workspace:*", | |||
"@types/inquirer": "6.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the types be here? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types probably should be declared at the place the typeRoots
configuration is set. At the moment it's at the root of the repository.
@Vlasenko's work will likely remove the need for typesRoot
in the medium term, which would make it possible to store the types in each individual package.
Yep! The
I'd tend to say that we would always want to add it - it doesn't cost much to have too many
iirc the
Adding them to the
Sounds good to me 👍
Plugin tests are currently a bit weird.
|
const target = suggestUtils.Target.DEVELOPMENT; | ||
const typesName = getTypesName(descriptor); | ||
|
||
const ident = structUtils.makeIdent(`types`, typesName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I should use makeIdent
or something like structUtils.parseIdent(typesName)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use makeIdent
for names you generate; parseIdent
is mostly meant to be used with user input (like CLI parameters, for example).
I'm now checking |
One question I have regarding the goal of the PR - in my mind the |
I have the same question. I am basing the work on this comment:
🤔 Maybe when you add something like |
Well that's awkward since I wrote this line myself 😅 I probably didn't completely thought it through when I wrote it ... However the "auto-remove" part is useful, can you update your PR to only keep this part for now? Plus we sidestep the problem with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I'll merge it as it is, feel free to followup on the stringifyIdent
thing whenever you like (if you can add a test or two it would also be awesome 😃).
import {Hooks as EssentialsHooks} from '@berry/plugin-essentials'; | ||
import {suggestUtils} from '@berry/plugin-essentials'; | ||
|
||
const getDependencyName = (descriptor: Descriptor) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this probably should be structUtils.stringifyIdent
@arcanis I'm trying to implement a prompt for
plugin-typescript
but I have a ton of questions 😂Questions:
preferInteractive
insideafterWorkspaceDependencyAddition
hook? I've read in the plugin's README that ideally it should be usingpreferInteractive
to either prompt or not (if I'm understanding it correctly).preferInteractive
would we expect to only add@types
when prompted or would we also add them by default?EXACT
for@types
, is there a reason for that or should it be changed toCARET
?REGULAR
, would it make more sense to add it toDEVELOPMENT
? Or match thedependencyTarget
?afterWorkspaceDependencyRemoval
and remove types?command
not sure how to go about testing it 🤔. Could I potentially setup something similar to theadd
tests?