@vc-shell/create-vc-app 1.0.123 → 1.0.124
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/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"postinstall": "husky install",
|
|
7
7
|
"serve": "cross-env APP_ENV=development vite --force",
|
|
8
8
|
"preview": "vite preview",
|
|
9
|
-
"build": "yarn build:app
|
|
9
|
+
"build": "yarn build:app && yarn build:types",
|
|
10
10
|
"build:app": "cross-env APP_ENV=production vite build",
|
|
11
11
|
"build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
|
|
12
12
|
"type-check": "vue-tsc --noEmit",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"@types/lodash-es": "^4.17.7",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
23
23
|
"@typescript-eslint/parser": "^5.59.7",
|
|
24
|
-
"@vc-shell/api-client-generator": "^1.0.
|
|
25
|
-
"@vc-shell/ts-config": "^1.0.
|
|
24
|
+
"@vc-shell/api-client-generator": "^1.0.124",
|
|
25
|
+
"@vc-shell/ts-config": "^1.0.124",
|
|
26
26
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
27
27
|
"@vue/eslint-config-prettier": "^7.1.0",
|
|
28
28
|
"@vue/eslint-config-typescript": "^11.0.3",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@fortawesome/fontawesome-free": "^5.15.3",
|
|
57
|
-
"@vc-shell/config-generator": "^1.0.
|
|
58
|
-
"@vc-shell/framework": "^1.0.
|
|
57
|
+
"@vc-shell/config-generator": "^1.0.124",
|
|
58
|
+
"@vc-shell/framework": "^1.0.124",
|
|
59
59
|
"@vueuse/core": "^10.1.2",
|
|
60
60
|
"@vueuse/integrations": "^10.1.2",
|
|
61
61
|
"moment": "^2.29.4",
|
|
@@ -1,28 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Generate API client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This guide describes the process of generating an API client to access the VC Platform API from your custom application.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
!!! note
|
|
6
|
+
Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
2. Add `"generate-api-client": "api-client-generator --color"` command to the list of scripts in the `package.json`
|
|
9
|
-
3. Add `"generate-api-client:project-name": "lerna run generate-api-client --scope=@vc-shell/project-name --stream --no-prefix"`
|
|
8
|
+
## Prerequisites
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
* .NET Core 6.0, particularly if you are using MacOS or Linux.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
## Generate TypeScript API clients
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
1. Run `yarn` or `yarn bootstrap` to install dependency
|
|
17
|
-
2. Run `yarn build` or `yarn build-cli:api-client` to build API client generator
|
|
14
|
+
To enable TypeScript API client generation in your project:
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
1. Add dependencies to your project:
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
=== "Using command"
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @vc-shell/api-client-generator cross-env
|
|
22
|
+
```
|
|
23
|
+
<br>
|
|
24
|
+
`cross-env` runs scripts that set and use environment variables across platforms.
|
|
25
|
+
|
|
26
|
+
[Read more about cross-env](https://github.com/kentcdodds/cross-env){ .md-button }
|
|
27
|
+
|
|
28
|
+
=== "Manually"
|
|
29
|
+
|
|
30
|
+
Add the dependencies to your project's **package.json**:
|
|
31
|
+
|
|
32
|
+
```json title="vc-app/package.json" linenums="1"
|
|
33
|
+
{
|
|
34
|
+
...
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
...
|
|
37
|
+
"@vc-shell/api-client-generator": "latest",
|
|
38
|
+
"cross-env": "latest",
|
|
39
|
+
...
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. Configure client generation in your project. Inside your project's **package.json** file, add a `"generate-api-client"` command to the list of scripts:
|
|
45
|
+
|
|
46
|
+
```title="vc-app-extend/package.json" linenums="1"
|
|
47
|
+
{
|
|
48
|
+
"scripts": {
|
|
49
|
+
...
|
|
50
|
+
"generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[MarketplaceVendor,Catalog,Orders]' --APP_API_CLIENT_DIRECTORY=./src/api_client/
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The options are listed in the table below:
|
|
56
|
+
|
|
57
|
+
| Options | Description | Example |
|
|
58
|
+
|----------------------------- |---------------------------------------------------------------- |------------------------------------------------------------ |
|
|
59
|
+
| `--APP_PLATFORM_MODULES` | Platform modules to generate API client.<br>{==string[]==} <br> Customize the `--APP_PLATFORM_MODULES` list<br>to match your project's requirements. | `--APP_PLATFORM_MODULES='[MarketplaceVendor,Orders,Catalog]'` |
|
|
60
|
+
| `--APP_API_CLIENT_DIRECTORY` | Output directory for generated API clients. <br>{==string==} | `--APP_API_CLIENT_DIRECTORY=./src/api_client/` |
|
|
61
|
+
| `--APP_PLATFORM_URL` | Platform URL to obtain client API configs. <br>{==string==} | `--APP_PLATFORM_URL=https://vcmp-dev.paas.govirto.com/` |
|
|
62
|
+
|
|
63
|
+
3. Configure Platform URL to ensure your project can access the platform's API configurations. Add the platform URL to your project's **.env** file:
|
|
64
|
+
|
|
65
|
+
```title="vc-app-extend/.env"
|
|
66
|
+
APP_PLATFORM_URL=https://vcmp-dev.paas.govirto.com/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
!!! note
|
|
70
|
+
Alternatively, you can specify the Platform URL as a command option in the previous step when running the `"generate-api-client"` command.
|
|
71
|
+
|
|
72
|
+
4. Generate the API clients using the following command:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
yarn generate-api-client
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This command generates the required API clients for your custom application. Now you can effortlessly access the VC Platform API from your custom application using the generated API client.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vc-shell/create-vc-app",
|
|
3
3
|
"description": "Application scaffolding",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.124",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/prompts": "^2.4.4",
|
|
16
|
-
"@vc-shell/ts-config": "^1.0.
|
|
16
|
+
"@vc-shell/ts-config": "^1.0.124",
|
|
17
17
|
"copyfiles": "^2.4.1",
|
|
18
18
|
"cross-env": "^7.0.3",
|
|
19
19
|
"shx": "^0.3.4",
|