@ni-kismet/sl-webapp-nipkg 0.2.2 → 0.3.0
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 +212 -5
- package/dist/cli.js +218 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.test.js +305 -1
- package/dist/cli.test.js.map +1 -1
- package/dist/credentialStore.d.ts +18 -0
- package/dist/credentialStore.d.ts.map +1 -0
- package/dist/credentialStore.js +68 -0
- package/dist/credentialStore.js.map +1 -0
- package/dist/credentialStore.test.d.ts +2 -0
- package/dist/credentialStore.test.d.ts.map +1 -0
- package/dist/credentialStore.test.js +86 -0
- package/dist/credentialStore.test.js.map +1 -0
- package/dist/deployer.d.ts +47 -0
- package/dist/deployer.d.ts.map +1 -0
- package/dist/deployer.js +305 -0
- package/dist/deployer.js.map +1 -0
- package/dist/deployer.test.d.ts +2 -0
- package/dist/deployer.test.d.ts.map +1 -0
- package/dist/deployer.test.js +144 -0
- package/dist/deployer.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/slApiClient.d.ts +56 -0
- package/dist/slApiClient.d.ts.map +1 -0
- package/dist/slApiClient.js +118 -0
- package/dist/slApiClient.js.map +1 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ A flexible tool for packaging web applications into SystemLink WebApp `.nipkg` f
|
|
|
10
10
|
|
|
11
11
|
- 🚀 **Easy Integration**: Works seamlessly with any web application
|
|
12
12
|
- 📦 **Automated Packaging**: Builds and packages your app in one command
|
|
13
|
+
- 🚢 **SystemLink Deployment**: Create/update WebApps and upload `.nipkg` content from CLI
|
|
14
|
+
- 🔐 **Secure Authentication**: `login`/`logout` commands store credentials per-host — no secrets in config files
|
|
13
15
|
- ⚙️ **Flexible Configuration**: Optional config files - use CLI flags or JSON config
|
|
14
16
|
- 🎯 **TypeScript Support**: Written in TypeScript with full type definitions
|
|
15
17
|
- 🌈 **Beautiful CLI**: Colorful, informative command-line interface
|
|
@@ -20,7 +22,7 @@ A flexible tool for packaging web applications into SystemLink WebApp `.nipkg` f
|
|
|
20
22
|
|
|
21
23
|
## Prerequisites
|
|
22
24
|
|
|
23
|
-
- Node.js
|
|
25
|
+
- Node.js 20 or higher (only to run the packaging tool)
|
|
24
26
|
|
|
25
27
|
## Installation
|
|
26
28
|
|
|
@@ -163,6 +165,191 @@ sl-webapp-nipkg build \
|
|
|
163
165
|
|
|
164
166
|
Initialize a `nipkg.config.json` file in the current directory.
|
|
165
167
|
|
|
168
|
+
### `sl-webapp-nipkg login`
|
|
169
|
+
|
|
170
|
+
Authenticate with a SystemLink host and store credentials locally so you don't need to pass `--api-key` on every command.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Interactive — prompts for host and API key
|
|
174
|
+
sl-webapp-nipkg login
|
|
175
|
+
|
|
176
|
+
# Non-interactive — prompts only for API key
|
|
177
|
+
sl-webapp-nipkg login --host https://systemlink.example.com
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Credentials are verified against the SystemLink API before being stored. A `401` response means the key was wrong and nothing is saved.
|
|
181
|
+
|
|
182
|
+
- Credentials are stored in `~/.sl-webapp-nipkg/credentials.json` (permissions set to `0600` on Unix)
|
|
183
|
+
- Multiple hosts can be stored side by side
|
|
184
|
+
- The `deploy` and `delete` commands automatically use the stored credential when no explicit key is provided
|
|
185
|
+
|
|
186
|
+
#### Login Options
|
|
187
|
+
|
|
188
|
+
- `--host <url>` - SystemLink host URL (prompted interactively if omitted)
|
|
189
|
+
- `--timeout <ms>` - Verification request timeout in milliseconds (default `30000`)
|
|
190
|
+
|
|
191
|
+
### `sl-webapp-nipkg logout`
|
|
192
|
+
|
|
193
|
+
Remove the stored credential for a host.
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Interactive — prompts for host
|
|
197
|
+
sl-webapp-nipkg logout
|
|
198
|
+
|
|
199
|
+
# Non-interactive
|
|
200
|
+
sl-webapp-nipkg logout --host https://systemlink.example.com
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Logout Options
|
|
204
|
+
|
|
205
|
+
- `--host <url>` - SystemLink host URL (prompted interactively if omitted)
|
|
206
|
+
|
|
207
|
+
### `sl-webapp-nipkg deploy`
|
|
208
|
+
|
|
209
|
+
Deploy a `.nipkg` to SystemLink WebApps.
|
|
210
|
+
|
|
211
|
+
Create mode performs two API calls:
|
|
212
|
+
|
|
213
|
+
1. `POST {host}/niapp/v1/webapps` (creates WebApp and returns `id`)
|
|
214
|
+
2. `PUT {host}/niapp/v1/webapps/{id}/content` (uploads `.nipkg`)
|
|
215
|
+
|
|
216
|
+
Update mode performs three API calls:
|
|
217
|
+
|
|
218
|
+
1. `GET {host}/niapp/v1/webapps/{id}` (fetches current data to preserve unchanged fields)
|
|
219
|
+
2. `PUT {host}/niapp/v1/webapps/{id}` (updates only provided metadata fields)
|
|
220
|
+
3. `PUT {host}/niapp/v1/webapps/{id}/content` (uploads `.nipkg`)
|
|
221
|
+
|
|
222
|
+
The tool can automatically discover and select `.nipkg` files from your build directory. For updates, you only need to provide the `--app-id` and any fields you want to change; current values are fetched from SystemLink.
|
|
223
|
+
|
|
224
|
+
#### Deploy Options
|
|
225
|
+
|
|
226
|
+
- `--nipkg <path>` - Path to a `.nipkg` file **or** a directory to search for `.nipkg` files (optional - see auto-discovery below)
|
|
227
|
+
- `-b, --build [command]` - Run build command before deploying (optionally specify custom command)
|
|
228
|
+
- `--latest` - Skip interactive selection and auto-pick the newest `.nipkg` (useful for CI/CD)
|
|
229
|
+
- `--build-suffix <suffix>` - Suffix appended to nipkg filename when `--build` is used (e.g., CI build ID)
|
|
230
|
+
- `--skip-cleanup` - Skip cleanup of existing nipkg files when `--build` is used
|
|
231
|
+
- `--host <url>` - SystemLink host URL
|
|
232
|
+
- `--api-key <key>` - API key used as `x-ni-api-key`
|
|
233
|
+
- `--name <name>` - WebApp name (optional for update; falls back to top-level `displayName` from config)
|
|
234
|
+
- `--workspace-id <id>` - Workspace UUID (required for create, optional for update)
|
|
235
|
+
- `--policy-ids <ids>` - Comma-separated policy IDs (optional)
|
|
236
|
+
- `--properties <json>` - JSON properties object (optional, include `version` field if desired)
|
|
237
|
+
- `--update` - Update existing WebApp instead of creating new
|
|
238
|
+
- `--app-id <id>` - Existing WebApp ID (required with `--update`)
|
|
239
|
+
- `--timeout <ms>` - Request timeout in milliseconds (default `30000`)
|
|
240
|
+
- `--config <path>` - Config path (default `nipkg.config.json`)
|
|
241
|
+
- `-v, --verbose` - Verbose output
|
|
242
|
+
|
|
243
|
+
#### Auto-discovery of nipkg Files
|
|
244
|
+
|
|
245
|
+
If `--nipkg` is not provided, the tool will search for `.nipkg` files in:
|
|
246
|
+
|
|
247
|
+
1. The output directory from the `--build` step (if `--build` was used)
|
|
248
|
+
2. The `outputDir` from `nipkg.config.json` (defaults to `dist/nipkg`)
|
|
249
|
+
|
|
250
|
+
When `--nipkg` points to a **directory**, the newest `.nipkg` inside it is selected automatically.
|
|
251
|
+
|
|
252
|
+
**Default behavior (interactive selection):**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
sl-webapp-nipkg deploy --update --app-id <id>
|
|
256
|
+
# If multiple .nipkg files are found, prompts you to pick one
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Auto-select latest (non-interactive, for CI/CD):**
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
sl-webapp-nipkg deploy --update --app-id <id> --latest
|
|
263
|
+
# Always picks the newest .nipkg without prompting
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### Build Before Deploy
|
|
267
|
+
|
|
268
|
+
Build and deploy in a single command:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Build with default build command from config, then deploy
|
|
272
|
+
sl-webapp-nipkg deploy \
|
|
273
|
+
--update --app-id "35075240-68a1-431b-afe1-9ce76da46de3" \
|
|
274
|
+
--build \
|
|
275
|
+
--latest
|
|
276
|
+
|
|
277
|
+
# Build with custom command, then deploy
|
|
278
|
+
sl-webapp-nipkg deploy \
|
|
279
|
+
--update --app-id "35075240-68a1-431b-afe1-9ce76da46de3" \
|
|
280
|
+
--build "npm run build:prod" \
|
|
281
|
+
--latest
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Smart Updates (Fetch Current Data)
|
|
285
|
+
|
|
286
|
+
For update operations, the tool fetches current WebApp data from SystemLink. You only need to provide the fields you want to change:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Update only the properties, keep name/workspace/policyIds unchanged
|
|
290
|
+
sl-webapp-nipkg deploy \
|
|
291
|
+
--update --app-id "35075240-68a1-431b-afe1-9ce76da46de3" \
|
|
292
|
+
--nipkg ./dist/nipkg/my-app_1.0.1_all.nipkg \
|
|
293
|
+
--host "$SYSTEMLINK_HOST" \
|
|
294
|
+
--api-key "$SYSTEMLINK_API_KEY" \
|
|
295
|
+
--properties '{"version":"1.0.1","description":"Updated version"}'
|
|
296
|
+
|
|
297
|
+
# Update only the policy IDs, keep other metadata
|
|
298
|
+
sl-webapp-nipkg deploy \
|
|
299
|
+
--update --app-id "35075240-68a1-431b-afe1-9ce76da46de3" \
|
|
300
|
+
--nipkg ./dist/nipkg/my-app_1.0.1_all.nipkg \
|
|
301
|
+
--host "$SYSTEMLINK_HOST" \
|
|
302
|
+
--api-key "$SYSTEMLINK_API_KEY" \
|
|
303
|
+
--policy-ids "policy-1,policy-2"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### Deploy Examples
|
|
307
|
+
|
|
308
|
+
**Create new WebApp:**
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
sl-webapp-nipkg deploy \
|
|
312
|
+
--nipkg ./dist/nipkg/my-app_1.0.0_all.nipkg \
|
|
313
|
+
--host https://test.lifecyclesolutions.ni.com \
|
|
314
|
+
--api-key "$SYSTEMLINK_API_KEY" \
|
|
315
|
+
--name "My WebApp" \
|
|
316
|
+
--workspace-id "45bc27cf-85c6-485c-945d-a51e664f511d" \
|
|
317
|
+
--policy-ids "policy-1,policy-2" \
|
|
318
|
+
--properties '{"description":"my app","version":"1.0.0"}'
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Update existing WebApp (minimal - only app-id required):**
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
sl-webapp-nipkg deploy \
|
|
325
|
+
--nipkg ./dist/nipkg/my-app_1.0.1_all.nipkg \
|
|
326
|
+
--host https://test-api.lifecyclesolutions.ni.com \
|
|
327
|
+
--api-key "$SYSTEMLINK_API_KEY" \
|
|
328
|
+
--update \
|
|
329
|
+
--app-id "35075240-68a1-431b-afe1-9ce76da46de3"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Build and deploy in single command:**
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
sl-webapp-nipkg deploy \
|
|
336
|
+
--build \
|
|
337
|
+
--update --app-id "35075240-68a1-431b-afe1-9ce76da46de3" \
|
|
338
|
+
--latest \
|
|
339
|
+
--host https://test-api.lifecyclesolutions.ni.com \
|
|
340
|
+
--api-key "$SYSTEMLINK_API_KEY" \
|
|
341
|
+
--properties '{"version":"1.0.1"}'
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Environment variable fallback:
|
|
345
|
+
|
|
346
|
+
- `SYSTEMLINK_HOST`
|
|
347
|
+
- `SYSTEMLINK_API_KEY`
|
|
348
|
+
|
|
349
|
+
Precedence: CLI flags > environment variables > stored login credential (`sl-webapp-nipkg login`) > defaults (where applicable).
|
|
350
|
+
|
|
351
|
+
> **Security note:** The API key is intentionally **not** a `nipkg.config.json` field. The recommended workflow is to run `sl-webapp-nipkg login` once per host — credentials are stored in `~/.sl-webapp-nipkg/credentials.json` with restricted permissions. For CI/CD pipelines, use the `SYSTEMLINK_API_KEY` environment variable or the `--api-key` flag.
|
|
352
|
+
|
|
166
353
|
## Configuration
|
|
167
354
|
|
|
168
355
|
### Configuration File (`nipkg.config.json`)
|
|
@@ -183,6 +370,7 @@ Initialize a `nipkg.config.json` file in the current directory.
|
|
|
183
370
|
| `buildSuffix` | string | ❌ | Optional suffix for package filename (e.g., build ID for CI/CD) |
|
|
184
371
|
| `depends` | string[] | ❌ | Package dependencies |
|
|
185
372
|
| `userVisible` | boolean | ❌ | Whether package is user visible |
|
|
373
|
+
| `deployment` | object | ❌ | SystemLink deployment defaults used by `deploy` command |
|
|
186
374
|
|
|
187
375
|
### Example Configuration
|
|
188
376
|
|
|
@@ -200,10 +388,23 @@ Initialize a `nipkg.config.json` file in the current directory.
|
|
|
200
388
|
"depends": [
|
|
201
389
|
"ni-systemlink-server >= 2023.1"
|
|
202
390
|
],
|
|
203
|
-
"outputDir": "packages"
|
|
391
|
+
"outputDir": "packages",
|
|
392
|
+
"deployment": {
|
|
393
|
+
"host": "https://test.lifecyclesolutions.ni.com",
|
|
394
|
+
"name": "my-webapp",
|
|
395
|
+
"workspaceId": "45bc27cf-85c6-485c-945d-a51e664f511d",
|
|
396
|
+
"policyIds": [],
|
|
397
|
+
"properties": {
|
|
398
|
+
"description": "my webapp",
|
|
399
|
+
"version": "1.2.3"
|
|
400
|
+
},
|
|
401
|
+
"timeout": 30000
|
|
402
|
+
}
|
|
204
403
|
}
|
|
205
404
|
```
|
|
206
405
|
|
|
406
|
+
**Note:** The `outputDir` is used by the `deploy` command for automatic `.nipkg` file discovery.
|
|
407
|
+
|
|
207
408
|
## Framework Examples
|
|
208
409
|
|
|
209
410
|
### Non-Node.js Projects
|
|
@@ -359,7 +560,7 @@ jobs:
|
|
|
359
560
|
- name: Setup Node.js
|
|
360
561
|
uses: actions/setup-node@v3
|
|
361
562
|
with:
|
|
362
|
-
node-version: '
|
|
563
|
+
node-version: '20'
|
|
363
564
|
cache: 'npm'
|
|
364
565
|
|
|
365
566
|
- name: Install dependencies
|
|
@@ -392,7 +593,7 @@ pool:
|
|
|
392
593
|
steps:
|
|
393
594
|
- task: NodeTool@0
|
|
394
595
|
inputs:
|
|
395
|
-
versionSpec: '
|
|
596
|
+
versionSpec: '20.x'
|
|
396
597
|
|
|
397
598
|
- script: npm ci
|
|
398
599
|
displayName: 'Install dependencies'
|
|
@@ -432,7 +633,7 @@ your-webapp-project/
|
|
|
432
633
|
|
|
433
634
|
## Requirements
|
|
434
635
|
|
|
435
|
-
- Node.js
|
|
636
|
+
- Node.js 20+
|
|
436
637
|
|
|
437
638
|
## Development
|
|
438
639
|
|
|
@@ -460,6 +661,12 @@ sl-webapp-nipkg --help
|
|
|
460
661
|
|
|
461
662
|
### Common Issues
|
|
462
663
|
|
|
664
|
+
#### "API key is required"
|
|
665
|
+
|
|
666
|
+
- Run `sl-webapp-nipkg login --host <url>` to store credentials for this host, **or**
|
|
667
|
+
- Pass `--api-key "$SYSTEMLINK_API_KEY"` on the command line, **or**
|
|
668
|
+
- Set the `SYSTEMLINK_API_KEY` environment variable
|
|
669
|
+
|
|
463
670
|
#### "Build directory not found"
|
|
464
671
|
|
|
465
672
|
- Provide build directory via CLI: `--build-dir ./dist`
|
package/dist/cli.js
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import path from 'path';
|
|
6
|
+
import readline from 'readline';
|
|
7
|
+
import { Writable } from 'stream';
|
|
6
8
|
import chalk from 'chalk';
|
|
7
9
|
import { fileURLToPath } from 'url';
|
|
8
10
|
import { SystemLinkNipkgBuilder } from './builder.js';
|
|
11
|
+
import { SystemLinkWebAppDeployer } from './deployer.js';
|
|
12
|
+
import { SlApiClient } from './slApiClient.js';
|
|
13
|
+
import { setCredential, deleteCredential, normalizeHost } from './credentialStore.js';
|
|
9
14
|
const filename = fileURLToPath(import.meta.url);
|
|
10
15
|
const dirname = path.dirname(filename);
|
|
11
16
|
// Read version from package.json
|
|
@@ -102,10 +107,223 @@ async function generateConfigFromPackageJson() {
|
|
|
102
107
|
userVisible: true
|
|
103
108
|
};
|
|
104
109
|
}
|
|
110
|
+
program
|
|
111
|
+
.command('deploy')
|
|
112
|
+
.description('Deploy a nipkg file to SystemLink WebApp')
|
|
113
|
+
.option('--nipkg <path>', 'Path to a .nipkg file, or a directory to search for .nipkg files (falls back to config.outputDir)')
|
|
114
|
+
.option('-b, --build [command]', 'Run build command before deploying (optionally specify custom command)')
|
|
115
|
+
.option('--latest', 'Skip interactive selection and auto-pick the newest nipkg (for CI/CD)', false)
|
|
116
|
+
.option('--build-suffix <suffix>', 'Suffix appended to nipkg filename when --build is used (e.g., CI build ID)')
|
|
117
|
+
.option('--skip-cleanup', 'Skip cleanup of existing nipkg files when --build is used', false)
|
|
118
|
+
.option('--host <url>', 'SystemLink host URL (e.g., https://systemlink.example.com)')
|
|
119
|
+
.option('--api-key <key>', 'SystemLink API key for authentication')
|
|
120
|
+
.option('--name <name>', 'WebApp name (optional, falls back to displayName)')
|
|
121
|
+
.option('--version <version>', 'Package version (auto-detected from package.json, injected into properties.version)')
|
|
122
|
+
.option('--workspace-id <id>', 'Workspace UUID (required for create, optional for update)')
|
|
123
|
+
.option('--policy-ids <ids>', 'Policy IDs comma-separated (optional)')
|
|
124
|
+
.option('--properties <json>', 'Custom properties as JSON (optional for update)')
|
|
125
|
+
.option('--update', 'Update existing WebApp instead of creating new', false)
|
|
126
|
+
.option('--app-id <id>', 'WebApp ID to update (required with --update)')
|
|
127
|
+
.option('--config <path>', 'Path to nipkg config file', 'nipkg.config.json')
|
|
128
|
+
.option('-v, --verbose', 'Verbose output', false)
|
|
129
|
+
.option('--timeout <ms>', 'Request timeout in milliseconds', '30000')
|
|
130
|
+
.action(async (options) => {
|
|
131
|
+
try {
|
|
132
|
+
const configPath = path.resolve(options.config);
|
|
133
|
+
let config = {};
|
|
134
|
+
if (fs.existsSync(configPath)) {
|
|
135
|
+
config = await fs.readJson(configPath);
|
|
136
|
+
if (options.verbose) {
|
|
137
|
+
console.log(chalk.blue(`📋 Using config from: ${configPath}`));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (options.config !== 'nipkg.config.json') {
|
|
141
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
142
|
+
}
|
|
143
|
+
// Parse timeout to number
|
|
144
|
+
const timeoutMs = parseInt(options.timeout, 10);
|
|
145
|
+
if (isNaN(timeoutMs)) {
|
|
146
|
+
throw new Error('Invalid timeout value (must be a number in milliseconds)');
|
|
147
|
+
}
|
|
148
|
+
// Parse properties if provided as string
|
|
149
|
+
let parsedProperties;
|
|
150
|
+
if (options.properties) {
|
|
151
|
+
try {
|
|
152
|
+
parsedProperties = JSON.parse(options.properties);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw new Error(`Invalid properties JSON: ${error.message}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const deployOptions = {
|
|
159
|
+
nipkg: options.nipkg,
|
|
160
|
+
build: options.build,
|
|
161
|
+
latest: options.latest,
|
|
162
|
+
buildSuffix: options.buildSuffix,
|
|
163
|
+
skipCleanup: options.skipCleanup,
|
|
164
|
+
host: options.host,
|
|
165
|
+
apiKey: options.apiKey,
|
|
166
|
+
name: options.name,
|
|
167
|
+
version: options.version,
|
|
168
|
+
workspaceId: options.workspaceId,
|
|
169
|
+
policyIds: options.policyIds,
|
|
170
|
+
properties: parsedProperties,
|
|
171
|
+
update: options.update,
|
|
172
|
+
appId: options.appId,
|
|
173
|
+
verbose: options.verbose,
|
|
174
|
+
timeout: timeoutMs
|
|
175
|
+
};
|
|
176
|
+
const deployer = new SystemLinkWebAppDeployer(config, deployOptions);
|
|
177
|
+
await deployer.deploy();
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
console.error(chalk.red.bold('❌ Error:'), error.message);
|
|
181
|
+
process.exit(1);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
program
|
|
185
|
+
.command('delete')
|
|
186
|
+
.description('Delete a WebApp from SystemLink')
|
|
187
|
+
.requiredOption('--app-id <id>', 'WebApp ID to delete')
|
|
188
|
+
.option('--host <url>', 'SystemLink host URL')
|
|
189
|
+
.option('--api-key <key>', 'SystemLink API key for authentication')
|
|
190
|
+
.option('--config <path>', 'Path to nipkg config file', 'nipkg.config.json')
|
|
191
|
+
.option('-v, --verbose', 'Verbose output', false)
|
|
192
|
+
.option('--timeout <ms>', 'Request timeout in milliseconds', '30000')
|
|
193
|
+
.action(async (options) => {
|
|
194
|
+
try {
|
|
195
|
+
const configPath = path.resolve(options.config);
|
|
196
|
+
let config = {};
|
|
197
|
+
if (fs.existsSync(configPath)) {
|
|
198
|
+
config = await fs.readJson(configPath);
|
|
199
|
+
}
|
|
200
|
+
else if (options.config !== 'nipkg.config.json') {
|
|
201
|
+
throw new Error(`Config file not found: ${configPath}`);
|
|
202
|
+
}
|
|
203
|
+
const timeoutMs = parseInt(options.timeout, 10);
|
|
204
|
+
if (isNaN(timeoutMs)) {
|
|
205
|
+
throw new Error('Invalid timeout value (must be a number in milliseconds)');
|
|
206
|
+
}
|
|
207
|
+
const deployOptions = {
|
|
208
|
+
appId: options.appId,
|
|
209
|
+
host: options.host,
|
|
210
|
+
apiKey: options.apiKey,
|
|
211
|
+
verbose: options.verbose,
|
|
212
|
+
timeout: timeoutMs
|
|
213
|
+
};
|
|
214
|
+
const deployer = new SystemLinkWebAppDeployer(config, deployOptions);
|
|
215
|
+
await deployer.deleteWebApp();
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
console.error(chalk.red.bold('❌ Error:'), error.message);
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
105
222
|
// Handle unhandled promise rejections
|
|
106
223
|
process.on('unhandledRejection', (error) => {
|
|
107
224
|
console.error(chalk.red.bold('❌ Unhandled error:'), error);
|
|
108
225
|
process.exit(1);
|
|
109
226
|
});
|
|
227
|
+
/** Prompt for a value on stdout/stdin, returning the user's input. */
|
|
228
|
+
async function prompt(question) {
|
|
229
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
230
|
+
return await new Promise(resolve => {
|
|
231
|
+
rl.question(question, answer => {
|
|
232
|
+
rl.close();
|
|
233
|
+
resolve(answer);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/** Prompt for a secret value — input is not echoed to the terminal. */
|
|
238
|
+
async function promptSecret(question) {
|
|
239
|
+
return await new Promise(resolve => {
|
|
240
|
+
const muted = new Writable({
|
|
241
|
+
write(_chunk, _enc, cb) {
|
|
242
|
+
cb();
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const rl = readline.createInterface({ input: process.stdin, output: muted, terminal: true });
|
|
246
|
+
process.stdout.write(question);
|
|
247
|
+
rl.question('', answer => {
|
|
248
|
+
rl.close();
|
|
249
|
+
process.stdout.write('\n');
|
|
250
|
+
resolve(answer);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
program
|
|
255
|
+
.command('login')
|
|
256
|
+
.description('Authenticate with a SystemLink host and store credentials locally')
|
|
257
|
+
.option('--host <url>', 'SystemLink host URL (prompted if not provided)')
|
|
258
|
+
.option('--timeout <ms>', 'Request timeout in milliseconds', '30000')
|
|
259
|
+
.action(async (options) => {
|
|
260
|
+
try {
|
|
261
|
+
if (!process.stdin.isTTY) {
|
|
262
|
+
throw new Error('login requires an interactive terminal. Use --api-key or set SYSTEMLINK_API_KEY instead.');
|
|
263
|
+
}
|
|
264
|
+
const timeoutMs = parseInt(options.timeout, 10);
|
|
265
|
+
if (isNaN(timeoutMs)) {
|
|
266
|
+
throw new Error('Invalid timeout value (must be a number in milliseconds)');
|
|
267
|
+
}
|
|
268
|
+
let rawHost = options.host;
|
|
269
|
+
if (!rawHost) {
|
|
270
|
+
rawHost = await prompt('SystemLink host (e.g. https://systemlink.example.com): ');
|
|
271
|
+
}
|
|
272
|
+
const host = normalizeHost(rawHost);
|
|
273
|
+
if (!host) {
|
|
274
|
+
throw new Error('Host is required');
|
|
275
|
+
}
|
|
276
|
+
const apiKey = await promptSecret(`API key for ${host}: `);
|
|
277
|
+
if (!apiKey.trim()) {
|
|
278
|
+
throw new Error('API key is required');
|
|
279
|
+
}
|
|
280
|
+
console.log(chalk.cyan(`🔐 Verifying credentials for ${host}...`));
|
|
281
|
+
const client = new SlApiClient(host, apiKey.trim(), timeoutMs);
|
|
282
|
+
const result = await client.verifyAuth();
|
|
283
|
+
if (result.ok) {
|
|
284
|
+
await setCredential(host, apiKey.trim());
|
|
285
|
+
console.log(chalk.green.bold(`✅ Login successful! Credentials stored for ${host}`));
|
|
286
|
+
}
|
|
287
|
+
else if (result.status === 401) {
|
|
288
|
+
console.error(chalk.red.bold('❌ Invalid host or API key (401 Unauthorized). Credentials not stored.'));
|
|
289
|
+
process.exit(1);
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
console.error(chalk.red.bold(`❌ Unexpected response (HTTP ${result.status}). Credentials not stored.`));
|
|
293
|
+
process.exit(1);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
console.error(chalk.red.bold('❌ Error:'), error.message);
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
program
|
|
302
|
+
.command('logout')
|
|
303
|
+
.description('Remove stored credentials for a SystemLink host')
|
|
304
|
+
.option('--host <url>', 'SystemLink host URL (prompted if not provided)')
|
|
305
|
+
.action(async (options) => {
|
|
306
|
+
try {
|
|
307
|
+
let rawHost = options.host;
|
|
308
|
+
if (!rawHost) {
|
|
309
|
+
rawHost = await prompt('SystemLink host to log out from: ');
|
|
310
|
+
}
|
|
311
|
+
const host = normalizeHost(rawHost);
|
|
312
|
+
if (!host) {
|
|
313
|
+
throw new Error('Host is required');
|
|
314
|
+
}
|
|
315
|
+
const removed = await deleteCredential(host);
|
|
316
|
+
if (removed) {
|
|
317
|
+
console.log(chalk.green.bold(`✅ Logged out from ${host}`));
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
console.log(chalk.yellow(`⚠️ No stored credentials found for ${host}`));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
console.error(chalk.red.bold('❌ Error:'), error.message);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
110
328
|
program.parse();
|
|
111
329
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+BAA+B;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvC,iCAAiC;AACjC,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAwB,CAAC;AAEpG,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACF,IAAI,CAAC,iBAAiB,CAAC;KACvB,WAAW,CAAC,oFAAoF,CAAC;KACjG,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,mBAAmB,EAAE,aAAa,CAAC,CAAC;AAEtE,OAAO;KACF,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,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