phetsims / chipper

Tools for developing and building PhET interactive simulations.
http://scenerystack.org/
MIT License
12 stars 14 forks source link

Delete tsconfig/all and replace it with a script like `grunt check --all` #1487

Closed samreid closed 1 month ago

samreid commented 1 month ago

tsconfig/all/tsconfig.json is liable to get stale, and we would like to be able to type check all without having to cd over there.

This will affect:

samreid commented 1 month ago

minor in progress patch (watch out for formatting)

```diff Subject: [PATCH] --- Index: chipper/tsconfig/all/tsconfig.json =================================================================== diff --git a/chipper/tsconfig/all/tsconfig.json b/chipper/tsconfig/all/tsconfig.json deleted file mode 100644 --- a/chipper/tsconfig/all/tsconfig.json (revision 425b1d053f0be663a0d366d21b06392e82d0dccf) +++ /dev/null (revision 425b1d053f0be663a0d366d21b06392e82d0dccf) @@ -1,566 +0,0 @@ -/** - * Explicitly list all entry points that we want to type check. - * Imported images/mipmaps/sounds are still type checked. - * This structure was determined in https://github.com/phetsims/chipper/issues/1245 - * @author Michael Kauzmann (PhET Interactive Simulations) - * @author Sam Reid (PhET Interactive Simulations) - */ -{ - "references": [ - { - "path": "../../../acid-base-solutions" - }, - { - "path": "../../../alpenglow" - }, - { - "path": "../../../aqua" - }, - { - "path": "../../../area-builder" - }, - { - "path": "../../../area-model-algebra" - }, - { - "path": "../../../area-model-common" - }, - { - "path": "../../../area-model-decimals" - }, - { - "path": "../../../area-model-introduction" - }, - { - "path": "../../../area-model-multiplication" - }, - { - "path": "../../../arithmetic" - }, - { - "path": "../../../atomic-interactions" - }, - { - "path": "../../../axon" - }, - { - "path": "../../../balancing-act" - }, - { - "path": "../../../balancing-chemical-equations" - }, - { - "path": "../../../balloons-and-static-electricity" - }, - { - "path": "../../../bamboo" - }, - { - "path": "../../../beers-law-lab" - }, - { - "path": "../../../bending-light" - }, - { - "path": "../../../binder" - }, - { - "path": "../../../blackbody-spectrum" - }, - { - "path": "../../../blast" - }, - { - "path": "../../../brand" - }, - { - "path": "../../../build-a-fraction" - }, - { - "path": "../../../build-a-molecule" - }, - { - "path": "../../../build-a-nucleus" - }, - { - "path": "../../../build-an-atom" - }, - { - "path": "../../../bumper" - }, - { - "path": "../../../buoyancy" - }, - { - "path": "../../../buoyancy-basics" - }, - { - "path": "../../../calculus-grapher" - }, - { - "path": "../../../capacitor-lab-basics" - }, - { - "path": "../../../center-and-variability" - }, - { - "path": "../../../chains" - }, - { - "path": "../../../charges-and-fields" - }, - { - "path": "../../../chipper" - }, - { - "path": "../../../circuit-construction-kit-ac" - }, - { - "path": "../../../circuit-construction-kit-ac-virtual-lab" - }, - { - "path": "../../../circuit-construction-kit-black-box-study" - }, - { - "path": "../../../circuit-construction-kit-common" - }, - { - "path": "../../../circuit-construction-kit-dc" - }, - { - "path": "../../../circuit-construction-kit-dc-virtual-lab" - }, - { - "path": "../../../collision-lab" - }, - { - "path": "../../../color-vision" - }, - { - "path": "../../../concentration" - }, - { - "path": "../../../coulombs-law" - }, - { - "path": "../../../counting-common" - }, - { - "path": "../../../curve-fitting" - }, - { - "path": "../../../density" - }, - { - "path": "../../../density-buoyancy-common" - }, - { - "path": "../../../description-demo" - }, - { - "path": "../../../diffusion" - }, - { - "path": "../../../dot" - }, - { - "path": "../../../eating-exercise-and-energy" - }, - { - "path": "../../../energy-forms-and-changes" - }, - { - "path": "../../../energy-skate-park" - }, - { - "path": "../../../energy-skate-park-basics" - }, - { - "path": "../../../equality-explorer" - }, - { - "path": "../../../equality-explorer-basics" - }, - { - "path": "../../../equality-explorer-two-variables" - }, - { - "path": "../../../estimation" - }, - { - "path": "../../../example-sim" - }, - { - "path": "../../../expression-exchange" - }, - { - "path": "../../../faradays-electromagnetic-lab" - }, - { - "path": "../../../faradays-law" - }, - { - "path": "../../../fluid-pressure-and-flow" - }, - { - "path": "../../../forces-and-motion-basics" - }, - { - "path": "../../../fourier-making-waves" - }, - { - "path": "../../../fraction-comparison" - }, - { - "path": "../../../fraction-matcher" - }, - { - "path": "../../../fractions-common" - }, - { - "path": "../../../fractions-equality" - }, - { - "path": "../../../fractions-intro" - }, - { - "path": "../../../fractions-mixed-numbers" - }, - { - "path": "../../../friction" - }, - { - "path": "../../../function-builder" - }, - { - "path": "../../../function-builder-basics" - }, - { - "path": "../../../gas-properties" - }, - { - "path": "../../../gases-intro" - }, - { - "path": "../../../gene-expression-essentials" - }, - { - "path": "../../../generator" - }, - { - "path": "../../../geometric-optics" - }, - { - "path": "../../../geometric-optics-basics" - }, - { - "path": "../../../graphing-lines" - }, - { - "path": "../../../graphing-quadratics" - }, - { - "path": "../../../graphing-slope-intercept" - }, - { - "path": "../../../gravity-and-orbits" - }, - { - "path": "../../../gravity-force-lab" - }, - { - "path": "../../../gravity-force-lab-basics" - }, - { - "path": "../../../greenhouse-effect" - }, - { - "path": "../../../griddle" - }, - { - "path": "../../../hookes-law" - }, - { - "path": "../../../interaction-dashboard" - }, - { - "path": "../../../inverse-square-law-common" - }, - { - "path": "../../../isotopes-and-atomic-mass" - }, - { - "path": "../../../john-travoltage" - }, - { - "path": "../../../joist" - }, - { - "path": "../../../keplers-laws" - }, - { - "path": "../../../kite" - }, - { - "path": "../../../least-squares-regression" - }, - { - "path": "../../../magnet-and-compass" - }, - { - "path": "../../../magnets-and-electromagnets" - }, - { - "path": "../../../make-a-ten" - }, - { - "path": "../../../masses-and-springs" - }, - { - "path": "../../../masses-and-springs-basics" - }, - { - "path": "../../../mean-share-and-balance" - }, - { - "path": "../../../mobius" - }, - { - "path": "../../../models-of-the-hydrogen-atom" - }, - { - "path": "../../../molarity" - }, - { - "path": "../../../molecule-polarity" - }, - { - "path": "../../../molecule-shapes" - }, - { - "path": "../../../molecule-shapes-basics" - }, - { - "path": "../../../molecules-and-light" - }, - { - "path": "../../../my-solar-system" - }, - { - "path": "../../../natural-selection" - }, - { - "path": "../../../neuron" - }, - { - "path": "../../../nitroglycerin" - }, - { - "path": "../../../normal-modes" - }, - { - "path": "../../../number-compare" - }, - { - "path": "../../../number-line-common" - }, - { - "path": "../../../number-line-distance" - }, - { - "path": "../../../number-line-integers" - }, - { - "path": "../../../number-line-operations" - }, - { - "path": "../../../number-pairs" - }, - { - "path": "../../../number-play" - }, - { - "path": "../../../number-suite-common" - }, - { - "path": "../../../ohms-law" - }, - { - "path": "../../../optics-lab" - }, - { - "path": "../../../pendulum-lab" - }, - { - "path": "../../../perennial" - }, - { - "path": "../../../perennial-alias" - }, - { - "path": "../../../ph-scale" - }, - { - "path": "../../../ph-scale-basics" - }, - { - "path": "../../../phet-core" - }, - { - "path": "../../../phet-io" - }, - { - "path": "../../../phet-io-sim-specific" - }, - { - "path": "../../../phet-io-test-sim" - }, - { - "path": "../../../phet-io-wrapper-haptics" - }, - { - "path": "../../../phet-io-wrappers" - }, - // { - // "path": "../../../phet-lib/tsconfig.json" - // }, - // { - // "path": "../../../phet-vite-demo/tsconfig.json" - // }, - { - "path": "../../../phetcommon" - }, - { - "path": "../../../phetmarks" - }, - { - "path": "../../../plinko-probability" - }, - { - "path": "../../../projectile-data-lab" - }, - { - "path": "../../../projectile-sampling-distributions" - }, - { - "path": "../../../projectile-motion" - }, - { - "path": "../../../proportion-playground" - }, - { - "path": "../../../quadrilateral" - }, - { - "path": "../../../quake" - }, - { - "path": "../../../quantum-measurement" - }, - { - "path": "../../../query-string-machine" - }, - { - "path": "../../../ratio-and-proportion" - }, - { - "path": "../../../reactants-products-and-leftovers" - }, - { - "path": "../../../resistance-in-a-wire" - }, - { - "path": "../../../rutherford-scattering" - }, - { - "path": "../../../scenery" - }, - { - "path": "../../../scenery-phet" - }, - { - "path": "../../../sherpa" - }, - { - "path": "../../../shred" - }, - { - "path": "../../../simula-rasa" - }, - { - "path": "../../../soccer-common" - }, - { - "path": "../../../solar-system-common" - }, - { - "path": "../../../sound-waves" - }, - { - "path": "../../../states-of-matter" - }, - { - "path": "../../../states-of-matter-basics" - }, - { - "path": "../../../studio" - }, - { - "path": "../../../sun" - }, - { - "path": "../../../tambo" - }, - { - "path": "../../../tandem" - }, - { - "path": "../../../tangible" - }, - { - "path": "../../../tappi" - }, - { - "path": "../../../trig-tour" - }, - { - "path": "../../../twixt" - }, - { - "path": "../../../under-pressure" - }, - { - "path": "../../../unit-rates" - }, - { - "path": "../../../utterance-queue" - }, - { - "path": "../../../vector-addition" - }, - { - "path": "../../../vector-addition-equations" - }, - { - "path": "../../../vegas" - }, - { - "path": "../../../vibe" - }, - { - "path": "../../../wave-interference" - }, - { - "path": "../../../wave-on-a-string" - }, - { - "path": "../../../waves-intro" - }, - { - "path": "../../../wilder" - }, - { - "path": "../../../xray-diffraction" - } - ] -} \ No newline at end of file Index: phet-info/checklists/delete-repo-checklist.md IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-info/checklists/delete-repo-checklist.md b/phet-info/checklists/delete-repo-checklist.md --- a/phet-info/checklists/delete-repo-checklist.md (revision 5277a2947ee7b8c5f1c669f9b3d878234cca4ef2) +++ b/phet-info/checklists/delete-repo-checklist.md (date 1728748016587) @@ -35,7 +35,6 @@ - [ ] If archiving, update the repo's README.md file to indicate why it is archived - [ ] Remove from github labels tracker/tool in phet-info (see its README) - [ ] Remove from `responsible_dev.json`. -- [ ] Remove from chipper/tsconfig/all/tsconfig.json (if present) We should explicitly state whether something needs to be done to delete the directory from aqua, build-server, and phettest, or whether these directories get automatically deleted, or just hang around forever with no consequences Index: phet-info/doc/typescript-quick-start.md IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-info/doc/typescript-quick-start.md b/phet-info/doc/typescript-quick-start.md --- a/phet-info/doc/typescript-quick-start.md (revision 5277a2947ee7b8c5f1c669f9b3d878234cca4ef2) +++ b/phet-info/doc/typescript-quick-start.md (date 1728748016568) @@ -38,13 +38,6 @@ "sounds/**/*", ``` -2. To add support for your repo to type-check along with the rest of the project add it - to `chipper/tsconfig/all/tsconfig.json`. - -```json -"../../../{{REPO}}/js/**/*" -``` - Congratulations! Now the repo is TypeScript-capable. You can commit these changes if you wish. ### Transpile TypeScript Index: phet-info/checklists/new-repo-checklist.md IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-info/checklists/new-repo-checklist.md b/phet-info/checklists/new-repo-checklist.md --- a/phet-info/checklists/new-repo-checklist.md (revision 5277a2947ee7b8c5f1c669f9b3d878234cca4ef2) +++ b/phet-info/checklists/new-repo-checklist.md (date 1728748016575) @@ -71,7 +71,6 @@ run `grunt update`. - [ ] Add the sim to [responsible_dev.json](https://github.com/phetsims/phet-info/blob/main/sim-info/responsible_dev.json). -- [ ] Add the sim to chipper/tsconfig/all/tsconfig.json - [ ] If applicable, add corresponding dependencies from `phetLibs` in package.json to "references" in tsconfig.json. ## Steps to create a different type of repo @@ -123,4 +122,3 @@ - [ ] If using IDEA/Webstorm (pre-2018), add the git source root for the repository. - [ ] Add the repo to [responsible_dev.json](https://github.com/phetsims/phet-info/blob/main/sim-info/responsible_dev.json). -- [ ] Add the repo to chipper/tsconfig/all/tsconfig.json Index: phet-info/checklists/rename-repo-checklist.md IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/phet-info/checklists/rename-repo-checklist.md b/phet-info/checklists/rename-repo-checklist.md --- a/phet-info/checklists/rename-repo-checklist.md (revision 5277a2947ee7b8c5f1c669f9b3d878234cca4ef2) +++ b/phet-info/checklists/rename-repo-checklist.md (date 1728748016581) @@ -15,7 +15,6 @@ - [ ] Change entry in [responsible_dev.json](https://github.com/phetsims/phet-info/blob/main/sim-info/responsible_dev.json). - [ ] If applicable, "refresh perennial" on phettest. -- [ ] Add the sim to chipper/tsconfig/all/tsconfig.json - [ ] Remove old repo directories in `chipper/dist/js`, `chipper/dist/declarations`, and `chipper/dist/js-cache-status.json` and and restart your transpiler. - [ ] Run `rm -rf {{OLD_REPO}}` from the phetsims directory ```
samreid commented 1 month ago

