Skip to content

Commit

Permalink
docs: update api
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed May 13, 2024
1 parent 08ae72a commit 6b27f3a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ $ npx mwtsc --watch --project tsconfig.production.json --run ./bootstrap.js

You can use `mwtsc` API in your code to extend your own logic.

mwtsc API:

* `run` - run tsc compile
* `chokidar` - watch file change

run API:
* `exit` - exit process
* `restart` - restart process
* `onExit` - on exit event

```ts
// custom.js
const { run, chokidar } = require('mwtsc');
const { restart, exit, onExit, onRestart } = run();
const { restart, exit, onExit } = run();

const watcher = chokidar.watch('node_modules/**/*.ts', {
ignoreInitial: true,
Expand All @@ -53,7 +63,7 @@ Rewrite dev command in `package.json` .
```json
{
"scripts": {
"dev": "./custom.js --watch --run ./bootstrap.js"
"dev": "NODE_ENV=local node ./custom.js --watch --run ./bootstrap.js"
}
}
```

0 comments on commit 6b27f3a

Please sign in to comment.