-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose rendering module to provide terminal and web visualizati…
…ons through the API (#157) * refactor: move inmemory file-writer to fake namespace * Temp * refactor: expose webapp api * refactor: move everything related to terminal ui into src as an API * refactor: introduce Terminal API * refactor: unify terminal runners from cli or api * fix: tests * refactor: expose variants of the web application renderer * fix: tests * changeset: 0.34.0 * docs: document rendering module * ci * ignore benchmarks * fix: tests * fix: allow proper watch mode process interruption
- Loading branch information
1 parent
5ab375c
commit 0871131
Showing
48 changed files
with
1,441 additions
and
751 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
"skott": minor | ||
--- | ||
|
||
Expose a new rendering module providing a programmatic access to terminal and web visualizations through skott's API. | ||
|
||
This is equivalent to use the CLI such as `skott --displayMode=webapp` but offers more flexibility for the runtime configuration which suffers from limitations when only using the CLI (some configurations are nearly impossible to represent using strings e.g. providing custom functions), this is why often authors tend to introduce runtime configuration files that CLIs can pick up automatically, thing that we want to avoid with skott, by unifying it's usage either coming from the API or CLI. | ||
|
||
**Using the rendering module** | ||
|
||
```js | ||
import { defaultConfig } from "skott"; | ||
import { Web, Terminal } from "skott/rendering"; | ||
|
||
await Web.renderWebApplication( | ||
// skott runtime config | ||
defaultConfig, | ||
// application config | ||
{ | ||
visualization: { | ||
granularity: "module", | ||
}, | ||
watch: true, | ||
port: 1111, | ||
onListen: (port) => console.log(`Listening on port ${port}`), | ||
open: true, | ||
onOpenError: () => console.log(`Error when opening the browser`), | ||
} | ||
); | ||
|
||
await Terminal.renderTerminalApplication(defaultConfig, { | ||
displayMode: "graph", | ||
exitCodeOnCircularDependencies: 1, | ||
showCircularDependencies: true, | ||
showUnusedDependencies: true, | ||
watch: true, | ||
}); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.pnpm-debug.log | ||
.pnpm-store | ||
.pnpm-store | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.