Skip to content
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

feat: use a common tsconfig for the monorepo #1297

Merged
merged 13 commits into from
Jul 2, 2020

Conversation

alexforsyth
Copy link
Contributor

@alexforsyth alexforsyth commented Jun 25, 2020

Issue #, if available:
#1026
Internal: JS-1866

Description of changes:

  1. Created a root tsconfig.json and root tsconfig.cjs.json and tsconfig.es.json.
  2. Each package extends the root tsconfig.cjs.json and root tsconfig.es.json in their local version. Those are themselves built from the historical tsconfig.json + tsconfig.test.json. The previous packages/*/tsconfig.json and packages/*/tsconfig.test.json have been removed.
  3. Each package also now generates two builds, one common (cjs) in ./build and one esnext (es) in ./build-es. Packages have also been updated to provide a build:es and a build:cjs command.
  4. Because we are now generating two builds the time to build should approximately double. This should not be too bad, as build time was greatly reduced in the previous PR: chore: faster build time #1285

FAQ:

  1. Why not have each package have its own tsconfig? Its been a huge pain and contributes to non standard packages if they do not all adhere to the same typescript standards. We've chosen to have a rot tsconfig.
  2. Okay, but why get rid of tsconfig in each package? Vscode looks at the closest tsconfig.json in the tree. In order for vscode to profile the repo correctly and code competition to work well, we need to have vscode profile stuff from the root, that means we need to keep the tsconfig there and remove it from closer places in the code tree.
  3. It looks like a lot of the packages share many attributes in their tsconfig.(cjs|es).json, is it possible to pull those options out? Yes - there are tons of shared options, but not too many that are in each and every single package. I'll be making some nice updates in future PRs that will enforce things like "noUnusedParameters": true, everywhere but to keep this PR reasonable i've chosen not to include them here.
  4. I see these changes do not apply to ./clients Correct. We cannot currently provide a common tsconfig for the generated clients. Smithy generates the tsconfig for us and does not provide a way to modify that tsconfig as part of generation. We also do not want smithy to explicitly extend a higher level tsconfig as that breaks encapsulation.

Experimental branch reference:
#1279

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2020

Codecov Report

Merging #1297 into master will increase coverage by 16.66%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1297       +/-   ##
===========================================
+ Coverage   73.04%   89.70%   +16.66%     
===========================================
  Files         287      151      -136     
  Lines       12730     3129     -9601     
  Branches     2922      576     -2346     
===========================================
- Hits         9299     2807     -6492     
+ Misses       3431      322     -3109     
Impacted Files Coverage Δ
...es/node-http-handler/src/stream-collector/index.ts 15.38% <0.00%> (-84.62%) ⬇️
...ode-http-handler/src/stream-collector/collector.ts 57.14% <0.00%> (-42.86%) ⬇️
...ventstream-serde-universal/src/getChunkedStream.ts 94.11% <0.00%> (-0.12%) ⬇️
packages/hash-node/src/index.ts 100.00% <0.00%> (ø)
packages/region-provider/src/fromEnv.ts 100.00% <0.00%> (ø)
packages/signature-v4/src/SignatureV4.ts 100.00% <0.00%> (ø)
packages/property-provider/src/memoize.ts 100.00% <0.00%> (ø)
packages/signature-v4/src/cloneRequest.ts 100.00% <0.00%> (ø)
packages/signature-v4/src/getPayloadHash.ts 100.00% <0.00%> (ø)
packages/credential-provider-node/src/index.ts 100.00% <0.00%> (ø)
... and 164 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a6e304...3ff565a. Read the comment docs.

@alexforsyth
Copy link
Contributor Author

@trivikr @AllanFly120 since this is my first major commit and it could cause some problems if I missed something, can you checkout the branch and make sure everything works and is solid on your local?

@alexforsyth alexforsyth changed the title Aforsyth/root tsconfig feat: use a common tsconfig for the monorepo Jun 25, 2020
tsconfig.json Outdated Show resolved Hide resolved
@trivikr
Copy link
Member

trivikr commented Jun 29, 2020

Verified that browsing across dependencies in packages/* is possible without building them

Screen recording

ezgif-6-93076c906776

Updated client-*

Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
@trivikr trivikr self-requested a review June 29, 2020 19:26
packages/abort-controller/package.json Outdated Show resolved Hide resolved
packages/abort-controller/package.json Outdated Show resolved Hide resolved
@trivikr
Copy link
Member

trivikr commented Jun 30, 2020

This PR needs rebase to include karma-credential-loader added in #1296

@trivikr trivikr self-requested a review July 1, 2020 19:38
Copy link
Member

@trivikr trivikr left a comment

Choose a reason for hiding this comment

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

One minor comment for removing build and build-es.

Also, it looks like karma-credential-loader is not rebased from master:

The changes would be required in karma-credential-loader too.

.gitignore Outdated Show resolved Hide resolved
@alexforsyth
Copy link
Contributor Author

One minor comment for removing build and build-es.

Also, it looks like karma-credential-loader is not rebased from master:

The changes would be required in karma-credential-loader too.

All done. My rebase screwed up so ended up just doing it in a merge. karma-credential-loader has changes propagated

Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
@alexforsyth alexforsyth requested a review from trivikr July 1, 2020 19:54
tsconfig.json Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
/**
* Nice to have:
*/
// "preserveConstEnums": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine if you uncomment it.😊

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't uncomment without massive changes across the repo. Lets address this in a followup

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 19, 2021
@trivikr trivikr deleted the aforsyth/root-tsconfig branch May 14, 2021 18:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants