@ni-kismet/sl-webapp-nipkg 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 National Instruments Corporation
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,518 @@
1
+ # SL WebApp NIPKG
2
+
3
+ [![npm version](https://badge.fury.io/js/sl-webapp-nipkg.svg)](https://badge.fury.io/js/sl-webapp-nipkg)
4
+ [![Tests](https://github.com/ni/sl-webapp-nipkg/actions/workflows/ci.yml/badge.svg)](https://github.com/ni/sl-webapp-nipkg/actions)
5
+ ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/ni/sl-webapp-nipkg?style=flat-square)
6
+ [![license](https://img.shields.io/github/license/ni/sl-webapp-nipkg.svg)](LICENSE)
7
+
8
+ A flexible tool for packaging web applications into SystemLink WebApp `.nipkg` format for National Instruments Package Manager. Works with any web application framework including Node.js (React, Angular, Vue), Python (Pyodide), .NET (Blazor), and static HTML sites.
9
+
10
+ ## Features
11
+
12
+ - 🚀 **Easy Integration**: Works seamlessly with any web application
13
+ - 📦 **Automated Packaging**: Builds and packages your app in one command
14
+ - ⚙️ **Flexible Configuration**: Optional config files - use CLI flags or JSON config
15
+ - 🎯 **TypeScript Support**: Written in TypeScript with full type definitions
16
+ - 🌈 **Beautiful CLI**: Colorful, informative command-line interface
17
+ - 🔧 **CI/CD Ready**: Easy integration with build pipelines
18
+ - 🌍 **Cross-Platform**: Works on Windows, macOS, and Linux without external dependencies
19
+ - 🔌 **Framework Agnostic**: Works with React, Angular, Vue, Blazor, Pyodide, static HTML, and more
20
+ - 🎨 **Zero Config**: No config files required - just point to your build directory
21
+
22
+ ## Prerequisites
23
+
24
+ - Node.js 16 or higher (only to run the packaging tool)
25
+
26
+ ## Installation
27
+
28
+ ### Global Installation (Recommended)
29
+
30
+ ```bash
31
+ npm install -g @ni-kismet/sl-webapp-nipkg
32
+ ```
33
+
34
+ ### Project-specific Installation
35
+
36
+ ```bash
37
+ # As a dev dependency in your project
38
+ npm install --save-dev @ni-kismet/sl-webapp-nipkg
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ### Option 1: Minimal Usage (No Config Files)
44
+
45
+ ```bash
46
+ # Package any web application - just point to the build directory
47
+ sl-webapp-nipkg build --build-dir ./dist --name my-app
48
+
49
+ # With full metadata
50
+ sl-webapp-nipkg build \
51
+ --build-dir ./dist \
52
+ --name "My WebApp" \
53
+ --version "1.0.0" \
54
+ --maintainer "Your Name <name@example.com>"
55
+ ```
56
+
57
+ ### Option 2: With Configuration File (Recommended for Node.js projects)
58
+
59
+ 1. **Navigate to your project**:
60
+
61
+ ```bash
62
+ cd my-webapp-project
63
+ ```
64
+
65
+ 2. **Initialize configuration** (optional):
66
+
67
+ ```bash
68
+ sl-webapp-nipkg init
69
+ ```
70
+
71
+ 3. **Edit the generated `nipkg.config.json`** (all fields optional):
72
+
73
+ ```json
74
+ {
75
+ "maintainer": "John Doe <john.doe@company.com>",
76
+ "displayName": "My WebApp",
77
+ "buildDir": "dist",
78
+ "buildCommand": "npm run build",
79
+ "userVisible": true
80
+ }
81
+ ```
82
+
83
+ **Note:** The `name`, `version`, and `description` are auto-detected from your `package.json` if present.
84
+
85
+ 4. **Build and package**:
86
+
87
+ ```bash
88
+ sl-webapp-nipkg build --build
89
+ ```
90
+
91
+ ## CLI Commands
92
+
93
+ ### `sl-webapp-nipkg build`
94
+
95
+ Build and package your web application.
96
+
97
+ #### Options
98
+
99
+ **Core Options:**
100
+
101
+ - `--build-dir <path>` - Build output directory to package (required if not in config)
102
+ - `--name <name>` - Package name (auto-detected from package.json or directory name)
103
+ - `--version <version>` - Package version (auto-detected from package.json or defaults to 1.0.0)
104
+ - `--description <description>` - Package description (optional)
105
+ - `--maintainer <maintainer>` - Maintainer info (defaults to 'Unknown')
106
+ - `--output-dir <path>` - Output directory for nipkg files (default: dist/nipkg)
107
+
108
+ **Build Options:**
109
+
110
+ - `-b, --build [command]` - Run build command before packaging (optionally specify custom command to override config)
111
+ - `-v, --verbose` - Enable verbose output
112
+ - `--skip-cleanup` - Skip cleanup of existing packages
113
+ - `--build-suffix <suffix>` - Add a suffix to the package name (e.g., build ID for CI/CD)
114
+ - `--config <path>` - Custom config file path (default: 'nipkg.config.json')
115
+
116
+ **Note:** CLI options override config file values, which override package.json values.
117
+
118
+ #### Examples
119
+
120
+ **Node.js Projects:**
121
+
122
+ ```bash
123
+ # Build and package (runs buildCommand from config)
124
+ sl-webapp-nipkg build --build
125
+
126
+ # Build with custom command (overrides config)
127
+ sl-webapp-nipkg build --build "npm run build:production"
128
+
129
+ # Use existing build output (no build step)
130
+ sl-webapp-nipkg build
131
+
132
+ # Build with build ID suffix for CI/CD
133
+ sl-webapp-nipkg build --build --build-suffix "${BUILD_ID}"
134
+
135
+ # Verbose output with custom config
136
+ sl-webapp-nipkg build --build --verbose --config my-nipkg.config.json
137
+ ```
138
+
139
+ **Non-Node.js Projects (Python, Blazor, Static Sites):**
140
+
141
+ ```bash
142
+ # Python Pyodide webapp
143
+ sl-webapp-nipkg build --build-dir ./public --name my-pyodide-app
144
+
145
+ # .NET Blazor webapp
146
+ sl-webapp-nipkg build \
147
+ --build-dir ./bin/Release/net8.0/publish \
148
+ --name "My Blazor App" \
149
+ --version "2.0.0"
150
+
151
+ # Static HTML site
152
+ sl-webapp-nipkg build --build-dir ./dist --name my-static-site --version 1.0.0
153
+
154
+ # With full metadata
155
+ sl-webapp-nipkg build \
156
+ --build-dir ./output \
157
+ --name "My WebApp" \
158
+ --version "1.5.0" \
159
+ --description "My awesome webapp" \
160
+ --maintainer "Team <team@company.com>"
161
+ ```
162
+
163
+ ### `sl-webapp-nipkg init`
164
+
165
+ Initialize a `nipkg.config.json` file in the current directory.
166
+
167
+ ## Configuration
168
+
169
+ ### Configuration File (`nipkg.config.json`)
170
+
171
+ **All fields are optional.** CLI options override config file values. Config file values override package.json auto-detection.
172
+
173
+ | Property | Type | Required | Description |
174
+ | -------- | ---- | -------- | ----------- |
175
+ | `name` | string | ❌ | Package name (auto-detected from package.json or directory name) |
176
+ | `version` | string | ❌ | Package version (auto-detected from package.json, defaults to 1.0.0) |
177
+ | `description` | string | ❌ | Package description (auto-detected from package.json, defaults to empty) |
178
+ | `maintainer` | string | ❌ | Maintainer information (defaults to 'Unknown') |
179
+ | `architecture` | string | ❌ | Target architecture (default: 'all') |
180
+ | `displayName` | string | ❌ | Display name for the package |
181
+ | `buildDir` | string | ❌* | Build output directory (e.g., 'dist', 'build') - *Required if not provided via CLI |
182
+ | `buildCommand` | string | ❌ | Custom build command (default: 'npm run build') |
183
+ | `outputDir` | string | ❌ | Custom nipkg output directory (default: 'dist/nipkg') |
184
+ | `buildSuffix` | string | ❌ | Optional suffix for package filename (e.g., build ID for CI/CD) |
185
+ | `depends` | string[] | ❌ | Package dependencies |
186
+ | `userVisible` | boolean | ❌ | Whether package is user visible |
187
+
188
+ ### Example Configuration
189
+
190
+ ```json
191
+ {
192
+ "name": "my-webapp",
193
+ "version": "1.2.3",
194
+ "description": "A SystemLink WebApp for National Instruments",
195
+ "maintainer": "John Doe <john.doe@company.com>",
196
+ "architecture": "all",
197
+ "displayName": "My WebApp",
198
+ "buildDir": "dist",
199
+ "buildCommand": "npm run build",
200
+ "userVisible": true,
201
+ "depends": [
202
+ "ni-systemlink-server >= 2023.1"
203
+ ],
204
+ "outputDir": "packages"
205
+ }
206
+ ```
207
+
208
+ ## Framework Examples
209
+
210
+ ### Non-Node.js Projects
211
+
212
+ **Python Pyodide:**
213
+
214
+ ```bash
215
+ # No config file needed
216
+ sl-webapp-nipkg build \
217
+ --build-dir ./public \
218
+ --name my-pyodide-app \
219
+ --version 1.0.0 \
220
+ --maintainer "Python Team <team@example.com>"
221
+ ```
222
+
223
+ **.NET Blazor:**
224
+
225
+ ```bash
226
+ # Package Blazor WebAssembly output
227
+ sl-webapp-nipkg build \
228
+ --build-dir ./bin/Release/net8.0/publish/wwwroot \
229
+ --name my-blazor-app \
230
+ --version 2.0.0
231
+ ```
232
+
233
+ **Static HTML:**
234
+
235
+ ```bash
236
+ # Package any static web content
237
+ sl-webapp-nipkg build --build-dir ./dist --name my-static-site
238
+ ```
239
+
240
+ ### Node.js Projects
241
+
242
+ **React:**
243
+
244
+ ```json
245
+ {
246
+ "maintainer": "Your Name <your.email@company.com>",
247
+ "buildDir": "build",
248
+ "buildCommand": "npm run build"
249
+ }
250
+ ```
251
+
252
+ ### Vue
253
+
254
+ ```json
255
+ {
256
+ "maintainer": "Your Name <your.email@company.com>",
257
+ "buildDir": "dist",
258
+ "buildCommand": "npm run build"
259
+ }
260
+ ```
261
+
262
+ ### Angular
263
+
264
+ ```json
265
+ {
266
+ "maintainer": "Your Name <your.email@company.com>",
267
+ "buildDir": "dist/my-app/browser",
268
+ "buildCommand": "npm run build"
269
+ }
270
+ ```
271
+
272
+ **Note:** For Angular projects, specify the build configuration in `buildCommand`: `"buildCommand": "ng build --configuration production"` or use an npm script like `"build": "ng build --configuration production"` and let the default `npm run build` work.
273
+
274
+ ### Next.js
275
+
276
+ ```json
277
+ {
278
+ "maintainer": "Your Name <your.email@company.com>",
279
+ "buildDir": "out",
280
+ "buildCommand": "npm run build && npm run export"
281
+ }
282
+ ```
283
+
284
+ ## Integration with Node.js Projects
285
+
286
+ ### Add to package.json Scripts
287
+
288
+ ```json
289
+ {
290
+ "scripts": {
291
+ "start": "npm run dev",
292
+ "dev": "vite",
293
+ "build": "vite build",
294
+ "build:nipkg": "sl-webapp-nipkg build --build",
295
+ "package:nipkg": "sl-webapp-nipkg build"
296
+ }
297
+ }
298
+ ```
299
+
300
+ ### Use in npm Scripts
301
+
302
+ ```bash
303
+ # Build and package for production
304
+ npm run build:nipkg
305
+
306
+ # Package existing build
307
+ npm run package:nipkg
308
+ ```
309
+
310
+ ## Programmatic Usage
311
+
312
+ ```typescript
313
+ import { SystemLinkNipkgBuilder, NipkgConfig, BuildOptions } from '@ni-kismet/sl-webapp-nipkg';
314
+
315
+ const config: NipkgConfig = {
316
+ name: 'my-app',
317
+ version: '1.0.0',
318
+ description: 'My SystemLink WebApp',
319
+ maintainer: 'John Doe <john@example.com>',
320
+ buildDir: 'dist',
321
+ userVisible: true
322
+ };
323
+
324
+ const options: BuildOptions = {
325
+ build: true,
326
+ verbose: true
327
+ };
328
+
329
+ const builder = new SystemLinkNipkgBuilder(config, options);
330
+ await builder.build();
331
+ ```
332
+
333
+ ## CI/CD Integration
334
+
335
+ The `--build-suffix` option allows you to create unique package names for PR/branch builds while keeping clean names for production releases.
336
+
337
+ **Output examples:**
338
+
339
+ - PR builds: `my-app_1.0.0_12345_all.nipkg` (includes build ID)
340
+ - Main/production: `my-app_1.0.0_all.nipkg` (standard naming)
341
+
342
+ ### GitHub Actions
343
+
344
+ ```yaml
345
+ name: Build and Package
346
+
347
+ on:
348
+ push:
349
+ branches: [ main ]
350
+ pull_request:
351
+ branches: [ main ]
352
+
353
+ jobs:
354
+ build:
355
+ runs-on: windows-latest
356
+
357
+ steps:
358
+ - uses: actions/checkout@v3
359
+
360
+ - name: Setup Node.js
361
+ uses: actions/setup-node@v3
362
+ with:
363
+ node-version: '18'
364
+ cache: 'npm'
365
+
366
+ - name: Install dependencies
367
+ run: npm ci
368
+
369
+ - name: Build and Package (PR)
370
+ if: github.event_name == 'pull_request'
371
+ run: sl-webapp-nipkg build --build --build-suffix "${{ github.run_number }}"
372
+
373
+ - name: Build and Package (Main)
374
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
375
+ run: sl-webapp-nipkg build --build
376
+
377
+ - name: Upload Package
378
+ uses: actions/upload-artifact@v3
379
+ with:
380
+ name: nipkg-package
381
+ path: dist/nipkg/*.nipkg
382
+ ```
383
+
384
+ ### Azure DevOps
385
+
386
+ ```yaml
387
+ trigger:
388
+ - main
389
+
390
+ pool:
391
+ vmImage: 'windows-latest'
392
+
393
+ steps:
394
+ - task: NodeTool@0
395
+ inputs:
396
+ versionSpec: '18.x'
397
+
398
+ - script: npm ci
399
+ displayName: 'Install dependencies'
400
+
401
+ - script: |
402
+ if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
403
+ npm run build
404
+ sl-webapp-nipkg build
405
+ else
406
+ npm run build
407
+ sl-webapp-nipkg build --build-suffix "$(Build.BuildId)"
408
+ fi
409
+ displayName: 'Build and package'
410
+
411
+ - task: PublishBuildArtifacts@1
412
+ inputs:
413
+ PathtoPublish: 'dist/nipkg'
414
+ ArtifactName: 'nipkg-package'
415
+ ```
416
+
417
+ ## Package Structure
418
+
419
+ After packaging, your project will have this structure:
420
+
421
+ ```text
422
+ your-webapp-project/
423
+ ├── dist/ # Your build output
424
+ │ ├── index.html
425
+ │ ├── assets/
426
+ │ └── ...
427
+ ├── dist/nipkg/ # NIPKG packaging
428
+ │ ├── your-app_1.0.0_all.nipkg # Final package
429
+ │ └── temp-source/ # Temporary (auto-cleaned)
430
+ ├── nipkg.config.json # Package configuration
431
+ └── package.json # NPM scripts
432
+ ```
433
+
434
+ ## Requirements
435
+
436
+ - Node.js 16+
437
+ - National Instruments Package Manager (nipkg)
438
+
439
+ ## Development
440
+
441
+ ### Building from Source
442
+
443
+ ```bash
444
+ git clone https://github.com/ni/sl-webapp-nipkg.git
445
+ cd sl-webapp-nipkg
446
+ npm install
447
+ npm run build
448
+ ```
449
+
450
+ ### Running Tests
451
+
452
+ ```bash
453
+ # Run all tests
454
+ npm test
455
+
456
+ # Run tests with coverage
457
+ npm run test:coverage
458
+
459
+ # Run tests in watch mode
460
+ npm run test:watch
461
+ ```
462
+
463
+ ### Local Development
464
+
465
+ ```bash
466
+ # Link globally for testing
467
+ npm link
468
+
469
+ # Use in any Node.js project
470
+ cd /path/to/your/project
471
+ sl-webapp-nipkg --help
472
+ ```
473
+
474
+ ## Troubleshooting
475
+
476
+ ### Common Issues
477
+
478
+ #### "Build directory not found"
479
+
480
+ - Provide build directory via CLI: `--build-dir ./dist`
481
+ - Or run with `--build` flag to build before packaging
482
+ - Check that your build command runs successfully
483
+ - Verify `buildDir` in nipkg.config.json points to the correct directory
484
+
485
+ #### "buildDir is required"
486
+
487
+ - Provide via CLI: `sl-webapp-nipkg build --build-dir ./dist`
488
+ - Or add to nipkg.config.json: `"buildDir": "dist"`
489
+
490
+ #### Package dependencies missing
491
+
492
+ - Add required NI runtime dependencies to `depends` array in config
493
+ - Example: `"depends": ["ni-systemlink-server >= 2023.1"]`
494
+
495
+ ## Contributing
496
+
497
+ 1. Fork the repository
498
+ 2. Create a feature branch: `git checkout -b feature/amazing-feature`
499
+ 3. Make your changes
500
+ 4. Add tests for your changes
501
+ 5. Ensure tests pass: `npm test`
502
+ 6. Commit your changes: `git commit -m 'Add amazing feature'`
503
+ 7. Push to the branch: `git push origin feature/amazing-feature`
504
+ 8. Submit a pull request
505
+
506
+ ## License
507
+
508
+ MIT © National Instruments
509
+
510
+ ## Support
511
+
512
+ - 📚 [Documentation](https://github.com/ni/sl-webapp-nipkg/wiki)
513
+ - 🐛 [Report Issues](https://github.com/ni/sl-webapp-nipkg/issues)
514
+ - 💬 [Discussions](https://github.com/ni/sl-webapp-nipkg/discussions)
515
+
516
+ ---
517
+
518
+ *Made with ❤️ for the National Instruments community*
@@ -0,0 +1,40 @@
1
+ import { NipkgConfig, BuildOptions } from './types.js';
2
+ export declare class SystemLinkNipkgBuilder {
3
+ private readonly config;
4
+ private readonly options;
5
+ private readonly projectRoot;
6
+ constructor(config: NipkgConfig, options?: BuildOptions);
7
+ /**
8
+ * Build the complete nipkg package
9
+ */
10
+ build(): Promise<void>;
11
+ /**
12
+ * Get the package name from CLI options, config, or package.json
13
+ */
14
+ private getName;
15
+ /**
16
+ * Get the package description from CLI options, config, or package.json
17
+ */
18
+ private getDescription;
19
+ /**
20
+ * Get the package version from CLI options, config, or package.json
21
+ */
22
+ private getVersion;
23
+ /**
24
+ * Get the maintainer from CLI options, config, or use default
25
+ */
26
+ private getMaintainer;
27
+ /**
28
+ * Run project build command
29
+ */
30
+ private runProjectBuild;
31
+ /**
32
+ * Prepare source directory with ApplicationFiles_64 structure
33
+ */
34
+ private prepareSourceDirectory;
35
+ /**
36
+ * Package the application into .nipkg format
37
+ */
38
+ private packageApplication;
39
+ }
40
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAMvD,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAEzB,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,YAAiB;IAM3D;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBnC;;OAEG;IACH,OAAO,CAAC,OAAO;IA4Bf;;OAEG;IACH,OAAO,CAAC,cAAc;IA0BtB;;OAEG;IACH,OAAO,CAAC,UAAU;IA2BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqCvB;;OAEG;YACW,sBAAsB;IAwCpC;;OAEG;YACW,kBAAkB;CAkEnC"}
@@ -0,0 +1,264 @@
1
+ /* eslint-disable no-console */
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { execSync } from 'child_process';
5
+ import chalk from 'chalk';
6
+ import { createRequire } from 'node:module';
7
+ const require = createRequire(import.meta.url);
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ const { Deboa } = require('deboa');
10
+ export class SystemLinkNipkgBuilder {
11
+ config;
12
+ options;
13
+ projectRoot;
14
+ constructor(config, options = {}) {
15
+ this.config = config;
16
+ this.options = options;
17
+ this.projectRoot = process.cwd();
18
+ }
19
+ /**
20
+ * Build the complete nipkg package
21
+ */
22
+ async build() {
23
+ try {
24
+ console.log(chalk.cyan('🚀 Starting nipkg build process...'));
25
+ // Run custom build command if requested
26
+ this.runProjectBuild();
27
+ // Set up output directory
28
+ const outputDir = this.options.outputDir || this.config.outputDir || path.join(this.projectRoot, 'dist');
29
+ await fs.ensureDir(outputDir);
30
+ const nipkgDir = path.join(outputDir, 'nipkg');
31
+ await fs.ensureDir(nipkgDir);
32
+ // Package the application
33
+ await this.packageApplication(nipkgDir);
34
+ console.log(chalk.green.bold('🎯 Nipkg build completed successfully!'));
35
+ }
36
+ catch (error) {
37
+ console.error(chalk.red.bold('❌ Build failed:'), error.message);
38
+ process.exit(1);
39
+ }
40
+ }
41
+ /**
42
+ * Get the package name from CLI options, config, or package.json
43
+ */
44
+ getName() {
45
+ // Priority: CLI option > config > package.json > directory name
46
+ if (this.options.name) {
47
+ return this.options.name;
48
+ }
49
+ // If name is explicitly set in config, use it
50
+ if (this.config.name) {
51
+ return this.config.name;
52
+ }
53
+ // Otherwise, try to read from package.json
54
+ try {
55
+ const packageJson = fs.readJsonSync(path.join(this.projectRoot, 'package.json'));
56
+ if (packageJson.name !== undefined && packageJson.name !== '') {
57
+ console.log(chalk.cyan(`📦 Using name "${packageJson.name}" from package.json`));
58
+ return packageJson.name;
59
+ }
60
+ }
61
+ catch (_error) {
62
+ // Fall through
63
+ }
64
+ // Default to current directory name
65
+ const dirName = path.basename(this.projectRoot);
66
+ console.log(chalk.yellow(`⚠️ No package name found, using directory name: "${dirName}"`));
67
+ return dirName;
68
+ }
69
+ /**
70
+ * Get the package description from CLI options, config, or package.json
71
+ */
72
+ getDescription() {
73
+ // Priority: CLI option > config > package.json > empty string
74
+ if (this.options.description) {
75
+ return this.options.description;
76
+ }
77
+ // If description is explicitly set in config, use it
78
+ if (this.config.description) {
79
+ return this.config.description;
80
+ }
81
+ // Otherwise, try to read from package.json
82
+ try {
83
+ const packageJson = fs.readJsonSync(path.join(this.projectRoot, 'package.json'));
84
+ if (packageJson.description !== undefined && packageJson.description !== '') {
85
+ console.log(chalk.cyan('📦 Using description from package.json'));
86
+ return packageJson.description;
87
+ }
88
+ }
89
+ catch (_error) {
90
+ // Fall through
91
+ }
92
+ // Default to empty string if not found anywhere
93
+ return '';
94
+ }
95
+ /**
96
+ * Get the package version from CLI options, config, or package.json
97
+ */
98
+ getVersion() {
99
+ // Priority: CLI option > config > package.json > default
100
+ if (this.options.version) {
101
+ return this.options.version;
102
+ }
103
+ // If version is explicitly set in config, use it
104
+ if (this.config.version) {
105
+ return this.config.version;
106
+ }
107
+ // Otherwise, try to read from package.json
108
+ try {
109
+ const packageJson = fs.readJsonSync(path.join(this.projectRoot, 'package.json'));
110
+ if (packageJson.version !== undefined && packageJson.version !== '') {
111
+ console.log(chalk.cyan(`📦 Using version ${packageJson.version} from package.json`));
112
+ return packageJson.version;
113
+ }
114
+ }
115
+ catch (_error) {
116
+ // Fall through
117
+ }
118
+ // Default to 1.0.0 if not found anywhere
119
+ console.log(chalk.yellow('⚠️ No version found, defaulting to 1.0.0'));
120
+ return '1.0.0';
121
+ }
122
+ /**
123
+ * Get the maintainer from CLI options, config, or use default
124
+ */
125
+ getMaintainer() {
126
+ // Priority: CLI option > config > default
127
+ if (this.options.maintainer) {
128
+ return this.options.maintainer;
129
+ }
130
+ if (this.config.maintainer) {
131
+ return this.config.maintainer;
132
+ }
133
+ // Default maintainer if not specified
134
+ console.log(chalk.yellow('⚠️ No maintainer specified, using default'));
135
+ return 'Unknown <unknown@example.com>';
136
+ }
137
+ /**
138
+ * Run project build command
139
+ */
140
+ runProjectBuild() {
141
+ // Skip if build option not provided (undefined) or explicitly false
142
+ // build can be: undefined (not provided), true (--build), or string (--build "cmd")
143
+ if (this.options.build === false || this.options.build === undefined) {
144
+ return;
145
+ }
146
+ console.log(chalk.blue('🔨 Building application...'));
147
+ try {
148
+ // Priority: CLI option (if string) > config > default
149
+ let buildCmd = 'npm run build';
150
+ let cmdSource = 'default';
151
+ if (typeof this.config.buildCommand === 'string' && this.config.buildCommand !== '') {
152
+ buildCmd = this.config.buildCommand;
153
+ cmdSource = 'config';
154
+ }
155
+ if (typeof this.options.build === 'string' && this.options.build !== '') {
156
+ buildCmd = this.options.build;
157
+ cmdSource = 'CLI';
158
+ }
159
+ if (cmdSource === 'default') {
160
+ console.log(chalk.yellow('⚠️ No build command specified, using default: npm run build'));
161
+ console.log(chalk.gray(' 💡 Tip: Add "buildCommand" to nipkg.config.json or use --build "your-command"'));
162
+ }
163
+ else {
164
+ console.log(chalk.cyan(`🔧 Using build command from ${cmdSource}: ${buildCmd}`));
165
+ }
166
+ execSync(buildCmd, { stdio: this.options.verbose ? 'inherit' : 'pipe' });
167
+ console.log(chalk.green('✅ Build completed successfully'));
168
+ }
169
+ catch (error) {
170
+ throw new Error(`Build failed: ${error.message}`);
171
+ }
172
+ }
173
+ /**
174
+ * Prepare source directory with ApplicationFiles_64 structure
175
+ */
176
+ async prepareSourceDirectory(nipkgDir) {
177
+ // Priority: CLI option > config
178
+ const buildDir = this.options.buildDir || this.config.buildDir;
179
+ if (!buildDir) {
180
+ throw new Error('buildDir is required.\n'
181
+ + 'Provide it via CLI: --build-dir <path>\n'
182
+ + 'Or add it to nipkg.config.json:\n'
183
+ + ' "buildDir": "dist"\n'
184
+ + ' or "buildDir": "build"\n\n'
185
+ + 'This should point to your application\'s build output directory.');
186
+ }
187
+ if (!fs.existsSync(buildDir)) {
188
+ throw new Error(`Build directory not found: ${buildDir}\n`
189
+ + 'Run your build command first or use --build flag.');
190
+ }
191
+ // Create temporary source directory with the required structure
192
+ const sourceDir = path.join(nipkgDir, 'temp-source');
193
+ const applicationFilesDir = path.join(sourceDir, 'ApplicationFiles_64');
194
+ // Clean up if exists
195
+ if (await fs.pathExists(sourceDir)) {
196
+ await fs.remove(sourceDir);
197
+ }
198
+ await fs.ensureDir(applicationFilesDir);
199
+ console.log(chalk.blue('📋 Copying build files...'));
200
+ await fs.copy(buildDir, applicationFilesDir, { overwrite: true });
201
+ console.log(chalk.green('✅ Build files copied'));
202
+ return sourceDir;
203
+ }
204
+ /**
205
+ * Package the application into .nipkg format
206
+ */
207
+ async packageApplication(nipkgDir) {
208
+ // Clean up existing packages
209
+ if (!this.options.skipCleanup) {
210
+ const existingPackages = (await fs.readdir(nipkgDir))
211
+ .filter((file) => file.endsWith('.nipkg') || file.endsWith('.deb'));
212
+ await Promise.all(existingPackages.map(async (pkg) => {
213
+ await fs.remove(path.join(nipkgDir, pkg));
214
+ console.log(chalk.yellow(`🗑️ Removed existing package: ${pkg}`));
215
+ }));
216
+ }
217
+ console.log(chalk.blue('📦 Packaging application...'));
218
+ try {
219
+ // Prepare source directory with ApplicationFiles_64 structure
220
+ const sourceDir = await this.prepareSourceDirectory(nipkgDir);
221
+ const architecture = this.config.architecture || 'all';
222
+ // Build package name with optional suffix (CLI option takes precedence over config)
223
+ const suffix = this.options.buildSuffix || this.config.buildSuffix;
224
+ const packageName = suffix
225
+ ? `${this.getName()}_${this.getVersion()}.${suffix}_${architecture}`
226
+ : `${this.getName()}_${this.getVersion()}_${architecture}`;
227
+ const debPath = path.join(nipkgDir, `${packageName}.deb`);
228
+ const nipkgPath = path.join(nipkgDir, `${packageName}.nipkg`);
229
+ // Build control file options
230
+ const depends = this.config.depends ? this.config.depends.join(', ') : undefined;
231
+ const controlFileOptions = {
232
+ maintainer: this.getMaintainer(),
233
+ packageName: this.getName(),
234
+ shortDescription: this.getDescription(),
235
+ version: this.getVersion(),
236
+ architecture,
237
+ ...(depends && { depends }),
238
+ ...(this.config.displayName && { displayName: this.config.displayName }),
239
+ ...(this.config.userVisible && { userVisible: String(this.config.userVisible) }),
240
+ };
241
+ // Use Deboa to create the .deb file
242
+ if (this.options.verbose) {
243
+ console.log(chalk.gray(' Creating .deb package...'));
244
+ }
245
+ const deboa = new Deboa({
246
+ controlFileOptions,
247
+ sourceDir,
248
+ targetDir: nipkgDir,
249
+ targetFileName: `${packageName}`,
250
+ });
251
+ await deboa.package();
252
+ // Clean up temp source directory
253
+ await fs.remove(sourceDir);
254
+ // Rename .deb to .nipkg
255
+ await fs.rename(debPath, nipkgPath);
256
+ console.log(chalk.green(`🎉 Successfully created package: ${packageName}.nipkg`));
257
+ console.log(chalk.cyan(`📍 Package location: ${nipkgPath}`));
258
+ }
259
+ catch (error) {
260
+ throw new Error(`Packaging failed: ${error.message}`);
261
+ }
262
+ }
263
+ }
264
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAA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C,WAAW,QAAQ,CAAC,CAAC,CAAC;YAClF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,qBAAsB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACrE,CAAC;IACL,CAAC;CACJ"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-console */
3
+ import { Command } from 'commander';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import chalk from 'chalk';
7
+ import { fileURLToPath } from 'url';
8
+ import { SystemLinkNipkgBuilder } from './builder.js';
9
+ const filename = fileURLToPath(import.meta.url);
10
+ const dirname = path.dirname(filename);
11
+ // Read version from package.json
12
+ const packageJson = await fs.readJson(path.join(dirname, '../package.json'));
13
+ const program = new Command();
14
+ program
15
+ .name('sl-webapp-nipkg')
16
+ .description('Build tool for packaging Node.js applications into SystemLink WebApp .nipkg format')
17
+ .version(packageJson.version);
18
+ program
19
+ .command('build')
20
+ .description('Build and package application as SystemLink WebApp .nipkg')
21
+ .option('-b, --build [command]', 'Run build command before packaging (optionally specify custom command)')
22
+ .option('-v, --verbose', 'Verbose output', false)
23
+ .option('--skip-cleanup', 'Skip cleanup of existing packages', false)
24
+ .option('--build-suffix <suffix>', 'Add a suffix to the package name (e.g., build ID)')
25
+ .option('--config <path>', 'Path to nipkg config file', 'nipkg.config.json')
26
+ .option('--build-dir <path>', 'Build output directory to package')
27
+ .option('--name <name>', 'Package name')
28
+ .option('--version <version>', 'Package version')
29
+ .option('--description <description>', 'Package description')
30
+ .option('--maintainer <maintainer>', 'Maintainer information')
31
+ .option('--output-dir <path>', 'Output directory for nipkg files')
32
+ .action(async (options) => {
33
+ try {
34
+ const configPath = path.resolve(options.config);
35
+ let config = {};
36
+ if (fs.existsSync(configPath)) {
37
+ config = await fs.readJson(configPath);
38
+ console.log(chalk.blue(`📋 Using config from: ${configPath}`));
39
+ }
40
+ else if (options.config !== 'nipkg.config.json') {
41
+ // If user specified a custom config path and it doesn't exist, throw error
42
+ throw new Error(`Config file not found: ${configPath}`);
43
+ }
44
+ else {
45
+ // No config file found, will rely on CLI options and defaults
46
+ console.log(chalk.yellow('⚠️ No nipkg.config.json found, using CLI options and defaults'));
47
+ }
48
+ const buildOptions = {
49
+ build: options.build,
50
+ verbose: options.verbose,
51
+ skipCleanup: options.skipCleanup,
52
+ buildSuffix: options.buildSuffix,
53
+ buildDir: options.buildDir,
54
+ name: options.name,
55
+ version: options.version,
56
+ description: options.description,
57
+ maintainer: options.maintainer,
58
+ outputDir: options.outputDir
59
+ };
60
+ const builder = new SystemLinkNipkgBuilder(config, buildOptions);
61
+ await builder.build();
62
+ }
63
+ catch (error) {
64
+ console.error(chalk.red.bold('❌ Error:'), error.message);
65
+ process.exit(1);
66
+ }
67
+ });
68
+ program
69
+ .command('init')
70
+ .description('Initialize nipkg.config.json in current directory')
71
+ .action(async () => {
72
+ try {
73
+ const configPath = path.resolve('nipkg.config.json');
74
+ if (fs.existsSync(configPath)) {
75
+ console.log(chalk.yellow('⚠️ nipkg.config.json already exists'));
76
+ return;
77
+ }
78
+ const config = await generateConfigFromPackageJson();
79
+ await fs.writeJson(configPath, config, { spaces: 2 });
80
+ console.log(chalk.green('✅ Created nipkg.config.json'));
81
+ console.log(chalk.cyan('💡 Edit the file to customize your package configuration'));
82
+ }
83
+ catch (error) {
84
+ console.error(chalk.red.bold('❌ Error:'), error.message);
85
+ process.exit(1);
86
+ }
87
+ });
88
+ async function generateConfigFromPackageJson() {
89
+ const packageJsonPath = path.resolve('package.json');
90
+ let projectPackageJson = {};
91
+ if (fs.existsSync(packageJsonPath)) {
92
+ projectPackageJson = await fs.readJson(packageJsonPath);
93
+ }
94
+ const projectName = projectPackageJson.name || path.basename(process.cwd());
95
+ const maintainer = projectPackageJson.author;
96
+ return {
97
+ ...(maintainer && { maintainer }),
98
+ architecture: 'all',
99
+ displayName: projectName,
100
+ buildDir: 'dist',
101
+ buildCommand: 'npm run build',
102
+ userVisible: true
103
+ };
104
+ }
105
+ // Handle unhandled promise rejections
106
+ process.on('unhandledRejection', (error) => {
107
+ console.error(chalk.red.bold('❌ Unhandled error:'), error);
108
+ process.exit(1);
109
+ });
110
+ program.parse();
111
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +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,C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EAAE,CAAC,oBAAoB,EAAE,CAAC,KAAc,EAAE,EAAE;IAChD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './builder.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './builder.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,119 @@
1
+ export interface NipkgConfig {
2
+ /**
3
+ * Package name.
4
+ * @remarks Auto-detected from package.json if not provided. Falls back to directory name if package.json is not found.
5
+ */
6
+ name?: string;
7
+ /**
8
+ * Package version.
9
+ * @remarks Auto-detected from package.json if not provided.
10
+ * @defaultValue `1.0.0`
11
+ */
12
+ version?: string;
13
+ /**
14
+ * Package description.
15
+ * @remarks Auto-detected from package.json if not provided.
16
+ */
17
+ description?: string;
18
+ /**
19
+ * Maintainer information.
20
+ * @remarks Optional.
21
+ * @defaultValue `Unknown <unknown@example.com>`
22
+ */
23
+ maintainer?: string;
24
+ /**
25
+ * Package architecture.
26
+ * @defaultValue `all`
27
+ */
28
+ architecture?: string;
29
+ /**
30
+ * Display name for the package.
31
+ * @remarks Used in the package metadata.
32
+ */
33
+ displayName?: string;
34
+ /**
35
+ * Build output directory (e.g., 'dist' or 'build').
36
+ * @remarks Required unless provided via CLI option `--build-dir`.
37
+ */
38
+ buildDir?: string;
39
+ /**
40
+ * Custom build command.
41
+ * @remarks Can be overridden via CLI option `--build "command"`.
42
+ * @defaultValue `npm run build`
43
+ */
44
+ buildCommand?: string;
45
+ /**
46
+ * Custom output directory for nipkg files.
47
+ * @defaultValue `dist/nipkg`
48
+ */
49
+ outputDir?: string;
50
+ /**
51
+ * Additional package dependencies.
52
+ * @remarks Array of dependency strings (e.g., ['ni-systemlink-server \>= 2023.1']).
53
+ */
54
+ depends?: string[];
55
+ /**
56
+ * Whether the package is user visible.
57
+ * @remarks Controls visibility in package managers.
58
+ */
59
+ userVisible?: boolean;
60
+ /**
61
+ * Optional build suffix for the output filename.
62
+ * @remarks Useful for CI/CD to append build IDs (e.g., '12345' becomes 'package_1.0.0_12345_all.nipkg').
63
+ */
64
+ buildSuffix?: string;
65
+ }
66
+ export interface BuildOptions {
67
+ /**
68
+ * Run build command before packaging.
69
+ * @remarks Can be a boolean (true = use default/config command) or a string (custom command to run).
70
+ * When provided as string, overrides buildCommand from config.
71
+ */
72
+ build?: boolean | string;
73
+ /**
74
+ * Enable verbose output.
75
+ * @remarks Shows detailed build and packaging information.
76
+ */
77
+ verbose?: boolean;
78
+ /**
79
+ * Skip cleanup of existing packages.
80
+ * @remarks Prevents deletion of previous nipkg files in output directory.
81
+ */
82
+ skipCleanup?: boolean;
83
+ /**
84
+ * Optional build suffix for the output filename.
85
+ * @remarks CLI override for config buildSuffix. Useful for CI/CD build identifiers.
86
+ */
87
+ buildSuffix?: string;
88
+ /**
89
+ * Build output directory path.
90
+ * @remarks CLI override for config buildDir.
91
+ */
92
+ buildDir?: string;
93
+ /**
94
+ * Package name.
95
+ * @remarks CLI override for config name and package.json auto-detection.
96
+ */
97
+ name?: string;
98
+ /**
99
+ * Package version.
100
+ * @remarks CLI override for config version and package.json auto-detection.
101
+ */
102
+ version?: string;
103
+ /**
104
+ * Package description.
105
+ * @remarks CLI override for config description and package.json auto-detection.
106
+ */
107
+ description?: string;
108
+ /**
109
+ * Maintainer information.
110
+ * @remarks CLI override for config maintainer.
111
+ */
112
+ maintainer?: string;
113
+ /**
114
+ * Output directory for nipkg files.
115
+ * @remarks CLI override for config outputDir.
116
+ */
117
+ outputDir?: string;
118
+ }
119
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@ni-kismet/sl-webapp-nipkg",
3
+ "version": "0.1.0",
4
+ "description": "Build tool for packaging web applications into SystemLink WebApp .nipkg format. Supports Node.js, Python, .NET Blazor, and static sites.",
5
+ "type": "module",
6
+ "exports": {
7
+ "./package.json": "./package.json",
8
+ ".": {
9
+ "types": "./dist/esm/index.d.ts",
10
+ "import": "./dist/esm/index.js"
11
+ },
12
+ "./*": {
13
+ "types": "./dist/esm/*.d.ts",
14
+ "import": "./dist/esm/*/index.js"
15
+ }
16
+ },
17
+ "typesVersions": {
18
+ "*": {
19
+ "*": [
20
+ "dist/esm/*",
21
+ "dist/esm/*/index.d.ts"
22
+ ]
23
+ }
24
+ },
25
+ "bin": {
26
+ "sl-webapp-nipkg": "dist/cli.js"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc",
30
+ "dev": "tsc --watch",
31
+ "lint": "eslint .",
32
+ "lint:fix": "eslint . --fix",
33
+ "change": "beachball change",
34
+ "check": "beachball check --changehint \"Run 'npm run change' to generate a change file\"",
35
+ "sync": "beachball sync",
36
+ "invoke-publish": "beachball publish --yes --access public --message \"applying package updates [skip ci]\""
37
+ },
38
+ "keywords": [
39
+ "systemlink",
40
+ "nipkg",
41
+ "national-instruments",
42
+ "packaging",
43
+ "webapp",
44
+ "nodejs"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/ni/sl-webapp-nipkg.git"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "author": {
54
+ "name": "National Instruments"
55
+ },
56
+ "license": "MIT",
57
+ "bugs": {
58
+ "url": "https://github.com/ni/sl-webapp-nipkg/issues"
59
+ },
60
+ "homepage": "https://github.com/ni/sl-webapp-nipkg#readme",
61
+ "dependencies": {
62
+ "chalk": "^5.6.2",
63
+ "commander": "^14.0.3",
64
+ "deboa": "^1.2.0",
65
+ "fs-extra": "^11.3.3"
66
+ },
67
+ "devDependencies": {
68
+ "@ni/eslint-config-javascript": "^5.1.4",
69
+ "@ni/eslint-config-typescript": "^5.0.5",
70
+ "@types/fs-extra": "^11.0.4",
71
+ "@types/node": "^25.2.1",
72
+ "beachball": "^2.63.0",
73
+ "eslint": "^9.39.2",
74
+ "eslint-plugin-tsdoc": "^0.5.0",
75
+ "typescript": "^5.9.3"
76
+ }
77
+ }