Add docs to run it locally

Orta Therox
2019-12-15 11:17:52 +00:00
parent 8cd7bd4ae7
commit 61446a8e81
4 changed files with 48 additions and 13 deletions

7
.vscode/settings.json vendored Normal file

@@ -0,0 +1,7 @@
{
"[markdown]": {
"editor.rulers": [
80
],
}
}

@@ -6,6 +6,40 @@ in a GitHub Action in [`.github/workflows/sync.yml`](.github/workflows/sync.yml)
The wiki root is [Home.md](./Home.md).
You can run this locally if you have ruby installed via:
```sh
# Install the deps
gem install gollum
# Start the server
gollum
```
Then you can open: `http://localhost:4567`
Things to remember:
- Wikis don't support nesting, so filenames have to get a bit wild
```diff
- compiler/testing/fourslash.md
+ compiler-testing-fourslash.md
```
- You can use a custom link syntax for references to TypeScript code which will
be looked up at deploy time:
```
link to [`runFourSlashTest`][0]
[0]: <src/harness/fourslash.ts - function runFourSlashTest(>
```
Will look at the file `src/harness/fourslash.ts` in microsoft/TypeScript to
find the line of code `function runFourSlashTest` and provide a direct link
in the wiki. You can audit them via the script `npm run lint`.
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a

@@ -1,5 +1,6 @@
## Getting set up
First you'll need to install TypeScript ==1.4 from `npm`.
First you'll need to install TypeScript 1.4 from `npm`.
> #### For API Samples compatible with **TypeScript >= 1.5** please see [[Using the Compiler API]]
@@ -387,4 +388,4 @@ function format(text: string) {
var code = "var a=function(v:number){return 0+1+2+3;\n}";
var result = format(code);
console.log(result);
```
```

@@ -8,7 +8,7 @@ First you'll need to install TypeScript >=1.6 from `npm`.
Once that's done, you'll need to link it from wherever your project resides.
If you don't link from within a Node project, it will just link globally.
```
```sh
npm install -g typescript
npm link typescript
```
@@ -16,7 +16,7 @@ npm link typescript
You will also need the node definition file for some of these samples.
To acquire the definition file, run:
```
```sh
npm install @types/node
```
@@ -450,10 +450,7 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(
diagnostic.start!
);
console.log(
` Error ${diagnostic.file.fileName} (${line + 1},${character +
1}): ${message}`
);
console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character +1}): ${message}`);
} else {
console.log(` Error: ${message}`);
}
@@ -464,10 +461,7 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) {
// Initialize files constituting the program as all .ts files in the current directory
const currentDirectoryFiles = fs
.readdirSync(process.cwd())
.filter(
fileName =>
fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"
);
.filter(fileName => fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts");
// Start the watcher
watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
@@ -640,7 +634,6 @@ function generateDocumentation(
// Get the checker, we will use it to find more about classes
let checker = program.getTypeChecker();
let output: DocEntry[] = [];
// Visit every sourceFile in the program