Update CTQ

```diff Subject: [PATCH] Update documentation, see https://github.com/phetsims/chipper/issues/1487 --- Index: js/server/QuickServer.js IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/js/server/QuickServer.js b/js/server/QuickServer.js --- a/js/server/QuickServer.js (revision 78273d1c68512c36d18c013eca0867d555f93ab8) +++ b/js/server/QuickServer.js (date 1728937518026) @@ -241,8 +241,7 @@ // Use the "node" executable so that it works across platforms, launching `tsc` as the command on windows results in ENOENT -4058. // Pretty false will make the output more machine readable. - return execute( 'node', [ '../../../chipper/node_modules/typescript/bin/tsc', '-b', '--pretty', 'false' ], - `${this.rootDir}/chipper/tsconfig/all`, EXECUTE_OPTIONS ); + return execute( gruntCommand, [ 'check', '--everything', '--pretty', 'false' ], `${this.rootDir}/chipper`, EXECUTE_OPTIONS ); } /**
samreid commented 1 month ago

Most usages updated. Still to do:

zepumph commented 1 month ago
zepumph commented 1 month ago

I cannot use the new check task in hook-pre-commit-task or absolute-tsc because it isn't a module, it has only been written in grunt/tasks/ thus far. We need to factor it out to a module for reuse.

https://github.com/phetsims/chipper/issues/1481 has been moved along enough to mark this off hold.

zepumph commented 1 month ago
zepumph commented 1 month ago

We are at a good point to check in about this.

the check module is the ground truth for all type checking. I would hope that we would never have to do anything outside of that file.

All that is left is:

samreid commented 1 month ago

@zepumph and I reviewed and made a minor change to the options. Things are generally ready for main, but we might batch with other changes?

Here are some tests that were done in the branches:

Tested and working: grunt check + many options, like --repo=..., --all, etc. run from many different repos pre commit hooks ctq running locally.

zepumph commented 1 month ago

We can close this issue after:

samreid commented 1 month ago

We notified the dev team, and I removed the deprecated files (after confirming there are no usages). Closing.