@livon/cli 0.27.0-rc.5 → 0.29.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -19
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/dist/index.cjs +226 -380
- package/dist/index.js +193 -340
- package/package.json +35 -32
- package/dist/mini/index.cjs +0 -5
- package/dist/mini/index.d.ts +0 -1
- package/dist/mini/index.js +0 -5
- /package/{LICENCE.md → LICENSE.md} +0 -0
package/README.md
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
|
+
<!-- Generated from website/docs/packages/*.md. Do not edit directly. -->
|
|
2
|
+
|
|
1
3
|
# @livon/cli
|
|
2
4
|
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@livon/cli)
|
|
7
|
+
[](https://libraries.io/npm/%40livon%2Fcli)
|
|
8
|
+
[](https://github.com/live-input-vector-output-node/livon-ts/actions/workflows/publish.yml)
|
|
9
|
+
[](https://www.bestpractices.dev/projects/12249)
|
|
10
|
+
[](https://snyk.io/test/npm/@livon/cli)
|
|
11
|
+
[](https://www.npmjs.com/package/@livon/cli)
|
|
12
|
+
[](https://www.npmjs.com/package/@livon/cli)
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
|
|
16
|
+
CLI for syncing [schema AST](https://livon.tech/docs/schema) from a running server and generating/updating client outputs.
|
|
17
|
+
|
|
18
|
+
## Best for
|
|
19
|
+
|
|
20
|
+
Use this package when you want generated client APIs to stay in sync during local development and CI.
|
|
21
|
+
|
|
3
22
|
## Install
|
|
4
23
|
|
|
5
24
|
```sh
|
|
6
25
|
pnpm add -D @livon/cli
|
|
7
26
|
```
|
|
8
27
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
CLI for syncing [schema AST](https://live-input-vector-output-node.github.io/livon-ts/docs/schema) from a running server and generating/updating client outputs.
|
|
12
|
-
|
|
13
|
-
## Basic command
|
|
28
|
+
## Recommended command (sync + app)
|
|
14
29
|
|
|
15
30
|
```sh
|
|
16
|
-
livon
|
|
31
|
+
livon \
|
|
32
|
+
--endpoint ws://127.0.0.1:3002/ws \
|
|
33
|
+
--out src/generated/api.ts \
|
|
34
|
+
--poll 2000 \
|
|
35
|
+
-- pnpm dev
|
|
17
36
|
```
|
|
18
37
|
|
|
19
38
|
## Generated output mode
|
|
@@ -27,13 +46,7 @@ livon --endpoint ws://127.0.0.1:3002/ws --out src/generated/api.ts --poll 2000
|
|
|
27
46
|
With `--out src/generated/api.ts`, compiled files are written to `src/generated/dist`.
|
|
28
47
|
`livon` also writes `src/generated/package.json` with conditional exports, so `import { api } from './generated'` resolves to the matching build output.
|
|
29
48
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
You can append a command directly (without `&&`):
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
livon --endpoint ws://127.0.0.1:3002/ws --out src/generated/api.ts --poll 2000 pnpm dev
|
|
36
|
-
```
|
|
49
|
+
## Linked process lifecycle
|
|
37
50
|
|
|
38
51
|
If the linked command exits, `livon` exits too.
|
|
39
52
|
If `livon` exits, it terminates the linked command.
|
|
@@ -46,12 +59,12 @@ livon --endpoint ws://127.0.0.1:3002/ws --out src/generated/api.ts -- --some-com
|
|
|
46
59
|
|
|
47
60
|
## Parameters
|
|
48
61
|
|
|
49
|
-
- `--endpoint <ws-url>` (`string`): websocket endpoint used to fetch [schema explain data](https://
|
|
62
|
+
- `--endpoint <ws-url>` (`string`): websocket endpoint used to fetch [schema explain data](https://livon.tech/docs/packages/schema) (required unless `--port` is used).
|
|
50
63
|
- `--port <number>` (`number`): overrides endpoint port when endpoint host/path stay unchanged.
|
|
51
64
|
- `--out <file>` (`string`): output file path for generated API module.
|
|
52
65
|
- `--poll <ms>` (`number`): polling interval for repeated sync runs.
|
|
53
66
|
- `--timeout <ms>` (`number`): request timeout per sync call.
|
|
54
|
-
- `--event <name>` (`string`): [schema explain](https://
|
|
67
|
+
- `--event <name>` (`string`): [schema explain](https://livon.tech/docs/packages/schema) event name (default: `$explain`).
|
|
55
68
|
- `--method <GET|POST>` (`string`): request method for explain fetch.
|
|
56
69
|
- `--header key:value` (`string`, repeatable): additional request header.
|
|
57
70
|
- `--payload <json>` (`string`): raw JSON payload body for explain request.
|
|
@@ -63,12 +76,12 @@ livon --endpoint ws://127.0.0.1:3002/ws --out src/generated/api.ts -- --some-com
|
|
|
63
76
|
|
|
64
77
|
## Typical workflow
|
|
65
78
|
|
|
66
|
-
1. Start server with [`schemaModule(..., { explain: true })`](https://
|
|
79
|
+
1. Start server with [`schemaModule(..., { explain: true })`](https://livon.tech/docs/packages/schema).
|
|
67
80
|
2. Run CLI in watch/poll mode during client development.
|
|
68
81
|
3. Use generated API module in the client runtime.
|
|
69
82
|
|
|
70
83
|
## Related pages
|
|
71
84
|
|
|
72
|
-
- [@livon/schema](https://
|
|
73
|
-
- [@livon/client](https://
|
|
74
|
-
- [Getting Started](https://
|
|
85
|
+
- [@livon/schema](https://livon.tech/docs/packages/schema)
|
|
86
|
+
- [@livon/client](https://livon.tech/docs/packages/client)
|
|
87
|
+
- [Getting Started](https://livon.tech/docs/core/getting-started)
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -27,6 +27,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
27
27
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
28
|
SOFTWARE.
|
|
29
29
|
|
|
30
|
+
------------------------------------------------------------------------------
|
|
31
|
+
ws
|
|
32
|
+
------------------------------------------------------------------------------
|
|
33
|
+
License: MIT
|
|
34
|
+
|
|
35
|
+
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
|
36
|
+
Copyright (c) 2013 Arnout Kazemier and contributors
|
|
37
|
+
Copyright (c) 2016 Luigi Pinca and contributors
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
40
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
41
|
+
the Software without restriction, including without limitation the rights to
|
|
42
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
43
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
44
|
+
subject to the following conditions:
|
|
45
|
+
|
|
46
|
+
The above copyright notice and this permission notice shall be included in all
|
|
47
|
+
copies or substantial portions of the Software.
|
|
48
|
+
|
|
49
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
51
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
52
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
53
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
54
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
55
|
+
|
|
30
56
|
------------------------------------------------------------------------------
|
|
31
57
|
msgpackr
|
|
32
58
|
------------------------------------------------------------------------------
|