-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Build: Composite TypeScript setup #39786
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
package.json
Outdated
@@ -130,7 +130,7 @@ | |||
"test-server:coverage": "npm run -s test-server -- --coverage", | |||
"test-server:watch": "npm run -s test-server -- --watch", | |||
"translate": "i18n-calypso --format pot --output-file ./calypso-strings.pot -k translate,__,_x,_n,_nx -e date '**/*.js' '**/*.jsx' '**/*.ts' '**/*.tsx' '!build/**' '!packages/**/dist/**' '!public/**' '!**/test/**' '!node_modules/**' '!apps/full-site-editing/**' '!**/node_modules/**'", | |||
"typecheck": "tsc --noEmit", | |||
"typecheck": "NODE_OPTIONS='--max-old-space-size=4096' tsc --project client", |
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.
This is used in the typecheck-strict
check:
wp-calypso/.circleci/config.yml
Line 246 in b2a3ab3
command: npm run typecheck -- --project client/landing/gutenboarding |
which thus now reads, expanded:
> NODE_OPTIONS='--max-old-space-size=4096' tsc --project client "--project" "client/landing/gutenboarding"
So we probably need to add a dedicated script
to package.json and use it in the CCI config, or solve the problem there.
@@ -18,7 +18,7 @@ import MediaListStore from './list-store'; | |||
import MediaValidationStore from './validation-store'; | |||
|
|||
/** | |||
* @typedef MediaActions | |||
* @typedef IMediaActions |
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.
Noice! this fixes the tsc error that was crashing tsc
locally
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.
Yes, this could land on its own to fix the client. The tsc
error message was completely unhelpful and I'd speculated the problem was related to the client reorganization which I intended to address with these fixes, but along the way I found this was the issue 🙂
I believe this is a typings regression introduced in #39057 / #39048
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.
Pulled this into #39868
Edit: Ahh ok I see that's the intended behavior. |
@@ -243,7 +243,7 @@ jobs: | |||
- prepare | |||
- run: | |||
name: TypeScript strict typecheck of individual subprojects | |||
command: npm run typecheck -- --project client/landing/gutenboarding | |||
command: npm run tsc -- --project client/landing/gutenboarding |
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.
hmm are there other projects/directories that we should add here under typecheck-strict
? it's currently just doing gutenboarding
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.
Yeah, that was discussed when I originally added this section. My reasoning was that this enables us to gradually add other strictly-typechecked parts of Calypso -- I'm doing that e.g. in #39373 (which, granted, is just an experiment).
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 I understand all the nuance on this one, but it looks sane overall, and it's great to see the TypeScript check working again.
c3bab60
to
8b09672
Compare
.circleci/config.yml
Outdated
save-tsc-cache: &save-tsc-cache | ||
name: Save TypeScript cache | ||
key: v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-tsc-{{ .Branch }}-{{ .Revision }} | ||
key: v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-tsc-{{ .Branch }}-{{ .Revision }} | ||
paths: | ||
- ~/.tsc-cache |
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.
Interesting one here… for composite and incremental builds, I believe TypeScript skips outputting anything if the caches are up to date. We can add packages/*/dist
to the cache to catch and tsc
-build output.
- ~/.tsc-cache | |
- ~/.tsc-cache | |
- packages/*/dist |
Rebased |
4a1aa8f
to
8da8761
Compare
I've rebase and cleaned this up. I'd love another round of reviews! |
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.
The CI job is succeeding and the config changes make sense.
A thought about the tsBuildInfoFile
names: we're probably not going to have name collisions for gutenboarding
and composite-checkout-wpcom
, but components
and client
seem more common.
Should our pattern for choosing tsBuildInfoFile
be more path based? e.g. packages-components
, client-landing-gutenboarding
, etc.?
I thought we could use package name from package.json
since that should probably be unique, but not every tsconfig.json
has a package.json
e.g. gutenboarding
It's important to keep in mind that only projects that we're building here using the TypeScript compiler (
That's a find idea although I believe we're unlikely to run into issues with collisions unless we blatantly reuse a name. I'll add this change. |
89ff4ce
to
77704d9
Compare
Rebased and applied suggestions. With several approvals, I'll plan to move ahead with this soon unless there's any opposition. |
Changes proposed in this Pull Request
Testing instructions
typecheck
jobs are working well on CI.Closes #39659