Skip to content

Conversation

@wagenet
Copy link
Collaborator

@wagenet wagenet commented Jan 20, 2022

This will allow the version of typescript to be determined by whoever is using this.

@chriskrycho
Copy link

My suggestion (which I already suggested to @wagenet in a Discord DM, just noting here for posterity): go ahead and move TS to peerDependencies, as here, but also add a supported range of TS versions in CI.

@wagenet wagenet force-pushed the typescript-peer branch 6 times, most recently from efa8518 to 6fbf877 Compare January 24, 2022 23:52
@wagenet
Copy link
Collaborator Author

wagenet commented Jan 25, 2022

Unfortunately, I'm not sure how to fix these test failures.

"typescript": "^4.5.5"
},
"peerDependencies": {
"typescript": "^4.0.3"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wagenet I may be wrong, but this not gonna make any difference as still will install typescript@4.0.3 by npm 7+

It's technically the same as replacing "typescript": "~4.0.3" with "typescript": "^4.0.3".

To truly decouple typescript version from broccoli-typescript-compiler, maybe you meant to make this

"peerDependencies": {
    "typescript": "*"
},
"peerDependenciesMeta": {
  "typescript": {
    "optional": true
  }
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeAstapov ah, you may be correct.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that this means that, if a newer compatible version is installed, it will use that one. So this should be correct. I've been having some trouble validating it in practice either way.

@wagenet wagenet force-pushed the typescript-peer branch 2 times, most recently from a504267 to 2483596 Compare February 1, 2022 18:26
Copy link
Member

@chancancode chancancode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we assert that TypeScript is actually installed (with require.resolve maybe?) and that it actually matches the semver range we asked for, since peer dependencies are just a "recommendation" in multiple versions of NPM? (It would have failed anyway, but we can give a nicer error message)

Otherwise looks good

@chancancode
Copy link
Member

This probably needs to be a breaking change since you automatically get typescript from having this package before, and that no longer happens after this change. (Probably should update the install instructions as well)

@wagenet
Copy link
Collaborator Author

wagenet commented Feb 1, 2022

@chancancode sounds good.

@wagenet wagenet merged commit c8946af into master Feb 2, 2022
@wagenet wagenet deleted the typescript-peer branch February 2, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants