@nimiplatform/app-tools 0.16.0-rc.12 → 0.16.0-rc.14
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 +15 -3
- package/bin/nimi-app.mjs +12 -5
- package/lib/app-dependency-combinations.mjs +1 -0
- package/lib/app-doctor-update.mjs +19 -6
- package/lib/app-pack.mjs +1238 -155
- package/lib/app-project-lifecycle.mjs +41 -5
- package/lib/app-scaffold-capabilities.mjs +28 -0
- package/lib/app-scaffold-profiles.mjs +169 -42
- package/lib/app-scaffold.mjs +289 -15
- package/lib/desktop-window.mjs +106 -0
- package/lib/hosted-web-release.mjs +31 -5
- package/lib/index.mjs +4 -3
- package/lib/payload-links.mjs +96 -18
- package/package.json +5 -5
- package/scripts/dev-shell.mjs +13 -1
- package/templates/default-starter/README.md +14 -6
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ pnpm dev
|
|
|
50
50
|
|
|
51
51
|
Set `--author` to the person or team responsible for the App and its license.
|
|
52
52
|
|
|
53
|
+
Desktop projects default to a static frontend that Home opens in Nimi’s managed carrier on Windows x64 and macOS arm64. Choose `--carrier native` at creation if the App needs its own Electron main process.
|
|
54
|
+
|
|
53
55
|
### Feature Profiles
|
|
54
56
|
- `--features studio-create`: Injects creative text and multimodal generation capabilities along with `runtime.consume` permissions.
|
|
55
57
|
- `--features studio-media`: Includes music, audio separation, and speech transcription capabilities.
|
|
@@ -96,6 +98,16 @@ pnpm dev -- --resume <selector>
|
|
|
96
98
|
## 4. Production Packaging & Distribution
|
|
97
99
|
|
|
98
100
|
### Building for Targets
|
|
101
|
+
|
|
102
|
+
For the default managed desktop App, build one package for both supported platforms:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm exec nimi-app build --target desktop-universal --production
|
|
106
|
+
pnpm exec nimi-app pack --target desktop-universal --production
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
For an App created with `--carrier native`, build on the matching host:
|
|
110
|
+
|
|
99
111
|
```bash
|
|
100
112
|
# macOS (Apple Silicon)
|
|
101
113
|
pnpm exec nimi-app build --target macos-aarch64 --production
|
|
@@ -162,14 +174,14 @@ Save it as a **secret** (not an Actions variable) and confirm the exact name app
|
|
|
162
174
|
Electron packages must keep native add-ons and their companion libraries outside the ASAR archive with their relative directory layout intact. The scaffold configures `asar: { unpack: '**/*.{node,dylib,dll}' }` on macOS and Windows. Apply the equivalent rule to any custom App-owned packager configuration and verify native module loading from the packaged layout—unpacking only `.node` files can leave companion libraries such as Sharp's `libvips` unavailable to the OS dynamic loader.
|
|
163
175
|
|
|
164
176
|
#### Local Pre-Release Check & Tagging
|
|
165
|
-
Run the production verification path locally from the App repository
|
|
177
|
+
Run the production verification path locally from the App repository. For a native App, substitute the matching host target shown above.
|
|
166
178
|
|
|
167
179
|
```bash
|
|
168
180
|
pnpm run sync
|
|
169
181
|
pnpm exec nimi-app check --production
|
|
170
182
|
pnpm exec nimi-app test
|
|
171
|
-
pnpm exec nimi-app build --target
|
|
172
|
-
pnpm exec nimi-app pack --target
|
|
183
|
+
pnpm exec nimi-app build --target desktop-universal --production
|
|
184
|
+
pnpm exec nimi-app pack --target desktop-universal --production
|
|
173
185
|
```
|
|
174
186
|
|
|
175
187
|
Ensure `package.json` and `nimi.app.yaml` declare the exact same version, commit all release changes, and land that exact commit on the repository's canonical default branch. Then create and push an annotated tag matching that version (`0.1.0` shown as an example):
|
package/bin/nimi-app.mjs
CHANGED
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
syncApp,
|
|
15
15
|
testApp,
|
|
16
16
|
} from '../lib/index.mjs';
|
|
17
|
-
import { APP_SCAFFOLD_MODULE_REGISTRY } from '../lib/app-scaffold-capabilities.mjs';
|
|
17
|
+
import { APP_SCAFFOLD_MANAGED_WEB_FEATURE_IDS, APP_SCAFFOLD_MODULE_REGISTRY } from '../lib/app-scaffold-capabilities.mjs';
|
|
18
18
|
import { LIFECYCLE_SKILL_PATH } from '../lib/app-lifecycle-guidance.mjs';
|
|
19
19
|
import { createInterface } from 'node:readline/promises';
|
|
20
20
|
|
|
21
21
|
function parseArgs(argv) {
|
|
22
22
|
const [command = '', ...rest] = argv;
|
|
23
23
|
const values = {
|
|
24
|
-
dir: '', profile: '', platform: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
24
|
+
dir: '', profile: '', platform: '', carrier: '', appId: '', version: '', title: '', packageName: '', author: '',
|
|
25
25
|
features: undefined, shell: '', cdpPort: undefined, noCdp: false, listRegistrations: false, resume: '', newRegistration: false, target: '', aggregate: false, production: false, json: false,
|
|
26
26
|
adopt: false, dryRun: false, input: '', realm: '',
|
|
27
27
|
};
|
|
@@ -90,6 +90,10 @@ function parseArgs(argv) {
|
|
|
90
90
|
index = readValue(index, '--platform', 'platform');
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
+
if (rest[index] === '--carrier') {
|
|
94
|
+
index = readValue(index, '--carrier', 'carrier');
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
93
97
|
if (rest[index] === '--features') {
|
|
94
98
|
index = readValue(index, '--features', 'features');
|
|
95
99
|
continue;
|
|
@@ -157,7 +161,7 @@ function parseArgs(argv) {
|
|
|
157
161
|
|
|
158
162
|
function assertCommandOptions(command, providedOptions) {
|
|
159
163
|
const allowed = {
|
|
160
|
-
create: new Set(['dir', 'profile', 'platform', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
164
|
+
create: new Set(['dir', 'profile', 'platform', 'carrier', 'appId', 'version', 'title', 'packageName', 'author', 'features', 'json']),
|
|
161
165
|
init: new Set(['dir', 'json', 'adopt', 'input', 'dryRun']),
|
|
162
166
|
sync: new Set(['dir', 'json', 'dryRun']),
|
|
163
167
|
check: new Set(['dir', 'json', 'production']),
|
|
@@ -188,7 +192,7 @@ function printUsage() {
|
|
|
188
192
|
'Nimi App developer tools',
|
|
189
193
|
'',
|
|
190
194
|
'Usage:',
|
|
191
|
-
' nimi-app create [--dir path] [--profile standalone] [--platform desktop|web] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
|
|
195
|
+
' nimi-app create [--dir path] [--profile standalone] [--platform desktop|web] [--carrier managed-web|native] [--features admitted-ids|all] [--app-id dotted.id] [--version semver] [--title title] [--package-name name] [--author person-or-team] [--json]',
|
|
192
196
|
' nimi-app init [--adopt [--input json-path]] [--dry-run] [--dir path] [--json]',
|
|
193
197
|
' nimi-app sync [--dry-run] [--dir path] [--json]',
|
|
194
198
|
' nimi-app check [--dir path] [--production] [--json]',
|
|
@@ -207,6 +211,7 @@ function printUsage() {
|
|
|
207
211
|
'',
|
|
208
212
|
'Current module registry:',
|
|
209
213
|
` Admitted features: ${featureList(admitted)}`,
|
|
214
|
+
` Managed desktop features (--carrier managed-web, default): ${APP_SCAFFOLD_MANAGED_WEB_FEATURE_IDS.join(', ') || '(none)'}`,
|
|
210
215
|
` Web features: ${featureList(admitted.filter(entry => entry.carriers.includes('web')))}`,
|
|
211
216
|
` Candidate features (not public-selectable): ${featureList(candidates)}`,
|
|
212
217
|
` Internal modules (dependency-only): ${internalList}`,
|
|
@@ -324,6 +329,7 @@ try {
|
|
|
324
329
|
dir,
|
|
325
330
|
profile,
|
|
326
331
|
platform,
|
|
332
|
+
carrier,
|
|
327
333
|
appId,
|
|
328
334
|
version,
|
|
329
335
|
title,
|
|
@@ -366,6 +372,7 @@ try {
|
|
|
366
372
|
dir,
|
|
367
373
|
profile,
|
|
368
374
|
platform,
|
|
375
|
+
carrier,
|
|
369
376
|
appId,
|
|
370
377
|
version,
|
|
371
378
|
title,
|
|
@@ -431,7 +438,7 @@ try {
|
|
|
431
438
|
case 'pack':
|
|
432
439
|
if (aggregate && (target || production)) throw new Error('--aggregate cannot be combined with --target or --production');
|
|
433
440
|
{
|
|
434
|
-
const result = packApp(process.cwd(), { dir, target, aggregate, production });
|
|
441
|
+
const result = await packApp(process.cwd(), { dir, target, aggregate, production });
|
|
435
442
|
if (json) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
436
443
|
else process.stdout.write(`[nimi-app] pack ${aggregate ? 'aggregate' : target} completed\n`);
|
|
437
444
|
}
|
|
@@ -10,6 +10,7 @@ const SDK = '@nimiplatform/sdk';
|
|
|
10
10
|
const KIT = '@nimiplatform/kit';
|
|
11
11
|
|
|
12
12
|
export const ADDITIONAL_DEPENDENCY_COMBINATIONS = Object.freeze([
|
|
13
|
+
Object.freeze({ sdkVersion: '^0.24.0-rc.10', kitVersion: '^0.24.0-rc.16', source: 'existing' }),
|
|
13
14
|
Object.freeze({ sdkVersion: '^0.24.0-rc.7', kitVersion: '^0.24.0-rc.11', source: 'existing' }),
|
|
14
15
|
Object.freeze({ sdkVersion: '^0.24.0-rc.2', kitVersion: '^0.24.0-rc.1', source: 'existing' }),
|
|
15
16
|
Object.freeze({ sdkVersion: '^0.22.2', kitVersion: '^0.22.1', source: 'existing' }),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isAppId } from './app-identifiers.mjs';
|
|
2
|
+
import { validateManifestDesktop } from './desktop-window.mjs';
|
|
2
3
|
import { readWebDevelopment } from './web-development.mjs';
|
|
3
4
|
import { readMobileDevelopment } from './mobile-development.mjs';
|
|
4
5
|
import { APP_AUTHOR_DECLARATION_FIELDS, hashScaffoldManagedContent } from './app-scaffold.mjs';
|
|
@@ -186,6 +187,7 @@ function expectedSnapshotFromLock(lock, versions, intent, targetDir, options = {
|
|
|
186
187
|
}
|
|
187
188
|
for (const [intentField, lockField, label] of [
|
|
188
189
|
['profile', 'profile', 'profile'],
|
|
190
|
+
['carrier', 'carrier', 'carrier'],
|
|
189
191
|
['appId', 'appId', 'App ID'],
|
|
190
192
|
['appTitle', 'appTitle', 'display name'],
|
|
191
193
|
['packageName', 'packageName', 'package name'],
|
|
@@ -479,12 +481,20 @@ function assertRequiredSupportFiles(targetDir, snapshot) {
|
|
|
479
481
|
}
|
|
480
482
|
}
|
|
481
483
|
|
|
482
|
-
function
|
|
484
|
+
function readBuildProfileRef(targetDir, plannedSources) {
|
|
483
485
|
const relativePath = '.nimi/config/build-profile.yaml';
|
|
484
486
|
const filePath = path.join(targetDir, relativePath);
|
|
485
487
|
const source = plannedSources?.get(relativePath)
|
|
486
488
|
?? (existsSync(filePath) ? readFileSync(filePath, 'utf8') : undefined);
|
|
487
|
-
return source !== undefined
|
|
489
|
+
return source !== undefined ? parseYaml(source)?.build_profile_ref : undefined;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function usesAppOwnedRenderer(targetDir, plannedSources) {
|
|
493
|
+
return readBuildProfileRef(targetDir, plannedSources) === 'electron-pnpm';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function usesManagedWebCarrier(targetDir, plannedSources) {
|
|
497
|
+
return readBuildProfileRef(targetDir, plannedSources) === 'managed-web-pnpm-vite';
|
|
488
498
|
}
|
|
489
499
|
|
|
490
500
|
function assertProjectConfiguration(targetDir, parsedManifest = null, managed = true) {
|
|
@@ -499,6 +509,7 @@ function assertProjectConfiguration(targetDir, parsedManifest = null, managed =
|
|
|
499
509
|
throw new Error(`Submitted manifest YAML cannot be parsed: ${error instanceof Error ? error.message : String(error)}`);
|
|
500
510
|
}
|
|
501
511
|
}
|
|
512
|
+
validateManifestDesktop(document?.desktop, 'nimi.app.yaml desktop', manifest);
|
|
502
513
|
readAppIntroduction(targetDir, document);
|
|
503
514
|
readAppStorefront(targetDir, document);
|
|
504
515
|
assertCarrierDevelopmentInputs(targetDir, document, readJsonFile(path.join(targetDir, 'package.json')), managed);
|
|
@@ -551,7 +562,7 @@ function assertDeclaredHostSourceDirectory(targetDir, document) {
|
|
|
551
562
|
}
|
|
552
563
|
}
|
|
553
564
|
|
|
554
|
-
function assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson = readJsonFile(path.join(targetDir, 'package.json'), 'package.json'), managed = true) {
|
|
565
|
+
function assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson = readJsonFile(path.join(targetDir, 'package.json'), 'package.json'), managed = true, managedWeb = false) {
|
|
555
566
|
const scripts = packageJson?.scripts;
|
|
556
567
|
if (!scripts || typeof scripts !== 'object' || Array.isArray(scripts)) {
|
|
557
568
|
throw new Error('package.json scripts are required');
|
|
@@ -573,11 +584,11 @@ function assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, package
|
|
|
573
584
|
|| /\b(?:nimi-app\s+dev|(?:pnpm|npm)\s+(?:run\s+)?(?:dev|dev:renderer))(?=\s|$)/u.test(rendererCommand)) {
|
|
574
585
|
throw new Error('package.json dev:renderer must be a non-recursive App-owned renderer command for the declared loopback origin');
|
|
575
586
|
}
|
|
576
|
-
if (
|
|
587
|
+
if (!managedWeb && (
|
|
577
588
|
typeof scripts['build:electron'] !== 'string'
|
|
578
589
|
|| scripts['build:electron'].trim() !== scripts['build:electron']
|
|
579
590
|
|| scripts['build:electron'].length === 0
|
|
580
|
-
) {
|
|
591
|
+
)) {
|
|
581
592
|
throw new Error('package.json build:electron must build the Desktop-supervised Electron host');
|
|
582
593
|
}
|
|
583
594
|
for (const [name, value] of Object.entries(scripts)) {
|
|
@@ -615,14 +626,16 @@ function assertCarrierDevelopmentInputs(targetDir, manifest, packageJson, manage
|
|
|
615
626
|
}
|
|
616
627
|
if (manifest.platform !== 'web') {
|
|
617
628
|
if (manifest.platform !== undefined && manifest.platform !== 'desktop') throw new Error('Unsupported App platform.');
|
|
629
|
+
const managedWeb = usesManagedWebCarrier(targetDir, plannedSources);
|
|
618
630
|
const rendererOrigin = assertElectronLocalDevelopmentManifest(manifest);
|
|
619
631
|
assertDeclaredHostSourceDirectory(targetDir, manifest);
|
|
620
|
-
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson, managed || !usesAppOwnedRenderer(targetDir, plannedSources));
|
|
632
|
+
assertOfficialDevelopmentEntrypoints(targetDir, rendererOrigin, packageJson, managed || !usesAppOwnedRenderer(targetDir, plannedSources), managedWeb);
|
|
621
633
|
}
|
|
622
634
|
}
|
|
623
635
|
|
|
624
636
|
export function validateAppProjectInputs(targetDir, manifest, packageJson, managed = false, plannedSources) {
|
|
625
637
|
assertManifestAppAccessDeclaration(stringifyYaml(manifest), 'nimi.app.yaml');
|
|
638
|
+
validateManifestDesktop(manifest?.desktop, 'nimi.app.yaml desktop');
|
|
626
639
|
readAppIntroduction(targetDir, manifest);
|
|
627
640
|
readAppStorefront(targetDir, manifest);
|
|
628
641
|
assertCarrierDevelopmentInputs(targetDir, manifest, packageJson, managed, plannedSources);
|