@gjsify/cli 0.50.0 → 0.51.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/dist/cli.gjs.mjs +43 -42
- package/lib/commands/ship.js +77 -2
- package/lib/utils/ship/appimage.d.ts +352 -0
- package/lib/utils/ship/appimage.js +671 -0
- package/lib/utils/ship/depends.d.ts +20 -0
- package/lib/utils/ship/depends.js +31 -16
- package/lib/utils/ship/formats.d.ts +9 -0
- package/lib/utils/ship/formats.js +150 -0
- package/lib/utils/ship/settings.d.ts +14 -0
- package/lib/utils/ship/settings.js +19 -1
- package/lib/utils/ship/types.d.ts +17 -1
- package/package.json +19 -19
|
@@ -91,6 +91,26 @@ export interface DependsInputs {
|
|
|
91
91
|
/** Minimum Node major, when one is depended on. Default {@link DEFAULT_NODE_FLOOR}. */
|
|
92
92
|
minNodeVersion?: string;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* The namespaces the bundle imports that the HOST has to provide — scanned set
|
|
96
|
+
* minus everything the payload carries itself.
|
|
97
|
+
*
|
|
98
|
+
* LIFTED OUT OF {@link deriveDepends} because a second caller appeared and the
|
|
99
|
+
* question is not a `.deb`'s. `appimage.ts` asks it to write the one sentence an
|
|
100
|
+
* AppImage owes its user — *this file carries the application, and takes these
|
|
101
|
+
* from your system* — and an AppImage has no `Depends:` field, so it cannot go
|
|
102
|
+
* through the package-name table below. A copied filter would drift in the
|
|
103
|
+
* direction that is invisible: the drifted copy would still produce a plausible
|
|
104
|
+
* list, just one that no longer matches the dependencies the `.deb` beside it
|
|
105
|
+
* declares from the same payload.
|
|
106
|
+
*
|
|
107
|
+
* Deriving the carried set from the staged FILENAMES is the point, and it is
|
|
108
|
+
* `deriveDepends`' reasoning unchanged: `Gwebgl-0.1.typelib` answers for both
|
|
109
|
+
* `Gwebgl-0.1` and `Gwebgl`, so a project that declared a namespace bundled
|
|
110
|
+
* without the file being there gets an artifact that names its real requirement
|
|
111
|
+
* instead of one that installs and dies at the first import.
|
|
112
|
+
*/
|
|
113
|
+
export declare function hostProvidedNamespaces(namespaces: readonly string[], bundledTypelibs?: readonly string[]): string[];
|
|
94
114
|
/**
|
|
95
115
|
* The `Depends:` / `Requires:` list for one format.
|
|
96
116
|
*
|
|
@@ -256,6 +256,36 @@ const TYPELIB_PACKAGES = {
|
|
|
256
256
|
* whose bundle reaches one, which includes every `@gjsify/http` server.
|
|
257
257
|
*/
|
|
258
258
|
const BUNDLED_TYPELIB = /^Gjsify[A-Z]/;
|
|
259
|
+
/**
|
|
260
|
+
* The namespaces the bundle imports that the HOST has to provide — scanned set
|
|
261
|
+
* minus everything the payload carries itself.
|
|
262
|
+
*
|
|
263
|
+
* LIFTED OUT OF {@link deriveDepends} because a second caller appeared and the
|
|
264
|
+
* question is not a `.deb`'s. `appimage.ts` asks it to write the one sentence an
|
|
265
|
+
* AppImage owes its user — *this file carries the application, and takes these
|
|
266
|
+
* from your system* — and an AppImage has no `Depends:` field, so it cannot go
|
|
267
|
+
* through the package-name table below. A copied filter would drift in the
|
|
268
|
+
* direction that is invisible: the drifted copy would still produce a plausible
|
|
269
|
+
* list, just one that no longer matches the dependencies the `.deb` beside it
|
|
270
|
+
* declares from the same payload.
|
|
271
|
+
*
|
|
272
|
+
* Deriving the carried set from the staged FILENAMES is the point, and it is
|
|
273
|
+
* `deriveDepends`' reasoning unchanged: `Gwebgl-0.1.typelib` answers for both
|
|
274
|
+
* `Gwebgl-0.1` and `Gwebgl`, so a project that declared a namespace bundled
|
|
275
|
+
* without the file being there gets an artifact that names its real requirement
|
|
276
|
+
* instead of one that installs and dies at the first import.
|
|
277
|
+
*/
|
|
278
|
+
export function hostProvidedNamespaces(namespaces, bundledTypelibs = []) {
|
|
279
|
+
const shipped = new Set();
|
|
280
|
+
for (const file of bundledTypelibs) {
|
|
281
|
+
const match = /([A-Za-z0-9]+)-([\d.]+)\.typelib$/.exec(file);
|
|
282
|
+
if (!match)
|
|
283
|
+
continue;
|
|
284
|
+
shipped.add(`${match[1]}-${match[2]}`);
|
|
285
|
+
shipped.add(match[1]);
|
|
286
|
+
}
|
|
287
|
+
return [...new Set(namespaces)].sort().filter((ns) => !BUNDLED_TYPELIB.test(ns) && !shipped.has(ns));
|
|
288
|
+
}
|
|
259
289
|
/**
|
|
260
290
|
* The `Depends:` / `Requires:` list for one format.
|
|
261
291
|
*
|
|
@@ -271,22 +301,7 @@ export function deriveDepends(format, inputs) {
|
|
|
271
301
|
? [`${NODE_PACKAGE[format]} >= ${inputs.minNodeVersion ?? DEFAULT_NODE_FLOOR}`]
|
|
272
302
|
: [`gjs >= ${inputs.minGjsVersion ?? DEFAULT_GJS_FLOOR}`];
|
|
273
303
|
const unmapped = [];
|
|
274
|
-
|
|
275
|
-
// separate declaration: `Gwebgl-0.1.typelib` → `Gwebgl-0.1` and `Gwebgl`. Deriving it is the
|
|
276
|
-
// point — a project that declared a namespace bundled without the file being there would get
|
|
277
|
-
// a package that installs and dies at the first import, which is exactly what this check
|
|
278
|
-
// exists to prevent.
|
|
279
|
-
const shipped = new Set();
|
|
280
|
-
for (const file of inputs.bundledTypelibs ?? []) {
|
|
281
|
-
const match = /([A-Za-z0-9]+)-([\d.]+)\.typelib$/.exec(file);
|
|
282
|
-
if (!match)
|
|
283
|
-
continue;
|
|
284
|
-
shipped.add(`${match[1]}-${match[2]}`);
|
|
285
|
-
shipped.add(match[1]);
|
|
286
|
-
}
|
|
287
|
-
for (const namespace of [...new Set(inputs.namespaces)].sort()) {
|
|
288
|
-
if (BUNDLED_TYPELIB.test(namespace) || shipped.has(namespace))
|
|
289
|
-
continue;
|
|
304
|
+
for (const namespace of hostProvidedNamespaces(inputs.namespaces, inputs.bundledTypelibs)) {
|
|
290
305
|
const entry = lookupTypelib(namespace, inputs.typelibPackages);
|
|
291
306
|
if (entry === undefined) {
|
|
292
307
|
unmapped.push(namespace);
|
|
@@ -138,4 +138,13 @@ export declare function configuredFormats(raw: readonly string[], layout: Layout
|
|
|
138
138
|
* the two questions are separate, and a `.app` is precisely the item Apple's
|
|
139
139
|
* remedy above tells you to staple after submitting the archive around it.
|
|
140
140
|
*/
|
|
141
|
+
/**
|
|
142
|
+
* Refuse a project whose `kind` no chosen container can hold.
|
|
143
|
+
*
|
|
144
|
+
* DERIVED FROM THE TABLE (`FormatDescriptor.requiresDesktopEntry`), never from a
|
|
145
|
+
* list of format ids here — a fourth format that also needs an entry would
|
|
146
|
+
* otherwise be refused by appimagetool's own "Desktop file not found, aborting"
|
|
147
|
+
* after a full build, which is the message this replaced.
|
|
148
|
+
*/
|
|
149
|
+
export declare function assertKindCanPack(formats: readonly FormatDescriptor[], kind: 'app' | 'cli'): void;
|
|
141
150
|
export declare function canCarryTicket(id: FormatId): boolean;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// and one filename. What it also proved is what the design did NOT predict —
|
|
9
9
|
// a format can be host-bound (§ A3), so `host` is a descriptor field now.
|
|
10
10
|
import { isOnPath } from '../check-system-deps.js';
|
|
11
|
+
import { APPIMAGE_TOOL } from './appimage.js';
|
|
11
12
|
import { DMG_TOOL } from './dmg.js';
|
|
12
13
|
import { LAYOUTS, LAYOUT_NAMES } from './layout.js';
|
|
13
14
|
import { SCHEMA_COMPILER, SCHEMA_COMPILER_HINT } from './schemas.js';
|
|
@@ -72,6 +73,33 @@ function rpmArch(arch, archIndependent) {
|
|
|
72
73
|
function flatpakArch(arch, _archIndependent) {
|
|
73
74
|
return lookupArch(FLATPAK_ARCH, arch, 'Flatpak');
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* `process.arch` → the name appimagetool uses, which is `uname -m`'s.
|
|
78
|
+
*
|
|
79
|
+
* A TABLE OF ITS OWN even though it currently equals `RPM_ARCH` on every row it
|
|
80
|
+
* has, and the reason is that the two answer different questions: rpm's is a
|
|
81
|
+
* package-manager namespace with `noarch`, `i686` and `ppc64le` in it, while this
|
|
82
|
+
* one is the string appimagetool puts in `$ARCH` and matches against the runtimes
|
|
83
|
+
* it can embed. Sharing the table would make an rpm row addition silently claim
|
|
84
|
+
* an AppImage architecture that has no runtime — `ppc64le` is exactly that case
|
|
85
|
+
* today. So the short list is the honest one, and an arch not in it is REFUSED
|
|
86
|
+
* rather than guessed, which is `FLATPAK_ARCH`'s rule for `FLATPAK_ARCH`'s reason:
|
|
87
|
+
* the value ends up in a filename a user is asked to download.
|
|
88
|
+
*
|
|
89
|
+
* `archIndependent` is IGNORED, like Flatpak's and unlike deb's and rpm's. There
|
|
90
|
+
* is no `noarch` AppImage: the file BEGINS with an ELF runtime, so a payload of
|
|
91
|
+
* pure JavaScript still ships in an x86-64 executable and labelling it otherwise
|
|
92
|
+
* would name a file nothing can run.
|
|
93
|
+
*/
|
|
94
|
+
const APPIMAGE_ARCH = {
|
|
95
|
+
x64: 'x86_64',
|
|
96
|
+
arm64: 'aarch64',
|
|
97
|
+
ia32: 'i686',
|
|
98
|
+
arm: 'armhf',
|
|
99
|
+
};
|
|
100
|
+
function appImageArch(arch, _archIndependent) {
|
|
101
|
+
return lookupArch(APPIMAGE_ARCH, arch, 'AppImage');
|
|
102
|
+
}
|
|
75
103
|
/**
|
|
76
104
|
* `process.arch` → the name Apple's tools use.
|
|
77
105
|
*
|
|
@@ -344,6 +372,108 @@ export const FORMATS = {
|
|
|
344
372
|
fileName: (s, archLabel) => `${s.appId}-${s.version}-${s.release}.${archLabel}.flatpak`,
|
|
345
373
|
artifactKind: 'file',
|
|
346
374
|
},
|
|
375
|
+
// THE FOURTH CONTAINER OVER THE LINUX TREE, and the first row added to this
|
|
376
|
+
// table that needed NOTHING staged: `deb`, `rpm` and `flatpak` already wrap
|
|
377
|
+
// this exact payload, so ADR 0024 § 2's "one payload, a handful of layouts"
|
|
378
|
+
// is here a row plus a packer and no change to `plan.ts` at all. ADR 0024
|
|
379
|
+
// § 9 deferred it and § A24 lifts the deferral; `appimage.ts`'s header
|
|
380
|
+
// carries the argument, and the short form is that the two promises an
|
|
381
|
+
// AppImage can keep with no relocatable Linux closure — no install, no root
|
|
382
|
+
// — are the two nothing else in this table offers, and the third is
|
|
383
|
+
// DECLARED rather than implied.
|
|
384
|
+
appimage: {
|
|
385
|
+
id: 'appimage',
|
|
386
|
+
layoutOs: 'linux',
|
|
387
|
+
// `/usr`, exactly as the `.deb` — and that is the whole layout difference
|
|
388
|
+
// between the two formats. An AppImage mounts its squashfs and the AppDir's
|
|
389
|
+
// `usr/` becomes the prefix, which the staged launcher computes for itself
|
|
390
|
+
// (ADR 0024 § 3): `readlink -f "$0"` then two `dirname`s, measured inside a
|
|
391
|
+
// mount as `/tmp/.mount_xxxx/usr`. So the same `bin/<name>` works under
|
|
392
|
+
// `/usr`, under `/app` and under a mountpoint nobody chose.
|
|
393
|
+
prefix: '/usr',
|
|
394
|
+
host: {
|
|
395
|
+
// Linux-bound the way the Flatpak row is, and NOT the way the `.dmg`
|
|
396
|
+
// is: the container is an ELF runtime for Linux with a Linux filesystem
|
|
397
|
+
// behind it, so the format is bound the way the application is.
|
|
398
|
+
finishOn: ['linux'],
|
|
399
|
+
// The SCHEMA COMPILER IS ABSENT here, unlike the two windows rows and
|
|
400
|
+
// for the `.dmg`'s reason inverted: this layout HAS an install step in
|
|
401
|
+
// every other format, and inside an AppImage it does not — there is no
|
|
402
|
+
// `postinst` to run `glib-compile-schemas` in a read-only squashfs. But
|
|
403
|
+
// `compileSchemasForStage` has already run at ASSEMBLY time and
|
|
404
|
+
// `gschemas.compiled` is in the payload, so declaring the compiler on
|
|
405
|
+
// the PACK path would refuse a `--from-stage` pack that works.
|
|
406
|
+
requiredTools: [APPIMAGE_TOOL],
|
|
407
|
+
// A URL AND NOT A PACKAGE NAME, and it is the first hint in this table
|
|
408
|
+
// that has to be. `flatpak-builder` and `msitools` are in Fedora and in
|
|
409
|
+
// Debian; `appimagetool` is in neither, so pointing at a distro would
|
|
410
|
+
// send the reader to an `E: Unable to locate package`. The `--stage`
|
|
411
|
+
// half is repeated here because it is the answer for a CI image that is
|
|
412
|
+
// not going to grow a hand-installed binary.
|
|
413
|
+
installHint: 'no distribution packages it — take the release from ' +
|
|
414
|
+
'https://github.com/AppImage/appimagetool/releases, `chmod +x` it and put it on PATH as ' +
|
|
415
|
+
'`appimagetool`; or assemble here with `gjsify ship linux --stage` and pack where it is',
|
|
416
|
+
oracle: {
|
|
417
|
+
// TWO READERS, NEITHER OF THEM appimagetool AND NEITHER OF THEM THE
|
|
418
|
+
// ARTIFACT'S OWN RUNTIME — which is what `--appimage-offset` and
|
|
419
|
+
// `--appimage-extract` would be, the format reading what the format
|
|
420
|
+
// wrote (ADR 0024 § A3).
|
|
421
|
+
//
|
|
422
|
+
// * CPython reads the ELF SECTION-HEADER TABLE for the offset the
|
|
423
|
+
// filesystem starts at — `e_shoff + e_shnum * e_shentsize`,
|
|
424
|
+
// twelve bytes of `struct.unpack_from`, straight out of the ELF
|
|
425
|
+
// specification. Measured against `--appimage-offset` on a real
|
|
426
|
+
// artifact: 944632 both ways. That agreement is the
|
|
427
|
+
// discriminator for the whole container, because a truncated or
|
|
428
|
+
// empty image has no squashfs superblock there. `python3` and
|
|
429
|
+
// NOT `readelf`, which the first draft of this row declared and
|
|
430
|
+
// `verify-appimage.py` never execs — the field names the tools
|
|
431
|
+
// the oracle RUNS, and binutils is not one of them here. Same
|
|
432
|
+
// reader family the two `macos-app` rows already declare.
|
|
433
|
+
// * `unsquashfs` (squashfs-tools) then lists the filesystem at
|
|
434
|
+
// that offset with names, modes and sizes, which
|
|
435
|
+
// `.github/ship-oracle/verify-appimage.py` compares against the
|
|
436
|
+
// stage manifest. A different PROGRAM from the bundled
|
|
437
|
+
// mksquashfs appimagetool packs with, and the leg that runs it
|
|
438
|
+
// is the Linux one that already reads the `.deb`.
|
|
439
|
+
readWith: ['python3', 'unsquashfs'],
|
|
440
|
+
readOn: ['linux'],
|
|
441
|
+
selfReading: false,
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
// No `Depends:` FIELD — which is not the same as no dependencies, and this
|
|
445
|
+
// row is the one place in the table where that distinction has teeth. A
|
|
446
|
+
// `.deb` declares `gir1.2-gtk-4.0` and apt refuses to install without it;
|
|
447
|
+
// an AppImage has nowhere to write that down, so `appImageHostRequirements`
|
|
448
|
+
// derives the same set from the same scan and `ship` PRINTS it while
|
|
449
|
+
// `AppRun` carries the interpreter half as a refusal. See `depends.ts`'s
|
|
450
|
+
// `DistroFormatId`: this is `null` because there is no field, never because
|
|
451
|
+
// there is nothing to say.
|
|
452
|
+
depends: null,
|
|
453
|
+
// BOTH, like `deb` and `rpm` and for the same reason: the interpreter comes
|
|
454
|
+
// from the machine. The difference from those two is that nothing declares
|
|
455
|
+
// it — see the `depends` note above and `interpreterGap` below.
|
|
456
|
+
interpreters: ['gjs', 'node'],
|
|
457
|
+
interpreterGap: 'an AppImage carries the application and takes its interpreter from the host, exactly as a distro ' +
|
|
458
|
+
'package does — but with no dependency field to declare it in, so the requirement is printed at ' +
|
|
459
|
+
'pack time and checked by `AppRun` at launch instead',
|
|
460
|
+
licenseDest: SHARE_LICENSE_DEST,
|
|
461
|
+
licenseKind: 'plain',
|
|
462
|
+
archName: appImageArch,
|
|
463
|
+
// The BINARY name, like the `.dmg` and the two zips and for their reason:
|
|
464
|
+
// this artifact is a DOWNLOAD that lands in a browser's folder beside other
|
|
465
|
+
// files, so it carries the version and the architecture and avoids the
|
|
466
|
+
// spaces a display name may contain. Not the app id, which is the Flatpak's
|
|
467
|
+
// convention because a Flatpak ref IS the id; an AppImage installs as
|
|
468
|
+
// nothing and is addressed by its path.
|
|
469
|
+
fileName: (s, archLabel) => `${s.binaryName}-${s.version}-${s.release}.${archLabel}.AppImage`,
|
|
470
|
+
artifactKind: 'file',
|
|
471
|
+
// THE ONLY ROW THAT SETS IT. appimagetool refuses an AppDir with no
|
|
472
|
+
// `.desktop` at its root, and `kind: 'cli'` stages none by design — a
|
|
473
|
+
// refusal `gjsify.ship.kind` decides on its own, so it belongs before the
|
|
474
|
+
// build beside the tool gate rather than after it inside the packer.
|
|
475
|
+
requiresDesktopEntry: true,
|
|
476
|
+
},
|
|
347
477
|
// ── macOS (#1354 M2a) ────────────────────────────────────────────────
|
|
348
478
|
//
|
|
349
479
|
// TWO ROWS FOR ONE TREE, and the pair is what `layoutOs` was added for. The
|
|
@@ -995,6 +1125,25 @@ export function configuredFormats(raw, layout) {
|
|
|
995
1125
|
* the two questions are separate, and a `.app` is precisely the item Apple's
|
|
996
1126
|
* remedy above tells you to staple after submitting the archive around it.
|
|
997
1127
|
*/
|
|
1128
|
+
/**
|
|
1129
|
+
* Refuse a project whose `kind` no chosen container can hold.
|
|
1130
|
+
*
|
|
1131
|
+
* DERIVED FROM THE TABLE (`FormatDescriptor.requiresDesktopEntry`), never from a
|
|
1132
|
+
* list of format ids here — a fourth format that also needs an entry would
|
|
1133
|
+
* otherwise be refused by appimagetool's own "Desktop file not found, aborting"
|
|
1134
|
+
* after a full build, which is the message this replaced.
|
|
1135
|
+
*/
|
|
1136
|
+
export function assertKindCanPack(formats, kind) {
|
|
1137
|
+
if (kind === 'app')
|
|
1138
|
+
return;
|
|
1139
|
+
const needsEntry = formats.filter((format) => format.requiresDesktopEntry);
|
|
1140
|
+
if (needsEntry.length === 0)
|
|
1141
|
+
return;
|
|
1142
|
+
throw new Error(`gjsify ship: ${needsEntry.map((format) => format.id).join(', ')} cannot package a ` +
|
|
1143
|
+
'`kind: "cli"` project — the container needs a desktop entry at its root and a CLI stages none ' +
|
|
1144
|
+
'by design. Set `gjsify.ship.kind` to "app" if this is a GUI application, or ship it as a `.deb`, ' +
|
|
1145
|
+
'an `.rpm` or a Flatpak, none of which need one.');
|
|
1146
|
+
}
|
|
998
1147
|
export function canCarryTicket(id) {
|
|
999
1148
|
switch (id) {
|
|
1000
1149
|
case 'macos-app':
|
|
@@ -1007,6 +1156,7 @@ export function canCarryTicket(id) {
|
|
|
1007
1156
|
case 'deb':
|
|
1008
1157
|
case 'rpm':
|
|
1009
1158
|
case 'flatpak':
|
|
1159
|
+
case 'appimage':
|
|
1010
1160
|
case 'windows-dir':
|
|
1011
1161
|
case 'windows-dir-zip':
|
|
1012
1162
|
case 'msi':
|
|
@@ -144,6 +144,20 @@ export interface ResolvedSettings {
|
|
|
144
144
|
metadata: AppMetadata;
|
|
145
145
|
warnings: string[];
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* `gjsify.ship.kind`, falling back to `gjsify.flatpak`'s and then to `'app'`.
|
|
149
|
+
*
|
|
150
|
+
* LIFTED OUT because a second caller appeared BEFORE this file runs: `ship`
|
|
151
|
+
* refuses a `kind: 'cli'` project asking for a format whose container needs a
|
|
152
|
+
* desktop entry, and it does that ahead of the project's build, where
|
|
153
|
+
* `resolveShipSettings` has not run and its `discovered` input does not exist
|
|
154
|
+
* yet. The fallback chain is `{ ...flatpak, ...definedOnly(ship) }`'s for exactly
|
|
155
|
+
* this key, and a second spelling of it is the kind that stays right until
|
|
156
|
+
* somebody changes the first one — here with the artifact-shaped consequence that
|
|
157
|
+
* a project would be refused before the build for a `kind` the stage then
|
|
158
|
+
* resolves differently.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveShipKind(ship: ConfigDataShip, flatpak: ConfigDataFlatpak): 'app' | 'cli';
|
|
147
161
|
export declare function resolveShipSettings(input: SettingsInput): ResolvedSettings;
|
|
148
162
|
/** The entry one ship target installs, which key named it, and what it must NOT carry. */
|
|
149
163
|
export interface ResolvedShipBundle {
|
|
@@ -111,6 +111,22 @@ const CATEGORY_SECTIONS = [
|
|
|
111
111
|
['System', { section: 'admin', group: 'Applications/System' }],
|
|
112
112
|
['Utility', { section: 'utils', group: 'Applications/System' }],
|
|
113
113
|
];
|
|
114
|
+
/**
|
|
115
|
+
* `gjsify.ship.kind`, falling back to `gjsify.flatpak`'s and then to `'app'`.
|
|
116
|
+
*
|
|
117
|
+
* LIFTED OUT because a second caller appeared BEFORE this file runs: `ship`
|
|
118
|
+
* refuses a `kind: 'cli'` project asking for a format whose container needs a
|
|
119
|
+
* desktop entry, and it does that ahead of the project's build, where
|
|
120
|
+
* `resolveShipSettings` has not run and its `discovered` input does not exist
|
|
121
|
+
* yet. The fallback chain is `{ ...flatpak, ...definedOnly(ship) }`'s for exactly
|
|
122
|
+
* this key, and a second spelling of it is the kind that stays right until
|
|
123
|
+
* somebody changes the first one — here with the artifact-shaped consequence that
|
|
124
|
+
* a project would be refused before the build for a `kind` the stage then
|
|
125
|
+
* resolves differently.
|
|
126
|
+
*/
|
|
127
|
+
export function resolveShipKind(ship, flatpak) {
|
|
128
|
+
return ship.kind ?? flatpak.kind ?? 'app';
|
|
129
|
+
}
|
|
114
130
|
export function resolveShipSettings(input) {
|
|
115
131
|
const warnings = [];
|
|
116
132
|
const { pkg, ship, flatpak, discovered } = input;
|
|
@@ -132,7 +148,9 @@ export function resolveShipSettings(input) {
|
|
|
132
148
|
const binaryName = ship.binaryName ?? deriveBinaryName(pkg.name);
|
|
133
149
|
const appId = ship.appId ?? flatpak.appId ?? reverseDnsOrThrow(pkg.name, binaryName);
|
|
134
150
|
const name = metadata.name ?? titleCase(binaryName);
|
|
135
|
-
|
|
151
|
+
// Through the shared resolver, so the PRE-BUILD gate and this function cannot
|
|
152
|
+
// answer "is this a GUI application" differently — see {@link resolveShipKind}.
|
|
153
|
+
const kind = resolveShipKind(ship, flatpak);
|
|
136
154
|
// NOT resolved here: `resolveShipApp` already did, before the format list was
|
|
137
155
|
// decided from it. A second defaulting rule in this function would be the
|
|
138
156
|
// second path those two answers could come apart on.
|
|
@@ -61,7 +61,7 @@ export interface ShipArtifact {
|
|
|
61
61
|
* TEXTUALLY and fails if a comment gives it a second match, which is why this one
|
|
62
62
|
* describes the union without quoting its head.
|
|
63
63
|
*/
|
|
64
|
-
export type FormatId = 'deb' | 'rpm' | 'flatpak' | 'macos-app' | 'macos-app-zip' | 'macos-app-dmg' | 'windows-dir' | 'windows-dir-zip' | 'msi';
|
|
64
|
+
export type FormatId = 'deb' | 'rpm' | 'flatpak' | 'appimage' | 'macos-app' | 'macos-app-zip' | 'macos-app-dmg' | 'windows-dir' | 'windows-dir-zip' | 'msi';
|
|
65
65
|
/**
|
|
66
66
|
* The formats whose ARTIFACT carries a distro dependency list.
|
|
67
67
|
*
|
|
@@ -264,6 +264,22 @@ export interface FormatDescriptor {
|
|
|
264
264
|
* makes this a property of the CONTAINER rather than "macOS is special".
|
|
265
265
|
*/
|
|
266
266
|
artifactKind: 'file' | 'directory';
|
|
267
|
+
/**
|
|
268
|
+
* This container cannot hold a `kind: 'cli'` project at all.
|
|
269
|
+
*
|
|
270
|
+
* A ROW'S FACT, so the refusal fires BEFORE the project's build like
|
|
271
|
+
* `assertCanPack`'s two do, and for the identical reason: `gjsify.ship.kind`
|
|
272
|
+
* is configuration, so the answer is knowable up front and discovering it
|
|
273
|
+
* after `runProjectBuild` costs the whole build for a refusal nothing learned
|
|
274
|
+
* from building. `appimage` is the only row that sets it — appimagetool
|
|
275
|
+
* refuses an AppDir with no `.desktop` at its root, and a CLI project stages
|
|
276
|
+
* none by design. A `.deb`, an `.rpm` and a Flatpak all ship a CLI perfectly.
|
|
277
|
+
*
|
|
278
|
+
* NOT the same question as the ICON half of `assertAppImageIsPackable`, which
|
|
279
|
+
* stays on the pack path: an icon is DISCOVERED, and discovery legitimately
|
|
280
|
+
* reads files the build produces.
|
|
281
|
+
*/
|
|
282
|
+
requiresDesktopEntry?: true;
|
|
267
283
|
}
|
|
268
284
|
/** One shared-mime-info type definition (`gjsify.ship.mimeTypes`). */
|
|
269
285
|
export interface ShipMimeType {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,21 +142,21 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/buffer": "^0.
|
|
146
|
-
"@gjsify/create-app": "^0.
|
|
147
|
-
"@gjsify/node-globals": "^0.
|
|
148
|
-
"@gjsify/node-polyfills": "^0.
|
|
149
|
-
"@gjsify/npm-registry": "^0.
|
|
150
|
-
"@gjsify/resolve-npm": "^0.
|
|
151
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.
|
|
152
|
-
"@gjsify/vite-plugin-blueprint": "^0.
|
|
153
|
-
"@gjsify/rolldown-plugin-pnp": "^0.
|
|
154
|
-
"@gjsify/semver": "^0.
|
|
155
|
-
"@gjsify/tar": "^0.
|
|
156
|
-
"@gjsify/tsc": "^0.
|
|
157
|
-
"@gjsify/utils": "^0.
|
|
158
|
-
"@gjsify/web-polyfills": "^0.
|
|
159
|
-
"@gjsify/workspace": "^0.
|
|
145
|
+
"@gjsify/buffer": "^0.51.0",
|
|
146
|
+
"@gjsify/create-app": "^0.51.0",
|
|
147
|
+
"@gjsify/node-globals": "^0.51.0",
|
|
148
|
+
"@gjsify/node-polyfills": "^0.51.0",
|
|
149
|
+
"@gjsify/npm-registry": "^0.51.0",
|
|
150
|
+
"@gjsify/resolve-npm": "^0.51.0",
|
|
151
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.51.0",
|
|
152
|
+
"@gjsify/vite-plugin-blueprint": "^0.51.0",
|
|
153
|
+
"@gjsify/rolldown-plugin-pnp": "^0.51.0",
|
|
154
|
+
"@gjsify/semver": "^0.51.0",
|
|
155
|
+
"@gjsify/tar": "^0.51.0",
|
|
156
|
+
"@gjsify/tsc": "^0.51.0",
|
|
157
|
+
"@gjsify/utils": "^0.51.0",
|
|
158
|
+
"@gjsify/web-polyfills": "^0.51.0",
|
|
159
|
+
"@gjsify/workspace": "^0.51.0",
|
|
160
160
|
"acorn": "^8.17.0",
|
|
161
161
|
"cosmiconfig": "^9.0.2",
|
|
162
162
|
"get-tsconfig": "^4.14.0",
|
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
"yargs": "^18.0.0"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
|
-
"@gjsify/unit": "^0.
|
|
168
|
+
"@gjsify/unit": "^0.51.0",
|
|
169
169
|
"@types/yargs": "^17.0.35",
|
|
170
170
|
"typescript": "^6.0.3"
|
|
171
171
|
},
|
|
172
172
|
"peerDependencies": {
|
|
173
|
-
"@gjsify/oxfmt-native": "^0.
|
|
174
|
-
"@gjsify/rolldown-native": "^0.
|
|
173
|
+
"@gjsify/oxfmt-native": "^0.51.0",
|
|
174
|
+
"@gjsify/rolldown-native": "^0.51.0"
|
|
175
175
|
},
|
|
176
176
|
"peerDependenciesMeta": {
|
|
177
177
|
"@gjsify/oxfmt-native": {
|