@weclapp/sdk 1.8.0-dev.16
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/LICENSE +21 -0
- package/README.md +58 -0
- package/bin/cli.js +2 -0
- package/dist/cli.js +1397 -0
- package/package.json +70 -0
- package/tsconfig.lib.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present, weclapp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<br/>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<h3>weclapp sdk generator</h3>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<br/>
|
|
8
|
+
|
|
9
|
+
### Getting started
|
|
10
|
+
|
|
11
|
+
This is an SDK generator, it will take an [`openapi.json`](https://swagger.io/specification/) from [weclapp](https://weclapp.com/) and build services and types according to the entities defined in it.
|
|
12
|
+
What's being generated depends on the weclapp version you're using.
|
|
13
|
+
|
|
14
|
+
The SDK generator requires the current or LTS version of nodejs, as well as npm v9 or v8.
|
|
15
|
+
|
|
16
|
+
You can install the generator via the package manager of your choice:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
$ npm install --save-dev @weclapp/sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
And build the sdk via:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
$ npx build-weclapp-sdk company.weclapp.com --key [your api key]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
It is recommended to add the build script to the [postinstall](https://docs.npmjs.com/cli/v9/using-npm/scripts#life-cycle-operation-order)-script in your package.json.
|
|
29
|
+
This way, every time someone installs or updates dependencies, the SDK is generated:
|
|
30
|
+
|
|
31
|
+
```json5
|
|
32
|
+
{
|
|
33
|
+
// in your package.json
|
|
34
|
+
"scripts": {
|
|
35
|
+
"sdk:generate": "build-weclapp-sdk company.weclapp.com --key [your api key] --cache --target browser",
|
|
36
|
+
"postinstall": "npm run sdk:generate",
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
After that, you can import the sdk via `@weclapp/sdk`.
|
|
42
|
+
Check out the [docs](docs) for how the generated SDK looks like and how to use it!
|
|
43
|
+
|
|
44
|
+
### Available flags
|
|
45
|
+
|
|
46
|
+
| Flag | Description | Value / Type |
|
|
47
|
+
|---------------------|-------------------------------------------------------------------------------|----------------------------------------------|
|
|
48
|
+
| `--help` / `-h` | Show help. | `boolean` |
|
|
49
|
+
| `--version` / `-v` | Show version of SDK. | `boolean` |
|
|
50
|
+
| `--key` / `-k` | API Key in case of using a remote. | `string` |
|
|
51
|
+
| `--cache` / `-c` | Extra query params when fetching the openapi.json from a server. | `boolean` |
|
|
52
|
+
| `--from-env` / `-e` | Use env variables `WECLAPP_BACKEND_URL` and `WECLAPP_API_KEY` as credentials. | `boolean` |
|
|
53
|
+
| `--target` / `-t` | Specify the target platform. | `browser`, `browser.rx`, `node` or `node.rx` |
|
|
54
|
+
| `--generate-unique` | Generate additional `.unique` functions. | `boolean` |
|
|
55
|
+
|
|
56
|
+
### Contributing
|
|
57
|
+
|
|
58
|
+
Check out the [contributing guidelines](.github/CONTRIBUTING.md).
|
package/bin/cli.js
ADDED