Skip to content

Commit

Permalink
docs: Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
roman.vasilev committed Aug 24, 2018
1 parent 68044bb commit 32e1449
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
typescript-service
===
# typescript-service
Language service which helps to get diagnostic messages from typescript source files.

## INSTALL
Expand All @@ -16,22 +15,25 @@ const diagnostics = service.getDiagnostics(fileName);
```

## API
```
createService({ configFile, compilerOptions })
```
`configFile` (required, string) Path to tsconfig.json file
`compilerOptions` (optional, Object) Compiler options to overwrite defined in tsconfig.json

#### createService({ configFile: string, compilerOptions?: ts.CompilerOptions })
* `configFile` (required, string) Path to tsconfig.json file
* `compilerOptions` (optional, Object) Compiler options to overwrite defined in tsconfig.json

Returns object with properties which are functions:

* `update({ fileName: string, fileContent?: string })` Update (add) information about file in typescript service
`fileName` (required, string) Path to typescript file
`fileContent (optional, string)` File content of this file
##### getSourceFile({ fileName: string, sourceText?: string })
Update (add) information about file in typescript service.
* `fileName` (required, string) Path to typescript file
* `sourceText` (optional, string) File content of this file

* `getDiagnostics(fileName: string): Array<ts.DiagnosticWithLocation>` Get diagnostic messages for `fileName`
`fileName` (required, string) Path to typescript file
##### getDiagnostics: (fileName: string, sourceText?: string): Array<ts.DiagnosticWithLocation>
Get diagnostic messages for `fileName`
* `fileName` (required, string) Path to typescript file
* `sourceText` (optional, string) If path outside of scope defined in tsconfig you need provide `sourceText`

* `getProgram(): ts.Program` Get `ts.Program`
##### getProgram(): ts.Program
Get `ts.Program`

## CHANGELOG
See [CHANGELOG.md](CHANGELOG.md)
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"clean": "rimraf dist",
"commit": "git-cz"
},
"dependencies": {},
"dependencies": {
"tslib": "^1.9.3"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.0",
"@semantic-release/git": "^7.0.2",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"importHelpers": true,
"declaration": false,
"outDir": "dist",
"removeComments": false,
"strict": true,
"sourceMap": true,
"lib": [
"esnext"
Expand Down

0 comments on commit 32e1449

Please sign in to comment.