This "package" hosts multi-lingual docs for the TSConfig. As much as possible is based
off pulling data from require("typescript") then augmented with markdown from inside the
./copy folder.
Roughly:
TypeScript Compiler + `tsconfigRules.ts` -> `generateJSON.ts` -> JSON (in output) -> `generateMarkdown.ts` -> Markdown (in output)This happens per-language with fallbacks to English for any missing docs.
To improve a single compiler option's documentation; all you need to do is go into the ./copy folder and
edit the page option in markdown and send a PR. No need to leave GitHub.
Then, during a deploy, all of the markdown files are bundled together and any merged changes are uploaded.
If you'd like to create a new language:
-
Do you plan on making an evening or two on it and go all out? then you can use the script
./scripts/createLanguage.tsto set up a new language. -
Do you want to work on it incrementally? Create a new subfolder in
./copywith your language code and then make sure the files you work on have the same name as English and your changes will overwrite the English version.
The TSConfig reference is created by a two step process:
- Creating the JSON dump of all the useful info via
./scripts/generateJSON.tswhich you can find in./data. - A script which uses the JSON, and the copy to generate per-language markdown docs which are picked up by the typescriptlang-org Gatsby site at
http://localhost:8000/tsconfig
You can run these commands from the root of the repo:
yarn workspace tsconfig-reference run generate-json
yarn workspace tsconfig-reference run generate-markdownYou can validate any codeblocks which use twoslash via the script:
yarn workspace tsconfig-reference run test
# or to just run the linter without a build
yarn workspace tsconfig-reference run lint
# or to just one one linter
yarn workspace tsconfig-reference run lint resolveJsonYou can debug twoslash by setting the environment var DEBUG="*" in all of these too.