Skip to content

fix(npm-scripts): bundle TypeScript dependencies #114

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

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

wincent
Copy link
Contributor

@wincent wincent commented Oct 5, 2020

As reported here, our use of the @typescript-eslint/parser (since 50a4d99) means that we have a runtime dependency on typescript package. This worked fine in liferay-portal, where typescript is already present, but not in liferay-learn, where it is not. And I didn't know that @typescript-eslint/parser doesn't actually declare all of its transitive dependencies; as noted in #113, @typescript-eslint/typescript-estree does an unguarded import of typescript even though it is not declared in its dependencies (they declare it as an optional peer dependency).

So, let's not only fix this, by explicitly declaring our dependency on TypeScript, but also declare all of our TS-related dependencies. This will allow us to delete the devDependencies currently declared here.

@wincent
Copy link
Contributor Author

wincent commented Oct 5, 2020

Marking this one as a draft because it depends on #113 going in first.

Base automatically changed from wincent/ts-first-class-citizen to master October 5, 2020 09:41
@wincent wincent marked this pull request as ready for review October 5, 2020 09:41
@wincent
Copy link
Contributor Author

wincent commented Oct 5, 2020

I'm amazed that GitHub actually did something useful for once. As soon as I:

  1. Merged chore(eslint-config): mark typescript as a peer dependency #113
  2. Deleted the corresponding branch
  3. Took this out of draft

...it did this:

Screenshot 2020-10-05 -114138-TBSxlmZC@2x

Which is exactly what I wanted it to do... (not sure if it did it it after (1) or (2) or (3), but whatever).

blown-away

As reported here:

    #91 (comment)

Our use of the `@typescript-eslint/parser` (since 50a4d99) means
that we have a runtime dependency on `typescript` package. This worked
fine in liferay-portal, where `typescript` is already present, but not
in liferay-learn, where it is not. And I didn't know that
`@typescript-eslint/parser` doesn't actually declare all of its
transitive dependencies; as noted in:

    #113

`@typescript-eslint/typescript-estree` does an unguarded `import` of
`typescript` even though it is not declared in its dependencies (they
declare it as an optional peer dependency).

So, let's not only fix this, by explicitly declaring our dependency on
TypeScript, but also declare all of our TS-related dependencies. This
will allow us to delete the devDependencies currently declared here:

https://github.com/liferay/liferay-portal/blob/f1a2b2ce06fa050d5e1ab193728ab9ec06df4315/modules/apps/remote-app/remote-app-client-js/package.json#L3-L6
@wincent wincent force-pushed the wincent/ts-first-class-citizen-ii branch from 21b8e40 to 22765d7 Compare October 5, 2020 09:52
With `npx yarn-deduplicate yarn.lock`.
@wincent
Copy link
Contributor Author

wincent commented Oct 5, 2020

As this one is intimately related to the (merged/approved #113) I'm going to merge this one too.

@wincent wincent merged commit 9d365d9 into master Oct 5, 2020
@wincent wincent deleted the wincent/ts-first-class-citizen-ii branch October 5, 2020 10:28
wincent pushed a commit that referenced this pull request Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant