@gjsify/cli 0.64.57 → 0.64.58
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 +68 -68
- package/lib/types/config-data.d.ts +14 -0
- package/lib/utils/ship/settings.js +1 -0
- package/lib/utils/ship/snap.js +10 -0
- package/lib/utils/ship/stage-manifest.js +9 -0
- package/lib/utils/ship/types.d.ts +5 -0
- package/package.json +20 -20
|
@@ -786,6 +786,8 @@ export interface ConfigDataShip extends AppMetadata {
|
|
|
786
786
|
* NOT move, is `utils/ship/flatpak-config.ts`.
|
|
787
787
|
*/
|
|
788
788
|
flatpak?: ShipFlatpakOptions;
|
|
789
|
+
/** How `--target snap` confines the app (ADR 0149). */
|
|
790
|
+
snap?: ShipSnapOptions;
|
|
789
791
|
/**
|
|
790
792
|
* The signing identity this project uses by default, per OS.
|
|
791
793
|
*
|
|
@@ -997,6 +999,18 @@ export interface ShipSignOptions {
|
|
|
997
999
|
* those keys are read by `flatpak init` only, and dropping them at exit 0 hid an
|
|
998
1000
|
* `extra-data` module until the app ran without its downloaded binary.
|
|
999
1001
|
*/
|
|
1002
|
+
/**
|
|
1003
|
+
* `gjsify.ship.snap` — only what differs per app (ADR 0149). Strict confinement plus the
|
|
1004
|
+
* plugs of the `gnome` extension is the default; a capability beyond that is named here,
|
|
1005
|
+
* the way `finishArgs` names it for a Flatpak.
|
|
1006
|
+
*/
|
|
1007
|
+
export interface ShipSnapOptions {
|
|
1008
|
+
/**
|
|
1009
|
+
* Interfaces the app plugs IN ADDITION to the extension's, e.g. `['network',
|
|
1010
|
+
* 'network-bind']` for an app that serves on loopback. Interface names only.
|
|
1011
|
+
*/
|
|
1012
|
+
plugs?: string[];
|
|
1013
|
+
}
|
|
1000
1014
|
export interface ShipFlatpakOptions {
|
|
1001
1015
|
/**
|
|
1002
1016
|
* Runtime family. Default `'gnome'` — a GJS bundle needs GLib/GObject/GIO at
|
|
@@ -274,6 +274,7 @@ export function resolveShipSettings(input) {
|
|
|
274
274
|
minGjsVersion: ship.minGjsVersion ?? DEFAULT_GJS_FLOOR,
|
|
275
275
|
minNodeVersion: ship.minNodeVersion ?? DEFAULT_NODE_FLOOR,
|
|
276
276
|
flatpak: flatpakSettings.settings,
|
|
277
|
+
...(ship.snap?.plugs === undefined || ship.snap.plugs.length === 0 ? {} : { snapPlugs: ship.snap.plugs }),
|
|
277
278
|
};
|
|
278
279
|
return { settings, metadata, warnings };
|
|
279
280
|
}
|
package/lib/utils/ship/snap.js
CHANGED
|
@@ -58,6 +58,8 @@ export function isSnapName(name) {
|
|
|
58
58
|
return name.length <= SNAP_NAME_MAX && SNAP_NAME.test(name);
|
|
59
59
|
}
|
|
60
60
|
const SNAP_SUMMARY_MAX = 78;
|
|
61
|
+
/** An interface name as snapd spells one (`network-bind`, `removable-media`). */
|
|
62
|
+
const SNAP_INTERFACE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
61
63
|
/**
|
|
62
64
|
* Everything the store or snapcraft would refuse, refused here with the field named.
|
|
63
65
|
*
|
|
@@ -76,6 +78,11 @@ export function assertSnapIsPackable(payload, settings) {
|
|
|
76
78
|
if (settings.summary.length > SNAP_SUMMARY_MAX) {
|
|
77
79
|
problems.push(`the summary is ${settings.summary.length} characters, the store takes ${SNAP_SUMMARY_MAX}`);
|
|
78
80
|
}
|
|
81
|
+
for (const plug of settings.snapPlugs ?? []) {
|
|
82
|
+
if (!SNAP_INTERFACE.test(plug)) {
|
|
83
|
+
problems.push(`gjsify.ship.snap.plugs: "${plug}" is not an interface name (lowercase letters, digits, hyphens)`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
79
86
|
const desktop = snapDesktopPath(settings);
|
|
80
87
|
if (!payload.some((entry) => entry.path === desktop)) {
|
|
81
88
|
problems.push(`the payload has no ${desktop}, which the snap's \`desktop:\` key must point at`);
|
|
@@ -104,6 +111,9 @@ export function renderSnapcraftManifest(input) {
|
|
|
104
111
|
'common-id': settings.appId,
|
|
105
112
|
environment: { GI_TYPELIB_PATH: GJS_PRIVATE_TYPELIB_DIR },
|
|
106
113
|
};
|
|
114
|
+
// snapcraft merges the extension's plugs into this list, so it names only the additions.
|
|
115
|
+
if (settings.snapPlugs !== undefined && settings.snapPlugs.length > 0)
|
|
116
|
+
app.plugs = [...settings.snapPlugs];
|
|
107
117
|
const manifest = {
|
|
108
118
|
name: settings.binaryName,
|
|
109
119
|
title: settings.name,
|
|
@@ -143,6 +143,9 @@ export function toPackSettings(settings) {
|
|
|
143
143
|
? {}
|
|
144
144
|
: { nodeModulesDirs: settings.nodeModulesDirs }),
|
|
145
145
|
flatpak: settings.flatpak,
|
|
146
|
+
...(settings.snapPlugs === undefined || settings.snapPlugs.length === 0
|
|
147
|
+
? {}
|
|
148
|
+
: { snapPlugs: settings.snapPlugs }),
|
|
146
149
|
executables: settings.executables.map(({ name, gui }) => ({ name, gui })),
|
|
147
150
|
nestedBundles: settings.nestedBundles.map(({ name, entitlements }) => ({ name, entitlements })),
|
|
148
151
|
helperExecutables: settings.helperExecutables.map(({ name, entitlements }) => ({ name, entitlements })),
|
|
@@ -507,6 +510,12 @@ function readPackSettings(data, at) {
|
|
|
507
510
|
minGjsVersion: expectString(data.minGjsVersion, field('minGjsVersion')),
|
|
508
511
|
minNodeVersion: expectString(data.minNodeVersion, field('minNodeVersion')),
|
|
509
512
|
flatpak: readFlatpakSettings(record(data.flatpak, field('flatpak')), field('flatpak')),
|
|
513
|
+
// OPTIONAL on read: a stage written before `gjsify.ship.snap.plugs` declares none.
|
|
514
|
+
...(data.snapPlugs === undefined
|
|
515
|
+
? {}
|
|
516
|
+
: {
|
|
517
|
+
snapPlugs: expectArray(data.snapPlugs, field('snapPlugs')).map((entry, index) => expectString(entry, field(`snapPlugs[${index}]`))),
|
|
518
|
+
}),
|
|
510
519
|
// OPTIONAL on read: a stage written before the tarball learned the declared closure has none.
|
|
511
520
|
...(data.nodeModulesDirs === undefined
|
|
512
521
|
? {}
|
|
@@ -434,6 +434,11 @@ export interface PackSettings {
|
|
|
434
434
|
minNodeVersion: string;
|
|
435
435
|
/** The Flatpak manifest's non-payload half, fully defaulted at stage time. */
|
|
436
436
|
flatpak: ShipFlatpakSettings;
|
|
437
|
+
/**
|
|
438
|
+
* `gjsify.ship.snap.plugs`: interfaces the snap plugs beyond the `gnome` extension's.
|
|
439
|
+
* Absent when none are declared, so a stage without them stays byte-identical.
|
|
440
|
+
*/
|
|
441
|
+
snapPlugs?: string[];
|
|
437
442
|
/**
|
|
438
443
|
* The package's FURTHER executables (`gjsify.ship.executables`); `[]` for a single-executable
|
|
439
444
|
* package. Name and subsystem only: the entry each one runs is already inside its staged
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.58",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,22 +142,22 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/blueprint": "0.64.
|
|
146
|
-
"@gjsify/buffer": "0.64.
|
|
147
|
-
"@gjsify/create-app": "0.64.
|
|
148
|
-
"@gjsify/node-globals": "0.64.
|
|
149
|
-
"@gjsify/node-polyfills": "0.64.
|
|
150
|
-
"@gjsify/npm-registry": "0.64.
|
|
151
|
-
"@gjsify/resolve-npm": "0.64.
|
|
152
|
-
"@gjsify/rolldown-plugin-gjsify": "0.64.
|
|
153
|
-
"@gjsify/vite-plugin-blueprint": "0.64.
|
|
154
|
-
"@gjsify/rolldown-plugin-pnp": "0.64.
|
|
155
|
-
"@gjsify/semver": "0.64.
|
|
156
|
-
"@gjsify/tar": "0.64.
|
|
157
|
-
"@gjsify/tsc": "0.64.
|
|
158
|
-
"@gjsify/utils": "0.64.
|
|
159
|
-
"@gjsify/web-polyfills": "0.64.
|
|
160
|
-
"@gjsify/workspace": "0.64.
|
|
145
|
+
"@gjsify/blueprint": "0.64.58",
|
|
146
|
+
"@gjsify/buffer": "0.64.58",
|
|
147
|
+
"@gjsify/create-app": "0.64.58",
|
|
148
|
+
"@gjsify/node-globals": "0.64.58",
|
|
149
|
+
"@gjsify/node-polyfills": "0.64.58",
|
|
150
|
+
"@gjsify/npm-registry": "0.64.58",
|
|
151
|
+
"@gjsify/resolve-npm": "0.64.58",
|
|
152
|
+
"@gjsify/rolldown-plugin-gjsify": "0.64.58",
|
|
153
|
+
"@gjsify/vite-plugin-blueprint": "0.64.58",
|
|
154
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.58",
|
|
155
|
+
"@gjsify/semver": "0.64.58",
|
|
156
|
+
"@gjsify/tar": "0.64.58",
|
|
157
|
+
"@gjsify/tsc": "0.64.58",
|
|
158
|
+
"@gjsify/utils": "0.64.58",
|
|
159
|
+
"@gjsify/web-polyfills": "0.64.58",
|
|
160
|
+
"@gjsify/workspace": "0.64.58",
|
|
161
161
|
"acorn": "^8.17.0",
|
|
162
162
|
"cosmiconfig": "^9.0.2",
|
|
163
163
|
"get-tsconfig": "^4.14.0",
|
|
@@ -166,13 +166,13 @@
|
|
|
166
166
|
"yargs": "^18.0.0"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@gjsify/unit": "0.64.
|
|
169
|
+
"@gjsify/unit": "0.64.58",
|
|
170
170
|
"@types/yargs": "^17.0.35",
|
|
171
171
|
"typescript": "^6.0.3"
|
|
172
172
|
},
|
|
173
173
|
"peerDependencies": {
|
|
174
|
-
"@gjsify/oxfmt-native": "0.64.
|
|
175
|
-
"@gjsify/rolldown-native": "0.64.
|
|
174
|
+
"@gjsify/oxfmt-native": "0.64.58",
|
|
175
|
+
"@gjsify/rolldown-native": "0.64.58"
|
|
176
176
|
},
|
|
177
177
|
"peerDependenciesMeta": {
|
|
178
178
|
"@gjsify/oxfmt-native": {
|