@devkong/cli-nx 0.0.27 → 0.0.28
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/package.json
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the Kong extension development workspace!
|
|
4
4
|
|
|
5
|
+
To have a better experience, open this file in preview mode of your IDE.
|
|
6
|
+
|
|
5
7
|
### Prerequisites
|
|
6
8
|
|
|
7
|
-
Before you start, make sure you have the following installed:
|
|
9
|
+
Before you start, make sure you have the following installed depending on your OS:
|
|
10
|
+
|
|
11
|
+
[▶ Windows Setup](#windows-setup)
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
- [Docker](https://docs.docker.com/desktop/). If using Docker Desktop, start it
|
|
13
|
+
[▶ macOS Setup](#macos-setup)
|
|
11
14
|
- Mac M2 users, see [Troubleshooting](#Troubleshooting)
|
|
12
15
|
|
|
16
|
+
[▶ Ubuntu Linux Setup](#ubuntu-setup)
|
|
17
|
+
|
|
13
18
|
To verify the installation and check the versions, run the following commands:
|
|
14
19
|
|
|
15
20
|
```shell script
|
|
@@ -74,4 +79,181 @@ To emulate a Linux platform, you need to install Rosetta:
|
|
|
74
79
|
|
|
75
80
|
```shell script
|
|
76
81
|
softwareupdate --install-rosetta
|
|
77
|
-
```
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<details id="windows-setup">
|
|
86
|
+
<summary><strong>Windows Setup</strong></summary>
|
|
87
|
+
|
|
88
|
+
### Install Windows Subsystem for Linux (WSL2)
|
|
89
|
+
|
|
90
|
+
1. Open PowerShell as Administrator.
|
|
91
|
+
2. Run the following command to install WSL and set WSL2 as the default version:
|
|
92
|
+
```powershell
|
|
93
|
+
wsl --install
|
|
94
|
+
```
|
|
95
|
+
3. Restart your computer if prompted.
|
|
96
|
+
4. After restarting, install a preferred Linux distribution (e.g., Ubuntu) by running:
|
|
97
|
+
```powershell
|
|
98
|
+
wsl --install -d Ubuntu
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Install Docker within WSL2
|
|
102
|
+
|
|
103
|
+
1. Download Docker Desktop for Windows from [Docker's official website](https://www.docker.com/products/docker-desktop).
|
|
104
|
+
2. Run the installer and follow the setup instructions.
|
|
105
|
+
3. During installation, ensure the "Use the WSL 2 based engine" option is selected.
|
|
106
|
+
4. Once installed, open Docker Desktop, go to Settings > General, and enable "Use WSL 2 based engine" if it isn't already enabled.
|
|
107
|
+
5. Confirm Docker is working in your WSL2 distribution (e.g., Ubuntu) by running:
|
|
108
|
+
```bash
|
|
109
|
+
docker --version
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Install Node.js and npm on Windows Host
|
|
113
|
+
|
|
114
|
+
1. Download the Node.js installer for Windows from the [official Node.js website](https://nodejs.org/).
|
|
115
|
+
2. Run the installer, making sure to include the npm package manager during installation.
|
|
116
|
+
3. Verify installation by opening a new Command Prompt and running:
|
|
117
|
+
```cmd
|
|
118
|
+
node -v
|
|
119
|
+
npm -v
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Install Python on Windows Host
|
|
123
|
+
|
|
124
|
+
1. Download the Python installer for Windows from the [official Python website](https://www.python.org/downloads/windows/).
|
|
125
|
+
2. Run the installer, making sure to check "Add Python to PATH" during setup.
|
|
126
|
+
3. Verify installation by running:
|
|
127
|
+
```cmd
|
|
128
|
+
python --version
|
|
129
|
+
pip --version
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Install Poetry on Windows Host
|
|
133
|
+
|
|
134
|
+
1. Open Command Prompt or PowerShell.
|
|
135
|
+
2. Run the following command:
|
|
136
|
+
```powershell
|
|
137
|
+
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
|
|
138
|
+
```
|
|
139
|
+
3. Add Poetry to your PATH:
|
|
140
|
+
```powershell
|
|
141
|
+
$env:Path += ";$env:USERPROFILE\.poetry\bin"
|
|
142
|
+
```
|
|
143
|
+
4. Verify installation:
|
|
144
|
+
```powershell
|
|
145
|
+
poetry --version
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
</details>
|
|
149
|
+
|
|
150
|
+
<details id="macos-setup">
|
|
151
|
+
<summary><strong>macOS Setup</strong></summary>
|
|
152
|
+
|
|
153
|
+
### Install Docker
|
|
154
|
+
|
|
155
|
+
1. Download and install Docker Desktop for Mac from [Docker's official website](https://www.docker.com/products/docker-desktop).
|
|
156
|
+
|
|
157
|
+
### Install Node.js and npm
|
|
158
|
+
|
|
159
|
+
1. Use Homebrew to install:
|
|
160
|
+
```bash
|
|
161
|
+
brew install node
|
|
162
|
+
```
|
|
163
|
+
2. Verify installation:
|
|
164
|
+
```bash
|
|
165
|
+
node -v
|
|
166
|
+
npm -v
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Install Python
|
|
170
|
+
|
|
171
|
+
1. Use Homebrew to install:
|
|
172
|
+
```bash
|
|
173
|
+
brew install python
|
|
174
|
+
```
|
|
175
|
+
2. Verify installation:
|
|
176
|
+
```bash
|
|
177
|
+
python3 --version
|
|
178
|
+
pip3 --version
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Install Poetry
|
|
182
|
+
|
|
183
|
+
1. Run the following command:
|
|
184
|
+
```bash
|
|
185
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
186
|
+
```
|
|
187
|
+
2. Add Poetry to your PATH:
|
|
188
|
+
```bash
|
|
189
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
190
|
+
```
|
|
191
|
+
3. Reload the shell:
|
|
192
|
+
```bash
|
|
193
|
+
source ~/.bashrc
|
|
194
|
+
```
|
|
195
|
+
4. Verify installation:
|
|
196
|
+
```bash
|
|
197
|
+
poetry --version
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
</details>
|
|
201
|
+
|
|
202
|
+
<details id="ubuntu-setup">
|
|
203
|
+
<summary><strong>Ubuntu Linux Setup</strong></summary>
|
|
204
|
+
|
|
205
|
+
### Install Docker
|
|
206
|
+
|
|
207
|
+
1. Follow the installation instructions on [Docker's official website](https://docs.docker.com/engine/install/ubuntu/).
|
|
208
|
+
2. Start Docker and enable it to start on boot:
|
|
209
|
+
```bash
|
|
210
|
+
sudo systemctl start docker
|
|
211
|
+
sudo systemctl enable docker
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Install Node.js and npm
|
|
215
|
+
|
|
216
|
+
1. Run the following commands:
|
|
217
|
+
```bash
|
|
218
|
+
sudo apt update
|
|
219
|
+
sudo apt install -y nodejs npm
|
|
220
|
+
```
|
|
221
|
+
2. Verify installation:
|
|
222
|
+
```bash
|
|
223
|
+
node -v
|
|
224
|
+
npm -v
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Install Python
|
|
228
|
+
|
|
229
|
+
1. Run the following commands:
|
|
230
|
+
```bash
|
|
231
|
+
sudo apt update
|
|
232
|
+
sudo apt install -y python3 python3-pip
|
|
233
|
+
```
|
|
234
|
+
2. Verify installation:
|
|
235
|
+
```bash
|
|
236
|
+
python3 --version
|
|
237
|
+
pip3 --version
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Install Poetry
|
|
241
|
+
|
|
242
|
+
1. Run the following command:
|
|
243
|
+
```bash
|
|
244
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
245
|
+
```
|
|
246
|
+
2. Add Poetry to your PATH:
|
|
247
|
+
```bash
|
|
248
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
249
|
+
```
|
|
250
|
+
3. Reload the shell:
|
|
251
|
+
```bash
|
|
252
|
+
source ~/.bashrc
|
|
253
|
+
```
|
|
254
|
+
4. Verify installation:
|
|
255
|
+
```bash
|
|
256
|
+
poetry --version
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
</details>
|
|
@@ -2,38 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the Kong extension development workspace!
|
|
4
4
|
|
|
5
|
+
To have a better experience, open this file in preview mode of your IDE.
|
|
6
|
+
|
|
5
7
|
### Prerequisites
|
|
6
8
|
|
|
7
|
-
Before you start, make sure you have the following installed:
|
|
9
|
+
Before you start, make sure you have the following installed depending on your OS:
|
|
10
|
+
|
|
11
|
+
[▶ Windows Setup](#windows-setup)
|
|
12
|
+
|
|
13
|
+
[▶ macOS Setup](#macos-setup)
|
|
14
|
+
|
|
15
|
+
[▶ Ubuntu Linux Setup](#ubuntu-setup)
|
|
8
16
|
|
|
9
|
-
- [Node.js](https://nodejs.org/en/download/prebuilt-installer). Version >= 20.0
|
|
10
|
-
- [Python](https://www.python.org/downloads/). Version >= 3.10
|
|
11
|
-
- [Docker](https://docs.docker.com/desktop/). If using Docker Desktop, start it
|
|
12
17
|
- Mac M2 users, see [Troubleshooting](#Troubleshooting)
|
|
13
18
|
|
|
19
|
+
|
|
14
20
|
To verify the installation and check the versions, run the following commands:
|
|
15
21
|
|
|
16
22
|
```shell script
|
|
17
23
|
node --version
|
|
18
|
-
python --version # or python3 --version
|
|
19
24
|
docker info
|
|
20
25
|
```
|
|
21
26
|
|
|
22
27
|
### Getting Started
|
|
23
28
|
|
|
24
|
-
1.
|
|
25
|
-
2.
|
|
26
|
-
3. Run the following commands in your terminal:
|
|
29
|
+
1. Make sure you're in the terminal and inside the extension folder you generated
|
|
30
|
+
2. Run the following commands in your terminal:
|
|
27
31
|
|
|
28
32
|
```shell script
|
|
29
33
|
# configure the base Kong URL (e.g., https://kong.dev.app-dts.net)
|
|
30
34
|
kong configure
|
|
31
|
-
|
|
32
|
-
# install Python dependencies from requirements.txt
|
|
33
|
-
kong install --verbose
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
That's it! Now, modify [main.
|
|
37
|
+
That's it! Now, modify [main.kt](./src/main/kotlin/io/kong/extension/Main.kt), tag it by publishing a new version, and assign aliases for use in the workflow.
|
|
37
38
|
|
|
38
39
|
### Publish a New Version
|
|
39
40
|
|
|
@@ -59,31 +60,6 @@ You can assign an alias (e.g., stable, beta) to a specific version. This alias w
|
|
|
59
60
|
kong set-alias stable 1
|
|
60
61
|
```
|
|
61
62
|
|
|
62
|
-
### Running and Debugging Tests
|
|
63
|
-
|
|
64
|
-
To run the tests, execute the following command:
|
|
65
|
-
|
|
66
|
-
```shell script
|
|
67
|
-
pytest ./src
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
This will run the tests located in the `src` directory.
|
|
71
|
-
The debugging process depends on the IDE you're using. For example, in [VSCode](https://code.visualstudio.com/), follow these steps:
|
|
72
|
-
|
|
73
|
-
1. Open the Run and Debug panel from the left sidebar
|
|
74
|
-
2. In the top combobox (dropdown), select "test" to configure the test environment
|
|
75
|
-
3. Click the green play button to start debugging the tests
|
|
76
|
-
|
|
77
|
-
This will allow you to set breakpoints and step through your tests.
|
|
78
|
-
|
|
79
|
-
### Update Python Dependencies
|
|
80
|
-
|
|
81
|
-
If you modify requirements.txt or requirements-dev.txt, run the following to apply the changes:
|
|
82
|
-
|
|
83
|
-
```shell script
|
|
84
|
-
kong install --verbose
|
|
85
|
-
```
|
|
86
|
-
|
|
87
63
|
### Using a Custom Profile
|
|
88
64
|
|
|
89
65
|
If you're developing an extension that will be used in different regions (or need to work with a specific profile), you can create a new profile using `kong configure`. Then, include the `--profile <name>` parameter when running the publish-version and set-alias commands to use the desired profile.
|
|
@@ -106,10 +82,179 @@ To emulate a Linux platform, you need to install Rosetta:
|
|
|
106
82
|
softwareupdate --install-rosetta
|
|
107
83
|
```
|
|
108
84
|
|
|
109
|
-
#### Using a Different Python Version
|
|
110
85
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
86
|
+
<details id="windows-setup">
|
|
87
|
+
<summary><strong>Windows Setup</strong></summary>
|
|
88
|
+
|
|
89
|
+
### Install Windows Subsystem for Linux (WSL2)
|
|
90
|
+
|
|
91
|
+
1. Open PowerShell as Administrator.
|
|
92
|
+
2. Run the following command to install WSL and set WSL2 as the default version:
|
|
93
|
+
```powershell
|
|
94
|
+
wsl --install
|
|
95
|
+
```
|
|
96
|
+
3. Restart your computer if prompted.
|
|
97
|
+
4. After restarting, install a preferred Linux distribution (e.g., Ubuntu) by running:
|
|
98
|
+
```powershell
|
|
99
|
+
wsl --install -d Ubuntu
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Install Docker within WSL2
|
|
103
|
+
|
|
104
|
+
1. Download Docker Desktop for Windows from [Docker's official website](https://www.docker.com/products/docker-desktop).
|
|
105
|
+
2. Run the installer and follow the setup instructions.
|
|
106
|
+
3. During installation, ensure the "Use the WSL 2 based engine" option is selected.
|
|
107
|
+
4. Once installed, open Docker Desktop, go to Settings > General, and enable "Use WSL 2 based engine" if it isn't already enabled.
|
|
108
|
+
5. Confirm Docker is working in your WSL2 distribution (e.g., Ubuntu) by running:
|
|
109
|
+
```bash
|
|
110
|
+
docker --version
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Install Node.js and npm on Windows Host
|
|
114
|
+
|
|
115
|
+
1. Download the Node.js installer for Windows from the [official Node.js website](https://nodejs.org/).
|
|
116
|
+
2. Run the installer, making sure to include the npm package manager during installation.
|
|
117
|
+
3. Verify installation by opening a new Command Prompt and running:
|
|
118
|
+
```cmd
|
|
119
|
+
node -v
|
|
120
|
+
npm -v
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Install Python on Windows Host
|
|
124
|
+
|
|
125
|
+
1. Download the Python installer for Windows from the [official Python website](https://www.python.org/downloads/windows/).
|
|
126
|
+
2. Run the installer, making sure to check "Add Python to PATH" during setup.
|
|
127
|
+
3. Verify installation by running:
|
|
128
|
+
```cmd
|
|
129
|
+
python --version
|
|
130
|
+
pip --version
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Install Poetry on Windows Host
|
|
134
|
+
|
|
135
|
+
1. Open Command Prompt or PowerShell.
|
|
136
|
+
2. Run the following command:
|
|
137
|
+
```powershell
|
|
138
|
+
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
|
|
139
|
+
```
|
|
140
|
+
3. Add Poetry to your PATH:
|
|
141
|
+
```powershell
|
|
142
|
+
$env:Path += ";$env:USERPROFILE\.poetry\bin"
|
|
143
|
+
```
|
|
144
|
+
4. Verify installation:
|
|
145
|
+
```powershell
|
|
146
|
+
poetry --version
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
</details>
|
|
150
|
+
|
|
151
|
+
<details id="macos-setup">
|
|
152
|
+
<summary><strong>macOS Setup</strong></summary>
|
|
153
|
+
|
|
154
|
+
### Install Docker
|
|
155
|
+
|
|
156
|
+
1. Download and install Docker Desktop for Mac from [Docker's official website](https://www.docker.com/products/docker-desktop).
|
|
157
|
+
|
|
158
|
+
### Install Node.js and npm
|
|
159
|
+
|
|
160
|
+
1. Use Homebrew to install:
|
|
161
|
+
```bash
|
|
162
|
+
brew install node
|
|
163
|
+
```
|
|
164
|
+
2. Verify installation:
|
|
165
|
+
```bash
|
|
166
|
+
node -v
|
|
167
|
+
npm -v
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Install Python
|
|
171
|
+
|
|
172
|
+
1. Use Homebrew to install:
|
|
173
|
+
```bash
|
|
174
|
+
brew install python
|
|
175
|
+
```
|
|
176
|
+
2. Verify installation:
|
|
177
|
+
```bash
|
|
178
|
+
python3 --version
|
|
179
|
+
pip3 --version
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Install Poetry
|
|
183
|
+
|
|
184
|
+
1. Run the following command:
|
|
185
|
+
```bash
|
|
186
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
187
|
+
```
|
|
188
|
+
2. Add Poetry to your PATH:
|
|
189
|
+
```bash
|
|
190
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
191
|
+
```
|
|
192
|
+
3. Reload the shell:
|
|
193
|
+
```bash
|
|
194
|
+
source ~/.bashrc
|
|
195
|
+
```
|
|
196
|
+
4. Verify installation:
|
|
197
|
+
```bash
|
|
198
|
+
poetry --version
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
</details>
|
|
202
|
+
|
|
203
|
+
<details id="ubuntu-setup">
|
|
204
|
+
<summary><strong>Ubuntu Linux Setup</strong></summary>
|
|
205
|
+
|
|
206
|
+
### Install Docker
|
|
207
|
+
|
|
208
|
+
1. Follow the installation instructions on [Docker's official website](https://docs.docker.com/engine/install/ubuntu/).
|
|
209
|
+
2. Start Docker and enable it to start on boot:
|
|
210
|
+
```bash
|
|
211
|
+
sudo systemctl start docker
|
|
212
|
+
sudo systemctl enable docker
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Install Node.js and npm
|
|
216
|
+
|
|
217
|
+
1. Run the following commands:
|
|
218
|
+
```bash
|
|
219
|
+
sudo apt update
|
|
220
|
+
sudo apt install -y nodejs npm
|
|
221
|
+
```
|
|
222
|
+
2. Verify installation:
|
|
223
|
+
```bash
|
|
224
|
+
node -v
|
|
225
|
+
npm -v
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Install Python
|
|
229
|
+
|
|
230
|
+
1. Run the following commands:
|
|
231
|
+
```bash
|
|
232
|
+
sudo apt update
|
|
233
|
+
sudo apt install -y python3 python3-pip
|
|
234
|
+
```
|
|
235
|
+
2. Verify installation:
|
|
236
|
+
```bash
|
|
237
|
+
python3 --version
|
|
238
|
+
pip3 --version
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Install Poetry
|
|
242
|
+
|
|
243
|
+
1. Run the following command:
|
|
244
|
+
```bash
|
|
245
|
+
curl -sSL https://install.python-poetry.org | python3 -
|
|
246
|
+
```
|
|
247
|
+
2. Add Poetry to your PATH:
|
|
248
|
+
```bash
|
|
249
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
250
|
+
```
|
|
251
|
+
3. Reload the shell:
|
|
252
|
+
```bash
|
|
253
|
+
source ~/.bashrc
|
|
254
|
+
```
|
|
255
|
+
4. Verify installation:
|
|
256
|
+
```bash
|
|
257
|
+
poetry --version
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
</details>
|