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

List all transitive dependencies for each tsconfig #1245

Closed
samreid opened this issue May 7, 2022 · 12 comments
Closed

List all transitive dependencies for each tsconfig #1245

samreid opened this issue May 7, 2022 · 12 comments

Comments

@samreid
Copy link
Member

samreid commented May 7, 2022

As described in microsoft/TypeScript#46153, project references are designed so that if a project imports from another project, it should be listed in the direct references (not transitively). According to the issue, that could address the false positives and false negatives we have been seeing.

This would be an alternative to the monolithic (one file/no project references) strategy or having to clean each time as described in #1243 (comment).

@samreid
Copy link
Member Author

samreid commented May 11, 2022

I did not see an existing lint rule that could help enforce this new requirement. I checked the rules at https://www.npmjs.com/package/eslint-plugin-import. I don't see an easy way to automatically update the tsconfig files from existing imports. Maybe we would write our own lint rule that checks that any import has a direct listing in references? But we would want to make sure that works for tsconfig.json and tsconfig-module.json. If we write our own lint rule, it would flag as an error at the import site, but really it would probably indicate that a project reference needs to be added to references.

It seems it would be much simpler to adopt the monolithic tsconfigs as described in #1243 (comment). As far as I understand, those have the following disadvanatges:

  • Up front cost to specify the monolithic tsconfig files
  • Monolithic seems slower at detecting "there are no changes", taking 5 sec instead of 1 sec, see Prune tsconfig/all/tsconfig.json #1241
  • The proposed monolithic scheme specifies sim mains as entry points and would skip files that are never imported. (workaround is to import those files or add them as entry points).

Project references are indicated for modularity and speed, but are causing more complications.

Maybe it would be good to touch base at dev meeting before spending more time on this.

@samreid samreid removed their assignment May 11, 2022
@samreid
Copy link
Member Author

samreid commented May 12, 2022

In today's discussion, we agreed we would like to explore the monolithic tsconfig approach, but having **/* to capture every entry point. These will replace the project-references versions. Not sure if we should keep those around in case we go back to them in the future.

@zepumph wants to time **/* and see how it goes before changing everything.

@samreid samreid self-assigned this May 12, 2022
@samreid
Copy link
Member Author

samreid commented May 13, 2022

On my macbook air, the timing is like:

Case Initial (sec) Incremental/no changes (sec)
Geometric Optics 4.987 1.570
tsconfig/all 13.983 5.403
tsconfig/all (no images/mipmaps/sounds) 11.106 3.100

In experimenting with using tsc in my workflow, I felt like 3.1 was a good enough improvement over 5.4 that I feel like commenting out the data-oriented files images/mipmaps/sounds, at least from the all file.

I thought our tooling would need to change, but it turns out running -b in a non-composite project has the same behavior as running without -b. So that step doesn't seem technically mandatory.

@samreid
Copy link
Member Author

samreid commented May 13, 2022

From review with @zepumph:

  • Seems promising and much simpler, easier to maintain. Will likely solve the "false positives and false negatives" issues.

Next steps

  • Add a comment to the sim/common repo tsconfigs that say "this was autogenerated", and autogenerate with grunt update. Maybe even other repos without grunt update, like aqua.
  • Update tooling so we aren't using -b

We also agreed that this seems like an improvement and we can commit/push and work on the improvements above as next steps.

  • Use "excludes node_modules" and build/ instead of "includes js, images, mipmaps, etc.". UPDATE

My experience from writing transpiler.js was that it was much more efficient to specify the entry points where we expect code. Instead if a repo has other needs, it could be listed in package.json.

  • Maybe add all repos, but use "include" pattern "*.ts"?

We have to keep allowJS: true listed in tsconfig for type checks to work, since our TS code calls into JS code. Maybe that would work to set the entry points though? Also, I'm concerned this will explode our type check times.

  • Autogenerate the all/tsconfig too?

Would this be a new grunt task?

samreid added a commit to phetsims/axon that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-model-common that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-model-algebra that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-model-introduction that referenced this issue May 13, 2022
samreid added a commit to phetsims/acid-base-solutions that referenced this issue May 13, 2022
samreid added a commit to phetsims/arithmetic that referenced this issue May 13, 2022
samreid added a commit to phetsims/build-a-molecule that referenced this issue May 13, 2022
samreid added a commit to phetsims/balancing-chemical-equations that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-model-decimals that referenced this issue May 13, 2022
samreid added a commit to phetsims/atomic-interactions that referenced this issue May 13, 2022
samreid added a commit to phetsims/aqua that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-builder that referenced this issue May 13, 2022
samreid added a commit to phetsims/brand that referenced this issue May 13, 2022
samreid added a commit to phetsims/beers-law-lab that referenced this issue May 13, 2022
samreid added a commit to phetsims/balancing-act that referenced this issue May 13, 2022
samreid added a commit to phetsims/balloons-and-static-electricity that referenced this issue May 13, 2022
samreid added a commit to phetsims/area-model-multiplication that referenced this issue May 13, 2022
samreid added a commit to phetsims/blackbody-spectrum that referenced this issue May 13, 2022
samreid added a commit to phetsims/shred that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/trig-tour that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/wilder that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/wave-interference that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/vector-addition that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/states-of-matter that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/tappi that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/tandem that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/sun that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/waves-intro that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/twixt that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/states-of-matter-basics that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/soccer-common that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/under-pressure that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/vector-addition-equations that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/xray-diffraction that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/vibe that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/tangible that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/vegas that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/utterance-queue that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/unit-rates that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/phet-lib that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/scenery that referenced this issue Nov 29, 2023
samreid added a commit to phetsims/energy-skate-park that referenced this issue Nov 29, 2023
@samreid
Copy link
Member Author

samreid commented Nov 29, 2023

I removed the stale code comment, closing.

@samreid samreid closed this as completed Nov 29, 2023
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid added a commit to phetsims/perennial that referenced this issue Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants