Skip to content

Commit

Permalink
Merge pull request #103 from microsoft/tsconfig_doc
Browse files Browse the repository at this point in the history
TSConfig Reference Overview
  • Loading branch information
Orta committed Nov 4, 2019
2 parents 9405623 + d8d4511 commit 137e40a
Show file tree
Hide file tree
Showing 144 changed files with 2,891 additions and 1,625 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Website

on:
pull_request

jobs:
build:
runs-on: ubuntu-latest

steps:
# Check out, and set up the node/ruby infra
- uses: actions/checkout@v1
- uses: actions/setup-node@v1

# Get local dependencies
- run: yarn install
- run: yarn bootstrap
- run: yarn build

# PR: Deploy if we can
- name: Deploy PR Version
if: github.event_name == 'pull_request'
run: 'if test -z "$NOW_ACCESS_TOKEN"; then echo "Skipping deploy";
else npx now packages/typescriptlang-org/public/ --token="$NOW_ACCESS_TOKEN" --name="typescript-v2-$PR_NUMBER"; fi'
env:
NOW_ACCESS_TOKEN: ${{ secrets.NOW_ACCESS_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

# Run any tests
- run: yarn workspaces run test --ci
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,3 @@ typings/
# tdsx
dist

packages/typescriptlang-org/schema.json
packages/typescriptlang-org/apollo.config.js
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"printWidth": 120
}
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"files.exclude": {
"**/.rts2_cache*": true
}
}
},
"workbench.colorCustomizations": {
"activityBar.background": "#3178C6",
"activityBar.foreground": "#000000",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#ffffff",
"activityBarBadge.foreground": "#15202b"
},
"peacock.color": "#3178C6",
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repo uses [yarn workspaces][y-wrk], to get started clone this repo and run
git clone https://github.com/microsoft/TypeScript-website
cd TypeScript-website
yarn install
yarn bootstrap
code .
```

Expand All @@ -32,6 +33,10 @@ Then opening: http://localhost:1234 - which is the below package.

A create-react-app for working on the playground.

## TSConfig Reference

A set of tools and scripts for generating a comprehensive API reference for the TSConfig JSON file.

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
"husky": "^3.0.8"
},
"scripts": {
"bootstrap": "yarn build-tsconfig-reference-md",
"start": "yarn workspace typescriptlang-org start",
"build": "yarn workspace typescriptlang-org build",
"build-site": "yarn workspace typescriptlang-org build",
"build-tsconfig-reference-md": "yarn workspace tsconfig-reference build",
"build": "yarn build-tsconfig-reference-md && yarn build-site",
"clean": "yarn workspace typescriptlang-org gatsby clean",
"test": "yarn jest",
"playground": "concurrently -p \"[{name}]\" -n \"TS,WEB\" -c \"bgBlue.bold,bgMagenta.bold\" \"yarn workspace playground start\" \"yarn workspace playground-sandbox start\"",
Expand All @@ -24,7 +27,7 @@
},
"husky": {
"hooks": {
"pre-push": "git-branch-is v2 && yarn run clean && yarn run build"
"pre-push": "git-branch-is v2 && yarn run clean && yarn run build || echo 'skipping'"
}
}
}
2 changes: 2 additions & 0 deletions packages/examples/en/TypeScript/Language/Soundness.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//// { order: 1, compiler: { strictFunctionTypes: false } }

// Without a background in type theory, you're unlikely
// to be familiar with the idea of a type system being "sound".

Expand Down
5 changes: 3 additions & 2 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
"license": "MIT",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
"build": "parcel build index.html",
"test": "echo 'no tests'"
},
"dependencies": {
"react-app-polyfill": "^1.0.0"
},
"devDependencies": {
"@types/react": "^16.8.15",
"@types/react-dom": "^16.8.4",
"parcel": "^1.12.3",
"parcel": "^1.12.4",
"typescript": "^3.4.5"
}
}
18 changes: 9 additions & 9 deletions packages/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --env=jsdom",
"test": "echo 'no tests'; #tsdx test --env=jsdom",
"lint": "tsdx lint"
},
"peerDependencies": {
Expand All @@ -22,16 +22,16 @@
}
},
"devDependencies": {
"@types/jest": "^24.0.17",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.8.5",
"husky": "^3.0.4",
"@types/jest": "^24.0.18",
"@types/react": "^16.9.5",
"@types/react-dom": "^16.9.1",
"husky": "^3.0.8",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"tsdx": "^0.8.0",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"tsdx": "^0.9.3",
"tslib": "^1.10.0",
"typescript": "^3.5.3"
"typescript": "^3.6.3"
}
}
31 changes: 31 additions & 0 deletions packages/tsconfig-reference/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### Generating the TSConfig Reference

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`](./copy) folder.

## Contributing

To improve a single compiler option's documentation; all you need to do is go into the [`./copy`](./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.

## Contributing a new language

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.ts`](./scripts/createLanguage.ts) to set up a new language.

- Do you want to work on it incrementally? Create a new subfolder in `./copy` with 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.

## Building

The TSConfig reference is created by a two step process:

- Creating the JSON dump of all the useful info via [`./scripts/generateJSON.ts`](scripts/generateJSON.ts) which you can find in [`./data`](./data).

- A script which uses the JSON, and the copy to generate per-language markdown docs which are meant to be embedded inside webpages ``
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Additional Checks"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Advanced"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Basic Options"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Command Line"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Experimental"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Module Resolution"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Source Maps"
---

Additional Checks Copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Strict Checks"
---

Additional Checks Copy
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/allowJs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Allow JS"
---

Allow javascript files to be compiled.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Allow Synthetic Default Imports"
---

Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Allow Umd Global Access"
---

Allow accessing UMD globals from modules.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Allow Unreachable Code"
---

Do not report errors on unreachable code.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Allow Unused Labels"
---

Do not report errors on unused labels.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/alwaysStrict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Always Strict"
---

Parse in strict mode and emit "use strict" for each source file.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/baseUrl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Base Url"
---

Base directory to resolve non-absolute module names.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/charset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Charset"
---

The character set of the input files.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/checkJs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Check JS"
---

Report errors in .js files.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/composite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Composite"
---

Enable project compilation
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/declaration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Declaration"
---

Generates corresponding '.d.ts' file.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/declarationDir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Declaration Dir"
---

Output directory for generated declaration files.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/declarationMap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Declaration Map"
---

Generates a sourcemap for each corresponding '.d.ts' file.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/diagnostics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Diagnostics"
---

Show diagnostic information.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Disable Size Limit"
---

Disable size limitations on JavaScript projects.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Downlevel Iteration"
---

Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/emitBOM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Emit B O M"
---

Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Emit Declaration Only"
---

Only emit '.d.ts' declaration files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Emit Decorator Metadata"
---

Enables experimental support for emitting type metadata for decorators.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Es Module Interop"
---

Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Experimental Decorators"
---

Enables experimental support for ES7 decorators.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Extended Diagnostics"
---

Show verbose diagnostic information.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Force Consistent Casing In File Names"
---

Disallow inconsistently-cased references to the same file.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/importHelpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Import Helpers"
---

Import emit helpers from 'tslib'.
5 changes: 5 additions & 0 deletions packages/tsconfig-reference/copy/en/options/incremental.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Incremental"
---

Enable incremental compilation
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
display: "Inline Source Map"
---

Emit a single file with source maps instead of having a separate file.
Loading

0 comments on commit 137e40a

Please sign in to comment.