@gtkx/config 2.0.0-beta.12 → 2.0.0-beta.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.
Files changed (45) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +13 -1
  3. package/dist/builtin-elements.d.ts.map +1 -1
  4. package/dist/builtin-elements.js +47 -10
  5. package/dist/builtin-elements.js.map +1 -1
  6. package/dist/config-source.d.ts +2 -2
  7. package/dist/config-source.d.ts.map +1 -1
  8. package/dist/config-source.js +10 -7
  9. package/dist/config-source.js.map +1 -1
  10. package/dist/config.d.ts +256 -57
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +27 -72
  13. package/dist/config.js.map +1 -1
  14. package/dist/deploy.d.ts +930 -55
  15. package/dist/deploy.d.ts.map +1 -1
  16. package/dist/deploy.js +6 -161
  17. package/dist/deploy.js.map +1 -1
  18. package/dist/index.d.ts +8 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +6 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/internal.d.ts +1 -1
  23. package/dist/internal.d.ts.map +1 -1
  24. package/dist/internal.js +1 -1
  25. package/dist/internal.js.map +1 -1
  26. package/dist/loader.d.ts +20 -4
  27. package/dist/loader.d.ts.map +1 -1
  28. package/dist/loader.js +51 -18
  29. package/dist/loader.js.map +1 -1
  30. package/dist/virtual.d.ts.map +1 -1
  31. package/dist/virtual.js +1 -0
  32. package/dist/virtual.js.map +1 -1
  33. package/dist/vite-plugin.d.ts +5 -0
  34. package/dist/vite-plugin.d.ts.map +1 -1
  35. package/dist/vite-plugin.js.map +1 -1
  36. package/package.json +5 -5
  37. package/src/builtin-elements.ts +49 -10
  38. package/src/config-source.ts +11 -7
  39. package/src/config.ts +289 -91
  40. package/src/deploy.ts +991 -199
  41. package/src/index.ts +39 -2
  42. package/src/internal.ts +1 -0
  43. package/src/loader.ts +96 -22
  44. package/src/virtual.ts +1 -0
  45. package/src/vite-plugin.ts +5 -0
package/src/deploy.ts CHANGED
@@ -59,107 +59,225 @@ const minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), mini
59
59
  error: MINIMUM_LIBRARY_VERSIONS_ERROR,
60
60
  });
61
61
 
62
+ /** Package relations of one kind, such as dependencies, in Debian and RPM dependency syntax. */
63
+ type DeployPackageRelationOptions = {
64
+ /**
65
+ * Package relations expressed in Debian dependency syntax.
66
+ *
67
+ * @defaultValue `[]`
68
+ */
69
+ deb?: string[] | undefined;
70
+ /**
71
+ * Package relations expressed in RPM dependency syntax.
72
+ *
73
+ * @defaultValue `[]`
74
+ */
75
+ rpm?: string[] | undefined;
76
+ };
77
+
62
78
  const relationsSchema = z.strictObject({
63
- /** Package relations expressed in Debian dependency syntax. */
64
79
  deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
65
- /** Package relations expressed in RPM dependency syntax. */
66
80
  rpm: textList("RPM package relation", "must be an array of RPM package relations").optional(),
67
- });
81
+ }) satisfies z.ZodType<DeployPackageRelationOptions>;
82
+
83
+ /** Package relations of a kind only Debian packages have, in Debian dependency syntax. */
84
+ type DeployDebPackageRelationOptions = {
85
+ /**
86
+ * Package relations expressed in Debian dependency syntax. RPM has no equivalent relation.
87
+ *
88
+ * @defaultValue `[]`
89
+ */
90
+ deb?: string[] | undefined;
91
+ };
92
+
93
+ const debRelationsSchema = z.strictObject({
94
+ deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
95
+ }) satisfies z.ZodType<DeployDebPackageRelationOptions>;
96
+
97
+ /** The `deploy.developer` options: who develops and maintains the application. */
98
+ type DeployDeveloperOptions = {
99
+ /**
100
+ * Reverse-DNS developer identifier.
101
+ *
102
+ * @defaultValue The application ID without its last segment, such as `com.example` for `com.example.Tasks`;
103
+ * none when the application ID has only two segments
104
+ */
105
+ id?: string | undefined;
106
+ /**
107
+ * Developer or organization name. Deployment fails when neither this nor the `package.json` author is set.
108
+ *
109
+ * @defaultValue The `author` name in `package.json`
110
+ */
111
+ name?: string | undefined;
112
+ /**
113
+ * Maintainer email address.
114
+ *
115
+ * @defaultValue The `author` email in `package.json`, if it has one
116
+ */
117
+ email?: string | undefined;
118
+ };
68
119
 
69
120
  const developerSchema = z.strictObject({
70
- /** Reverse-DNS developer identifier, derived from the application ID when omitted. */
71
121
  id: text("must be a reverse-DNS developer id").optional(),
72
- /** Developer or organization name. Defaults to the author in package.json. */
73
122
  name: text("must be a developer or organization name").optional(),
74
- /** Maintainer email address. Defaults to the author's email in package.json. */
75
123
  email: text("must be an email address").optional(),
76
- });
124
+ }) satisfies z.ZodType<DeployDeveloperOptions>;
77
125
 
78
126
  /** One software-center screenshot in `deploy.screenshots`. Either `url` or `file` must be set. */
79
- type DeployScreenshotOptions = z.infer<typeof screenshotSchema>;
127
+ type DeployScreenshotOptions = {
128
+ /**
129
+ * Absolute URL of a PNG or JPEG screenshot. Takes precedence over `file`.
130
+ *
131
+ * @defaultValue None; each entry sets `url` or `file`
132
+ */
133
+ url?: string | undefined;
134
+ /**
135
+ * Screenshot path relative to the project root, resolved against `screenshotBaseUrl`.
136
+ *
137
+ * @defaultValue None; each entry sets `url` or `file`
138
+ */
139
+ file?: string | undefined;
140
+ /**
141
+ * Caption displayed with the screenshot in software centers.
142
+ *
143
+ * @defaultValue None: the screenshot has no `caption`
144
+ */
145
+ caption?: string | undefined;
146
+ /**
147
+ * Marks the primary screenshot. Only the first entry set to `true` is used.
148
+ *
149
+ * @defaultValue `false`; when no entry sets it, no screenshot is marked primary
150
+ */
151
+ isDefault?: boolean | undefined;
152
+ };
80
153
 
81
- /** Screenshot entry schema and the source of {@link DeployScreenshotOptions}. */
82
154
  const screenshotSchema = z
83
155
  .strictObject({
84
- /** Absolute URL of a PNG or JPEG screenshot. Takes precedence over `file`. */
85
156
  url: url("must be an absolute URL to a PNG or JPEG").optional(),
86
- /** Screenshot path relative to the project root, resolved against `screenshotBaseUrl`. */
87
157
  file: text("must be an image path relative to the project root").optional(),
88
- /** Caption displayed with the screenshot in software centers. */
89
158
  caption: text("must be a screenshot caption").optional(),
90
- /** Marks the primary screenshot. Only the first entry set to `true` is used. */
91
159
  isDefault: flag(BOOLEAN_ERROR).optional(),
92
160
  })
93
161
  .refine((entry) => entry.url !== undefined || entry.file !== undefined, {
94
162
  error: "must have either a `url` or a `file`",
95
- });
163
+ }) satisfies z.ZodType<DeployScreenshotOptions>;
96
164
 
97
165
  /** One AppStream release-history entry in `deploy.releases`. */
98
- type DeployReleaseOptions = z.infer<typeof releaseSchema>;
166
+ type DeployReleaseOptions = {
167
+ /** Application version described by this release. */
168
+ version: string;
169
+ /** Release date in `YYYY-MM-DD` format. */
170
+ date: string;
171
+ /**
172
+ * AppStream release classification.
173
+ *
174
+ * @defaultValue None: the release has no `type` attribute, which AppStream reads as `stable`
175
+ */
176
+ type?: "development" | "snapshot" | "stable" | undefined;
177
+ /**
178
+ * AppStream update urgency.
179
+ *
180
+ * @defaultValue None: the release has no `urgency` attribute
181
+ */
182
+ urgency?: "critical" | "high" | "low" | "medium" | undefined;
183
+ /**
184
+ * Release notes, with each entry rendered as a paragraph.
185
+ *
186
+ * @defaultValue `[]`
187
+ */
188
+ notes?: string[] | undefined;
189
+ /**
190
+ * Absolute URL containing further details about the release.
191
+ *
192
+ * @defaultValue None: the release has no `url` element
193
+ */
194
+ url?: string | undefined;
195
+ };
99
196
 
100
- /** Release-history entry schema and the source of {@link DeployReleaseOptions}. */
101
197
  const releaseSchema = z.strictObject({
102
- /** Application version described by this release. */
103
198
  version: text(VERSION_ERROR),
104
- /** Release date in `YYYY-MM-DD` format. */
105
199
  date: z.iso.date({ error: "must be an ISO date (YYYY-MM-DD)" }),
106
- /** AppStream release classification. */
107
200
  type: z.enum(RELEASE_TYPES, { error: "must be one of development, snapshot, stable" }).optional(),
108
- /** AppStream update urgency. */
109
201
  urgency: z.enum(RELEASE_URGENCIES, { error: "must be one of critical, high, low, medium" }).optional(),
110
- /** Release notes, with each entry rendered as a paragraph. */
111
202
  notes: textList("release note paragraph", "must be an array of release note paragraphs").optional(),
112
- /** Absolute URL containing further details about the release. */
113
203
  url: url(URL_ERROR).optional(),
114
- });
204
+ }) satisfies z.ZodType<DeployReleaseOptions>;
115
205
 
116
206
  /** One file extension and MIME type registered through `deploy.fileAssociations`. */
117
- type DeployFileAssociationOptions = z.infer<typeof fileAssociationSchema>;
207
+ type DeployFileAssociationOptions = {
208
+ /** File extension to associate with the application, without a leading dot. */
209
+ extension: string;
210
+ /** MIME type registered for the file extension. */
211
+ mimeType: string;
212
+ /**
213
+ * Human-readable description of the file type.
214
+ *
215
+ * @defaultValue None: the MIME type has no `comment`
216
+ */
217
+ description?: string | undefined;
218
+ };
118
219
 
119
- /** File association schema and the source of {@link DeployFileAssociationOptions}. */
120
220
  const fileAssociationSchema = z.strictObject({
121
- /** File extension to associate with the application, without a leading dot. */
122
221
  extension: fileExtension("must be a file extension without a leading dot"),
123
- /** MIME type registered for the file extension. */
124
222
  mimeType: text("must be a MIME type such as text/plain"),
125
- /** Human-readable description of the file type. */
126
223
  description: text("must be a description of the file type").optional(),
127
- });
224
+ }) satisfies z.ZodType<DeployFileAssociationOptions>;
128
225
 
129
226
  /** One desktop launcher action in `deploy.desktopActions`, keyed by its action ID. */
130
- type DeployDesktopActionOptions = z.infer<typeof desktopActionSchema>;
227
+ type DeployDesktopActionOptions = {
228
+ /** Action label shown in the desktop launcher menu. */
229
+ name: string;
230
+ /**
231
+ * Arguments appended to the launch command when the action is chosen. Launchers activate the `app.<id>`
232
+ * application action of a D-Bus-activatable application instead of running this command.
233
+ *
234
+ * @defaultValue `[]`
235
+ */
236
+ args?: string[] | undefined;
237
+ /**
238
+ * Icon theme name used for the action.
239
+ *
240
+ * @defaultValue None: the action has no `Icon` key
241
+ */
242
+ icon?: string | undefined;
243
+ };
131
244
 
132
- /** Desktop launcher action schema and the source of {@link DeployDesktopActionOptions}. */
133
245
  const desktopActionSchema = z.strictObject({
134
- /** Action label shown in the desktop launcher menu. */
135
246
  name: text("must be an action name"),
136
- /** Arguments passed to the application when the action is activated. */
137
247
  args: textList("argument", "must be an array of arguments appended to Exec").optional(),
138
- /** Icon theme name used for the action. */
139
248
  icon: text("must be an icon name").optional(),
140
- });
249
+ }) satisfies z.ZodType<DeployDesktopActionOptions>;
141
250
 
142
- const brandingSchema = z.strictObject({
251
+ /** The `deploy.branding` colors software centers use around the application's listing. */
252
+ type DeployBrandingOptions = {
143
253
  /** Primary AppStream branding color for light mode, in `#rrggbb` format. */
144
- light: hexColorSchema,
254
+ light: string;
145
255
  /** Primary AppStream branding color for dark mode, in `#rrggbb` format. */
256
+ dark: string;
257
+ };
258
+
259
+ const brandingSchema = z.strictObject({
260
+ light: hexColorSchema,
146
261
  dark: hexColorSchema,
147
- });
262
+ }) satisfies z.ZodType<DeployBrandingOptions>;
148
263
 
149
264
  /**
150
- * A `deploy.extraFiles` entry in object form: the source file, resolved against the project root, that is
151
- * installed at the entry's prefix-relative destination, and the octal mode it is installed with.
265
+ * A `deploy.extraFiles` entry in object form: the source file or directory, resolved against the project root,
266
+ * that is installed at the entry's prefix-relative destination, and the octal mode it is installed with.
152
267
  */
153
268
  type DeployExtraFileOptions = {
154
- /** Source file path, resolved relative to the project root. */
269
+ /** Source file or directory path, resolved relative to the project root. */
155
270
  source: string;
156
- /** Octal file mode. Setuid and setgid bits are rejected. */
271
+ /**
272
+ * Octal file mode, applied to every file of a directory source. Setuid and setgid bits are rejected.
273
+ *
274
+ * @defaultValue `"0755"` for a file whose source is executable, `"0644"` otherwise
275
+ */
157
276
  mode?: string | undefined;
158
277
  };
159
- const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
160
- /** Source file path, resolved relative to the project root. */
278
+
279
+ const extraFileSchema = z.strictObject({
161
280
  source: text(SOURCE_PATH_ERROR),
162
- /** Octal file mode. Setuid and setgid bits are rejected. */
163
281
  mode: z
164
282
  .string({ error: FILE_MODE_ERROR })
165
283
  .regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })
@@ -167,7 +285,7 @@ const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
167
285
  error: FILE_MODE_ERROR,
168
286
  })
169
287
  .optional(),
170
- });
288
+ }) satisfies z.ZodType<DeployExtraFileOptions>;
171
289
 
172
290
  const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema], { error: EXTRA_FILE_ERROR });
173
291
 
@@ -189,336 +307,1010 @@ const nodeFlagsSchema = z.array(
189
307
  * is expected to be, whether its binary is stripped, and whether the launcher enables the compile cache.
190
308
  */
191
309
  type DeployNodeOptions = {
192
- /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
310
+ /**
311
+ * Runtime source: an official download, the running Node.js executable, or `path`.
312
+ *
313
+ * @defaultValue `"download"`
314
+ */
193
315
  source?: "download" | "host" | "path" | undefined;
194
- /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
316
+ /**
317
+ * Expected Node.js version. Only a downloaded runtime uses it.
318
+ *
319
+ * @defaultValue `"26.8.2"` for a downloaded runtime
320
+ */
195
321
  version?: string | undefined;
196
- /** Node.js executable path relative to the project root, required when `source` is `path`. */
322
+ /**
323
+ * Node.js executable path relative to the project root, required when `source` is `path`.
324
+ *
325
+ * @defaultValue None; required when `source` is `"path"`
326
+ */
197
327
  path?: string | undefined;
198
- /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
328
+ /**
329
+ * Strip the runtime when its architecture matches the host and `strip` is available.
330
+ *
331
+ * @defaultValue `true`
332
+ */
199
333
  shouldStrip?: boolean | undefined;
200
- /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
334
+ /**
335
+ * Enable Node.js compile caching in the generated launcher.
336
+ *
337
+ * @defaultValue `true`
338
+ */
201
339
  shouldUseCompileCache?: boolean | undefined;
202
340
  };
203
- const nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = z.strictObject({
204
- /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
341
+
342
+ const nodeRuntimeSchema = z.strictObject({
205
343
  source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
206
- /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
207
344
  version: text("must be a Node.js version such as 26.7.0").optional(),
208
- /** Node.js executable path relative to the project root, required when `source` is `path`. */
209
345
  path: text("must be a path to a node binary").optional(),
210
- /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
211
346
  shouldStrip: flag(BOOLEAN_ERROR).optional(),
212
- /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
213
347
  shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),
214
- });
348
+ }) satisfies z.ZodType<DeployNodeOptions>;
349
+
350
+ /**
351
+ * The `deploy.scripts` options: maintainer scripts for Debian and RPM packages. Each value is a path to a
352
+ * shell script file, not inline shell; the package carries the file's content.
353
+ */
354
+ type DeployScriptsOptions = {
355
+ /**
356
+ * Path to a shell script, relative to the project root, run before installing a Debian or RPM package.
357
+ *
358
+ * @defaultValue None: `gtkx deploy` adds no script for this step
359
+ */
360
+ preInstall?: string | undefined;
361
+ /**
362
+ * Path to a shell script, relative to the project root, run after installing a Debian or RPM package.
363
+ *
364
+ * @defaultValue None: `gtkx deploy` adds no script for this step
365
+ */
366
+ postInstall?: string | undefined;
367
+ /**
368
+ * Path to a shell script, relative to the project root, run before removing a Debian or RPM package.
369
+ *
370
+ * @defaultValue None: `gtkx deploy` adds no script for this step
371
+ */
372
+ preRemove?: string | undefined;
373
+ /**
374
+ * Path to a shell script, relative to the project root, run after removing a Debian or RPM package.
375
+ *
376
+ * @defaultValue None: `gtkx deploy` adds no script for this step
377
+ */
378
+ postRemove?: string | undefined;
379
+ };
215
380
 
216
381
  const scriptsSchema = z.strictObject({
217
- /** Shell script run before installing a Debian or RPM package. */
218
382
  preInstall: text(SCRIPT_ERROR).optional(),
219
- /** Shell script run after installing a Debian or RPM package. */
220
383
  postInstall: text(SCRIPT_ERROR).optional(),
221
- /** Shell script run before removing a Debian or RPM package. */
222
384
  preRemove: text(SCRIPT_ERROR).optional(),
223
- /** Shell script run after removing a Debian or RPM package. */
224
385
  postRemove: text(SCRIPT_ERROR).optional(),
225
- });
386
+ }) satisfies z.ZodType<DeployScriptsOptions>;
387
+
388
+ /** The `deploy.tools` options: executables `gtkx deploy` runs instead of the ones it downloads. */
389
+ type DeployToolsOptions = {
390
+ /**
391
+ * nFPM executable name or path relative to the project root.
392
+ *
393
+ * @defaultValue A pinned nFPM release that `gtkx deploy` downloads and verifies against its `sha256`
394
+ */
395
+ nfpm?: string | undefined;
396
+ };
226
397
 
227
398
  const toolsSchema = z.strictObject({
228
- /** nFPM executable name or path relative to the project root. Defaults to a verified pinned download. */
229
399
  nfpm: text("must be an nFPM executable name or path").optional(),
230
- });
400
+ }) satisfies z.ZodType<DeployToolsOptions>;
401
+
402
+ /** The `deploy.deb` options: Debian package metadata and compression. */
403
+ type DeployDebOptions = {
404
+ /**
405
+ * Debian package name.
406
+ *
407
+ * @defaultValue `deploy.binaryName`
408
+ */
409
+ packageName?: string | undefined;
410
+ /**
411
+ * Debian archive section.
412
+ *
413
+ * @defaultValue Derived from `deploy.categories`, such as `devel` for `Development`, or `misc` when no
414
+ * category matches
415
+ */
416
+ section?: string | undefined;
417
+ /**
418
+ * Debian package priority.
419
+ *
420
+ * @defaultValue `"optional"`
421
+ */
422
+ priority?: string | undefined;
423
+ /**
424
+ * Compression used for the Debian package payload.
425
+ *
426
+ * @defaultValue nFPM's default, `gzip`
427
+ */
428
+ compression?: "gzip" | "none" | "xz" | "zstd" | undefined;
429
+ /**
430
+ * Additional Debian control fields, keyed by field name.
431
+ *
432
+ * @defaultValue `{}`
433
+ */
434
+ fields?: Record<string, string> | undefined;
435
+ };
231
436
 
232
437
  const debSchema = z.strictObject({
233
- /** Debian package name. Defaults to `deploy.binaryName`. */
234
438
  packageName: text("must be a Debian package name").optional(),
235
- /** Debian archive section, derived from the application categories when omitted. */
236
439
  section: text("must be a Debian archive section").optional(),
237
- /** Debian package priority. Defaults to `optional`. */
238
440
  priority: text("must be a Debian priority").optional(),
239
- /** Compression used for the Debian package payload. */
240
441
  compression: z.enum(DEB_COMPRESSIONS, { error: "must be one of gzip, none, xz, zstd" }).optional(),
241
- /** Additional Debian control fields, keyed by field name. */
242
442
  fields: textRecord("must be a control field value", "must be a record of control field names to values").optional(),
243
- });
443
+ }) satisfies z.ZodType<DeployDebOptions>;
444
+
445
+ /** The `deploy.rpm` options: RPM package metadata and compression. */
446
+ type DeployRpmOptions = {
447
+ /**
448
+ * RPM package name.
449
+ *
450
+ * @defaultValue `deploy.binaryName`
451
+ */
452
+ packageName?: string | undefined;
453
+ /**
454
+ * RPM package group.
455
+ *
456
+ * @defaultValue Derived from `deploy.categories`, or `Applications/System` when no category matches
457
+ */
458
+ group?: string | undefined;
459
+ /**
460
+ * Compression used for the RPM package payload.
461
+ *
462
+ * @defaultValue nFPM's default, `gzip`
463
+ */
464
+ compression?: "gzip" | "lzma" | "xz" | "zstd" | undefined;
465
+ /**
466
+ * Installation prefixes that the RPM package allows users to relocate.
467
+ *
468
+ * @defaultValue `[]`: the package is not relocatable
469
+ */
470
+ prefixes?: string[] | undefined;
471
+ };
244
472
 
245
473
  const rpmSchema = z.strictObject({
246
- /** RPM package name. Defaults to `deploy.binaryName`. */
247
474
  packageName: text("must be an RPM package name").optional(),
248
- /** RPM package group, derived from the application categories when omitted. */
249
475
  group: text("must be an RPM group").optional(),
250
- /** Compression used for the RPM package payload. */
251
476
  compression: z.enum(RPM_COMPRESSIONS, { error: "must be one of gzip, lzma, xz, zstd" }).optional(),
252
- /** Installation prefixes that the RPM package allows users to relocate. */
253
477
  prefixes: textList("prefix", "must be an array of relocation prefixes").optional(),
254
- });
478
+ }) satisfies z.ZodType<DeployRpmOptions>;
479
+
480
+ /** The `deploy.appimage` options: AppImage file name, compression, update information and runtime. */
481
+ type DeployAppImageOptions = {
482
+ /**
483
+ * Output file name.
484
+ *
485
+ * @defaultValue `<name>-<version>-<arch>.AppImage`, with spaces in the display name replaced by underscores,
486
+ * such as `My_App-1.2.0-x86_64.AppImage`
487
+ */
488
+ fileName?: string | undefined;
489
+ /**
490
+ * Compression explicitly requested from appimagetool.
491
+ *
492
+ * @defaultValue None: appimagetool's own default, as GTKX passes no `--comp`
493
+ */
494
+ compression?: "zstd" | undefined;
495
+ /**
496
+ * AppImage update information string embedded in the executable.
497
+ *
498
+ * @defaultValue None: the AppImage embeds no update information, as GTKX passes no `-u`
499
+ */
500
+ updateInformation?: string | undefined;
501
+ /**
502
+ * Custom AppImage runtime file path, resolved relative to the project root.
503
+ *
504
+ * @defaultValue A pinned `type2-runtime` release that `gtkx deploy` downloads and verifies against its
505
+ * `sha256`
506
+ */
507
+ runtimeFile?: string | undefined;
508
+ };
255
509
 
256
510
  const appimageSchema = z.strictObject({
257
- /** Output file name, derived from the application name, version, and architecture when omitted. */
258
511
  fileName: text("must be an output file name").optional(),
259
- /** Compression explicitly requested from appimagetool. */
260
512
  compression: z.literal("zstd", { error: "must be zstd" }).optional(),
261
- /** AppImage update information string embedded in the executable. */
262
513
  updateInformation: text("must be an AppImage update information string").optional(),
263
- /** Custom AppImage runtime file path, resolved relative to the project root. */
264
514
  runtimeFile: text("must be a path to an AppImage runtime file").optional(),
265
- });
515
+ }) satisfies z.ZodType<DeployAppImageOptions>;
516
+
517
+ /** The `deploy.flatpak.source` options: the Git revision a source-mode Flatpak builds. */
518
+ type DeployFlatpakSourceOptions = {
519
+ /**
520
+ * Public HTTP or HTTPS Git repository URL.
521
+ *
522
+ * @defaultValue The URL of the project's `origin` Git remote
523
+ */
524
+ url?: string | undefined;
525
+ /**
526
+ * Git tag to build, pinned to its commit when `commit` is omitted.
527
+ *
528
+ * @defaultValue The tag that points at `HEAD`, if any, when `commit` is also omitted
529
+ */
530
+ tag?: string | undefined;
531
+ /**
532
+ * Git commit to build.
533
+ *
534
+ * @defaultValue The commit of `tag`, or the current `HEAD` without one
535
+ */
536
+ commit?: string | undefined;
537
+ };
266
538
 
267
539
  const flatpakSourceSchema = z.strictObject({
268
- /** Public HTTP or HTTPS Git repository URL. Defaults to the project's Git remote. */
269
540
  url: url("must be an absolute git URL").optional(),
270
- /** Git tag to build, pinned to its commit when `commit` is omitted. */
271
541
  tag: text("must be a git tag").optional(),
272
- /** Git commit to build. Defaults to the configured tag's commit or the current HEAD. */
273
542
  commit: text("must be a git commit sha").optional(),
274
- });
543
+ }) satisfies z.ZodType<DeployFlatpakSourceOptions>;
544
+
545
+ /** The `deploy.flatpak` options: runtime, sandbox permissions, build and distribution of the Flatpak. */
546
+ type DeployFlatpakOptions = {
547
+ /**
548
+ * Package local build output or build from a pinned Git source inside the SDK.
549
+ *
550
+ * @defaultValue `"prebuilt"`
551
+ */
552
+ mode?: "prebuilt" | "source" | undefined;
553
+ /**
554
+ * Flatpak runtime ID.
555
+ *
556
+ * @defaultValue `"org.gnome.Platform"`
557
+ */
558
+ runtime?: string | undefined;
559
+ /**
560
+ * Flatpak runtime branch.
561
+ *
562
+ * @defaultValue `"51"`
563
+ */
564
+ runtimeVersion?: string | undefined;
565
+ /**
566
+ * Build SDK ID.
567
+ *
568
+ * @defaultValue `"org.gnome.Sdk"`
569
+ */
570
+ sdk?: string | undefined;
571
+ /**
572
+ * Node.js SDK extension used in source mode.
573
+ *
574
+ * @defaultValue `"org.freedesktop.Sdk.Extension.node26"`
575
+ */
576
+ nodeExtension?: string | undefined;
577
+ /**
578
+ * Additional SDK extension IDs included in the build environment.
579
+ *
580
+ * @defaultValue `[]`
581
+ */
582
+ sdkExtensions?: string[] | undefined;
583
+ /**
584
+ * Optional Flatpak base application ID.
585
+ *
586
+ * @defaultValue None: the manifest has no `base`
587
+ */
588
+ base?: string | undefined;
589
+ /**
590
+ * Branch of the base application.
591
+ *
592
+ * @defaultValue None: the manifest has no `base-version`
593
+ */
594
+ baseVersion?: string | undefined;
595
+ /**
596
+ * Exported application branch.
597
+ *
598
+ * @defaultValue `"stable"`
599
+ */
600
+ branch?: string | undefined;
601
+ /**
602
+ * Sandbox permissions added to the defaults. A negation such as `--nosocket=fallback-x11` removes the
603
+ * matching default.
604
+ *
605
+ * @defaultValue `[]`, on top of `--share=ipc`, `--socket=wayland`, `--socket=fallback-x11` and
606
+ * `--device=dri`
607
+ * @example
608
+ * ```ts
609
+ * finishArgs: ["--share=network", "--filesystem=xdg-documents"],
610
+ * ```
611
+ */
612
+ finishArgs?: string[] | undefined;
613
+ /**
614
+ * Patterns added to the cleanup defaults. An empty array disables cleanup.
615
+ *
616
+ * @defaultValue `[]`, on top of `/include`, `/share/pkgconfig`, `*.la` and `*.a`
617
+ */
618
+ cleanup?: string[] | undefined;
619
+ /**
620
+ * Additional shell commands appended to the application's Flatpak build commands.
621
+ *
622
+ * @defaultValue `[]`
623
+ */
624
+ buildCommands?: string[] | undefined;
625
+ /**
626
+ * Additional Flatpak manifest modules built before the application module.
627
+ *
628
+ * @defaultValue `[]`
629
+ */
630
+ modules?: unknown[] | undefined;
631
+ /**
632
+ * Git repository and revision used for source builds.
633
+ *
634
+ * @defaultValue `{}`: the `origin` remote at the tagged or current commit
635
+ */
636
+ source?: DeployFlatpakSourceOptions | undefined;
637
+ /**
638
+ * Package manager used for offline source builds.
639
+ *
640
+ * @defaultValue Detected from the first lockfile found: `pnpm-lock.yaml`, `yarn.lock`, then
641
+ * `package-lock.json`
642
+ */
643
+ packageManager?: "npm" | "pnpm" | "yarn" | undefined;
644
+ /**
645
+ * Lockfile path relative to the project root.
646
+ *
647
+ * @defaultValue The package manager's standard lockfile, such as `pnpm-lock.yaml`
648
+ */
649
+ lockfile?: string | undefined;
650
+ /**
651
+ * Runtime repository URL embedded in the bundle.
652
+ *
653
+ * @defaultValue `"https://dl.flathub.org/repo/flathub.flatpakrepo"`
654
+ */
655
+ runtimeRepo?: string | undefined;
656
+ /**
657
+ * Emit a `.flatpak` bundle in addition to the local repository.
658
+ *
659
+ * @defaultValue `true`
660
+ */
661
+ shouldEmitBundle?: boolean | undefined;
662
+ /**
663
+ * Install the built application into the current user's Flatpak installation.
664
+ *
665
+ * @defaultValue `false`
666
+ */
667
+ shouldInstall?: boolean | undefined;
668
+ /**
669
+ * Allow flatpak-builder to use rofiles-fuse. Set to `false` where FUSE is unavailable.
670
+ *
671
+ * @defaultValue `true`
672
+ */
673
+ shouldUseRofilesFuse?: boolean | undefined;
674
+ };
275
675
 
276
676
  const flatpakSchema = z.strictObject({
277
- /** Package local build output or build from a pinned Git source inside the SDK. Defaults to `prebuilt`. */
278
677
  mode: z.enum(FLATPAK_MODES, { error: 'must be "prebuilt" or "source"' }).optional(),
279
- /** Flatpak runtime ID. Defaults to `org.gnome.Platform`. */
280
678
  runtime: text("must be a runtime id").optional(),
281
- /** Flatpak runtime branch. Defaults to `50`. */
282
- runtimeVersion: text('must be a runtime branch such as "50"').optional(),
283
- /** Build SDK ID. Defaults to `org.gnome.Sdk`. */
679
+ runtimeVersion: text('must be a runtime branch such as "51"').optional(),
284
680
  sdk: text("must be an SDK id").optional(),
285
- /** Node.js SDK extension used in source mode. Defaults to `org.freedesktop.Sdk.Extension.node26`. */
286
681
  nodeExtension: text("must be a Node SDK extension id").optional(),
287
- /** Additional SDK extension IDs included in the build environment. */
288
682
  sdkExtensions: textList("SDK extension id", "must be an array of SDK extension ids").optional(),
289
- /** Optional Flatpak base application ID. */
290
683
  base: text("must be a base app id").optional(),
291
- /** Branch of the base application. */
292
684
  baseVersion: text("must be a base app version").optional(),
293
- /** Exported application branch. Defaults to `stable`. */
294
685
  branch: text("must be a branch name").optional(),
295
- /** Sandbox permissions added to display, IPC, and GPU defaults. Negations remove matching defaults. */
296
686
  finishArgs: textList("finish argument", "must be an array of flatpak finish arguments").optional(),
297
- /** Patterns added to header, pkg-config, and static-library cleanup defaults. An empty array disables cleanup. */
298
687
  cleanup: textList("cleanup pattern", "must be an array of cleanup patterns").optional(),
299
- /** Additional shell commands appended to the application's Flatpak build commands. */
300
688
  buildCommands: textList("shell command", "must be an array of shell commands").optional(),
301
- /** Additional Flatpak manifest modules built before the application module. */
302
689
  modules: z.array(z.unknown(), { error: "must be an array of flatpak module objects" }).optional(),
303
- /** Git repository and revision used for source builds. */
304
690
  source: flatpakSourceSchema.optional(),
305
- /** Package manager used for offline source builds, detected from the project's lockfiles when omitted. */
306
691
  packageManager: z.enum(PACKAGE_MANAGERS, { error: "must be one of npm, pnpm, yarn" }).optional(),
307
- /** Lockfile path relative to the project root. Defaults to the selected package manager's standard lockfile. */
308
692
  lockfile: text("must be a path to a lockfile").optional(),
309
- /** Runtime repository URL embedded in the bundle. Defaults to Flathub's `.flatpakrepo` URL. */
310
693
  runtimeRepo: url("must be an absolute .flatpakrepo URL").optional(),
311
- /** Emit a `.flatpak` bundle in addition to the local repository. Defaults to `true`. */
312
694
  shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),
313
- /** Install the built application into the current user's Flatpak installation. Defaults to `false`. */
314
695
  shouldInstall: flag(BOOLEAN_ERROR).optional(),
315
- /** Allow flatpak-builder to use rofiles-fuse. Set to `false` where FUSE is unavailable. */
316
696
  shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),
317
- });
697
+ }) satisfies z.ZodType<DeployFlatpakOptions>;
318
698
 
319
- const debSigningSchema = z.strictObject({
699
+ /** The `deploy.signing.deb` options: the key and method that sign the Debian package. */
700
+ type DeployDebSigningOptions = {
320
701
  /** PGP private key file used to sign the Debian package. */
702
+ keyFile: string;
703
+ /**
704
+ * PGP signing key ID.
705
+ *
706
+ * @defaultValue nFPM's choice: the first subkey of `keyFile` that can sign
707
+ */
708
+ keyId?: string | undefined;
709
+ /**
710
+ * Debian package signing method.
711
+ *
712
+ * @defaultValue nFPM's default, `"debsign"`
713
+ */
714
+ method?: "debsign" | "dpkg-sig" | undefined;
715
+ /**
716
+ * Debian signature role.
717
+ *
718
+ * @defaultValue nFPM's default, `"origin"`
719
+ */
720
+ type?: "archive" | "maint" | "origin" | undefined;
721
+ /**
722
+ * Name and email address recorded as the signer.
723
+ *
724
+ * @defaultValue None: GTKX passes no `signer` to nFPM
725
+ */
726
+ signer?: string | undefined;
727
+ };
728
+
729
+ const debSigningSchema = z.strictObject({
321
730
  keyFile: text(KEY_FILE_ERROR),
322
- /** PGP signing key ID. */
323
731
  keyId: text(KEY_ID_ERROR).optional(),
324
- /** Debian package signing method. */
325
732
  method: z.enum(DEB_SIGN_METHODS, { error: 'must be "debsign" or "dpkg-sig"' }).optional(),
326
- /** Debian signature role. */
327
733
  type: z.enum(DEB_SIGN_TYPES, { error: "must be one of archive, maint, origin" }).optional(),
328
- /** Name and email address recorded as the signer. */
329
734
  signer: text("must be a signer name and email").optional(),
330
- });
735
+ }) satisfies z.ZodType<DeployDebSigningOptions>;
331
736
 
332
- const rpmSigningSchema = z.strictObject({
737
+ /** The `deploy.signing.rpm` options: the key that signs the RPM package. */
738
+ type DeployRpmSigningOptions = {
333
739
  /** PGP private key file used to sign the RPM package. */
740
+ keyFile: string;
741
+ /**
742
+ * PGP signing key ID.
743
+ *
744
+ * @defaultValue nFPM's choice: the first subkey of `keyFile` that can sign
745
+ */
746
+ keyId?: string | undefined;
747
+ };
748
+
749
+ const rpmSigningSchema = z.strictObject({
334
750
  keyFile: text(KEY_FILE_ERROR),
335
- /** PGP signing key ID. */
336
751
  keyId: text(KEY_ID_ERROR).optional(),
337
- });
752
+ }) satisfies z.ZodType<DeployRpmSigningOptions>;
753
+
754
+ /** The `deploy.signing.flatpak` options: the GPG key that signs the Flatpak repository commit. */
755
+ type DeployFlatpakSigningOptions = {
756
+ /**
757
+ * GPG key ID that signs the Flatpak repository commit. The bundle embeds its public key, so
758
+ * `flatpak install --bundle` verifies the signature.
759
+ */
760
+ gpgKeyId: string;
761
+ /**
762
+ * GPG home directory containing the signing key, passed to GPG as given.
763
+ *
764
+ * @defaultValue GPG's default, `$GNUPGHOME` or `~/.gnupg`
765
+ */
766
+ gpgHomeDir?: string | undefined;
767
+ };
338
768
 
339
769
  const flatpakSigningSchema = z.strictObject({
340
- /** GPG key ID used to sign the Flatpak bundle. */
341
770
  gpgKeyId: text("must be a GPG key id"),
342
- /** GPG home directory containing the signing key. */
343
771
  gpgHomeDir: text("must be a path to a GPG home directory").optional(),
344
- });
772
+ }) satisfies z.ZodType<DeployFlatpakSigningOptions>;
345
773
 
346
- const appimageSigningSchema = z.strictObject({
774
+ /** The `deploy.signing.appimage` options: the GPG key that signs the AppImage. */
775
+ type DeployAppImageSigningOptions = {
347
776
  /** GPG key ID used by appimagetool to sign the AppImage. */
777
+ gpgKeyId: string;
778
+ };
779
+
780
+ const appimageSigningSchema = z.strictObject({
348
781
  gpgKeyId: text("must be a GPG key id"),
349
- });
782
+ }) satisfies z.ZodType<DeployAppImageSigningOptions>;
783
+
784
+ /** The `deploy.signing` options: how each package format is signed. Formats without an entry stay unsigned. */
785
+ type DeploySigningOptions = {
786
+ /**
787
+ * AppImage signing options.
788
+ *
789
+ * @defaultValue None: `gtkx deploy` leaves this format unsigned
790
+ */
791
+ appimage?: DeployAppImageSigningOptions | undefined;
792
+ /**
793
+ * Debian package signing options.
794
+ *
795
+ * @defaultValue None: `gtkx deploy` leaves this format unsigned
796
+ */
797
+ deb?: DeployDebSigningOptions | undefined;
798
+ /**
799
+ * Flatpak bundle signing options.
800
+ *
801
+ * @defaultValue None: `gtkx deploy` leaves this format unsigned
802
+ */
803
+ flatpak?: DeployFlatpakSigningOptions | undefined;
804
+ /**
805
+ * RPM package signing options.
806
+ *
807
+ * @defaultValue None: `gtkx deploy` leaves this format unsigned
808
+ */
809
+ rpm?: DeployRpmSigningOptions | undefined;
810
+ };
350
811
 
351
812
  const signingSchema = z.strictObject({
352
- /** AppImage signing options. */
353
813
  appimage: appimageSigningSchema.optional(),
354
- /** Debian package signing options. */
355
814
  deb: debSigningSchema.optional(),
356
- /** Flatpak bundle signing options. */
357
815
  flatpak: flatpakSigningSchema.optional(),
358
- /** RPM package signing options. */
359
816
  rpm: rpmSigningSchema.optional(),
360
- });
817
+ }) satisfies z.ZodType<DeploySigningOptions>;
818
+
819
+ /** The `deploy.relations` options: package relationships besides dependencies, for Debian and RPM. */
820
+ type DeployRelationsOptions = {
821
+ /**
822
+ * Recommended packages that extend the application's functionality.
823
+ *
824
+ * @defaultValue `{}`
825
+ */
826
+ recommends?: DeployPackageRelationOptions | undefined;
827
+ /**
828
+ * Suggested companion packages.
829
+ *
830
+ * @defaultValue `{}`
831
+ */
832
+ suggests?: DeployPackageRelationOptions | undefined;
833
+ /**
834
+ * Package names or capabilities supplied by this package.
835
+ *
836
+ * @defaultValue `{}`
837
+ */
838
+ provides?: DeployPackageRelationOptions | undefined;
839
+ /**
840
+ * Packages that cannot be installed alongside this package.
841
+ *
842
+ * @defaultValue `{}`
843
+ */
844
+ conflicts?: DeployPackageRelationOptions | undefined;
845
+ /**
846
+ * Packages whose files this package may replace.
847
+ *
848
+ * @defaultValue `{}`
849
+ */
850
+ replaces?: DeployPackageRelationOptions | undefined;
851
+ /**
852
+ * Debian packages made incompatible by installing this package. Debian packages only.
853
+ *
854
+ * @defaultValue `{}`
855
+ */
856
+ breaks?: DeployDebPackageRelationOptions | undefined;
857
+ /**
858
+ * Debian dependencies required before unpacking this package. Debian packages only.
859
+ *
860
+ * @defaultValue `{}`
861
+ */
862
+ preDepends?: DeployDebPackageRelationOptions | undefined;
863
+ };
361
864
 
362
865
  const extraRelationsSchema = z.strictObject({
363
- /** Recommended packages that extend the application's functionality. */
364
866
  recommends: relationsSchema.optional(),
365
- /** Suggested companion packages. */
366
867
  suggests: relationsSchema.optional(),
367
- /** Package names or capabilities supplied by this package. */
368
868
  provides: relationsSchema.optional(),
369
- /** Packages that cannot be installed alongside this package. */
370
869
  conflicts: relationsSchema.optional(),
371
- /** Packages whose files this package may replace. */
372
870
  replaces: relationsSchema.optional(),
373
- /** Debian packages made incompatible by installing this package. Uses the `deb` entries. */
374
- breaks: relationsSchema.optional(),
375
- /** Debian dependencies required before unpacking this package. Uses the `deb` entries. */
376
- preDepends: relationsSchema.optional(),
377
- });
871
+ breaks: debRelationsSchema.optional(),
872
+ preDepends: debRelationsSchema.optional(),
873
+ }) satisfies z.ZodType<DeployRelationsOptions>;
874
+
875
+ /** The `deploy` options: application metadata, bundled runtime settings, and packaging options for `gtkx deploy`. */
876
+ type DeployOptions = {
877
+ /**
878
+ * Package formats to build. `gtkx deploy --target` overrides it.
879
+ *
880
+ * @defaultValue `["flatpak"]`
881
+ */
882
+ targets?: ("appimage" | "deb" | "flatpak" | "rpm")[] | undefined;
883
+ /**
884
+ * Target CPU architectures. `gtkx deploy --arch` overrides it.
885
+ *
886
+ * @defaultValue The host architecture, `arm64` or `x64`
887
+ */
888
+ architectures?: ("arm64" | "x64")[] | undefined;
889
+ /**
890
+ * Deployment directory relative to the project root, with packages in its `out` directory. `gtkx deploy
891
+ * --out` overrides it.
892
+ *
893
+ * @defaultValue `"build"`
894
+ */
895
+ outDir?: string | undefined;
896
+ /**
897
+ * Display name.
898
+ *
899
+ * @defaultValue The `package.json` name without its scope, title-cased with spaces for hyphens and
900
+ * underscores, such as `Tasks App` for `@example/tasks-app`; or the last segment of the application ID
901
+ */
902
+ name?: string | undefined;
903
+ /**
904
+ * Generic application description shown by desktop launchers, such as `Text Editor`.
905
+ *
906
+ * @defaultValue None: the desktop entry has no `GenericName` key
907
+ */
908
+ genericName?: string | undefined;
909
+ /**
910
+ * Launcher command name, also used as the package name. A configured value is normalized the same way as the
911
+ * default.
912
+ *
913
+ * @defaultValue The `package.json` name without its scope, lowercased with hyphens for other characters; or
914
+ * the last segment of the application ID
915
+ */
916
+ binaryName?: string | undefined;
917
+ /**
918
+ * Application version. Deployment fails when neither this nor the `package.json` version is set.
919
+ *
920
+ * @defaultValue The `version` in `package.json`
921
+ */
922
+ version?: string | undefined;
923
+ /**
924
+ * Debian packaging revision and RPM release.
925
+ *
926
+ * @defaultValue `"1"`
927
+ */
928
+ release?: string | undefined;
929
+ /**
930
+ * Non-negative Debian and RPM version epoch.
931
+ *
932
+ * @defaultValue None: package metadata has no `epoch`
933
+ */
934
+ epoch?: number | undefined;
935
+ /**
936
+ * Single-line summary without a trailing period. Deployment fails when neither this nor the `package.json`
937
+ * description is set.
938
+ *
939
+ * @defaultValue The first line of the `description` in `package.json`
940
+ */
941
+ summary?: string | undefined;
942
+ /**
943
+ * Long description as paragraphs.
944
+ *
945
+ * @defaultValue `deploy.summary` as the only paragraph, also when the array is empty
946
+ */
947
+ description?: string[] | undefined;
948
+ /**
949
+ * Search keywords included in the desktop entry and AppStream metadata.
950
+ *
951
+ * @defaultValue `[]`
952
+ */
953
+ keywords?: string[] | undefined;
954
+ /**
955
+ * Freedesktop application categories used by launchers, software centers, and package metadata.
956
+ *
957
+ * @defaultValue `[]`
958
+ * @example
959
+ * ```ts
960
+ * categories: ["Office", "ProjectManagement"],
961
+ * ```
962
+ */
963
+ categories?: string[] | undefined;
964
+ /**
965
+ * Supported MIME types, combined with types from file associations and URL protocols.
966
+ *
967
+ * @defaultValue `[]`
968
+ */
969
+ mimeTypes?: string[] | undefined;
970
+ /**
971
+ * Developer identity and package maintainer details.
972
+ *
973
+ * @defaultValue `{}`: the details come from the `author` in `package.json`
974
+ */
975
+ developer?: DeployDeveloperOptions | undefined;
976
+ /**
977
+ * Application license as an SPDX expression. Deployment fails when neither this nor the `package.json`
978
+ * license is set.
979
+ *
980
+ * @defaultValue The `license` in `package.json`
981
+ */
982
+ license?: string | undefined;
983
+ /**
984
+ * License file path relative to the project root, installed with the application.
985
+ *
986
+ * @defaultValue The first of `LICENSE`, `LICENSE.md`, `LICENSE.txt`, `COPYING` and `COPYING.md` in the
987
+ * project root; none when no such file exists
988
+ */
989
+ licenseFile?: string | undefined;
990
+ /**
991
+ * SPDX license expression for the AppStream metadata.
992
+ *
993
+ * @defaultValue `"CC0-1.0"`
994
+ */
995
+ metadataLicense?: string | undefined;
996
+ /**
997
+ * Copyright notice.
998
+ *
999
+ * @defaultValue `Copyright © <year> <developer name>`, with the year of the build date
1000
+ */
1001
+ copyright?: string | undefined;
1002
+ /**
1003
+ * Application homepage URL.
1004
+ *
1005
+ * @defaultValue The `homepage` in `package.json`, if set
1006
+ */
1007
+ homepage?: string | undefined;
1008
+ /**
1009
+ * Additional AppStream links keyed by their purpose, such as `bugtracker` or `help`.
1010
+ *
1011
+ * @defaultValue `{}`
1012
+ * @example
1013
+ * ```ts
1014
+ * urls: { bugtracker: "https://github.com/example/tasks/issues" },
1015
+ * ```
1016
+ */
1017
+ urls?:
1018
+ | Partial<
1019
+ Record<
1020
+ "bugtracker" | "contact" | "contribute" | "donation" | "faq" | "help" | "translate" | "vcs-browser",
1021
+ string
1022
+ >
1023
+ >
1024
+ | undefined;
1025
+ /**
1026
+ * Screenshots for software centers. Each entry requires a `url` or `file`.
1027
+ *
1028
+ * @defaultValue `[]`
1029
+ */
1030
+ screenshots?: DeployScreenshotOptions[] | undefined;
1031
+ /**
1032
+ * Base URL for screenshot files.
1033
+ *
1034
+ * @defaultValue The raw file URL of the project's GitHub or GitLab `origin` remote on its default branch;
1035
+ * deployment fails without one when a screenshot sets `file`
1036
+ */
1037
+ screenshotBaseUrl?: string | undefined;
1038
+ /**
1039
+ * Primary branding colors included in AppStream metadata.
1040
+ *
1041
+ * @defaultValue None: the metadata has no `branding` element
1042
+ */
1043
+ branding?: DeployBrandingOptions | undefined;
1044
+ /**
1045
+ * OARS 1.1 content-rating attributes mapped to their intensities.
1046
+ *
1047
+ * @defaultValue `{}`: an empty OARS 1.1 rating, which declares no objectionable content
1048
+ * @example
1049
+ * ```ts
1050
+ * contentRating: { "social-chat": "intense" },
1051
+ * ```
1052
+ */
1053
+ contentRating?: Record<string, "intense" | "mild" | "moderate" | "none"> | undefined;
1054
+ /**
1055
+ * AppStream release history, sorted newest first.
1056
+ *
1057
+ * @defaultValue One release for the application version, dated on the build day or by `SOURCE_DATE_EPOCH`
1058
+ */
1059
+ releases?: DeployReleaseOptions[] | undefined;
1060
+ /**
1061
+ * Application arguments included in the desktop entry's launch command.
1062
+ *
1063
+ * @defaultValue `[]`
1064
+ */
1065
+ execArgs?: string[] | undefined;
1066
+ /**
1067
+ * Environment variables exported by the generated launcher. Keys must be POSIX environment names.
1068
+ *
1069
+ * @defaultValue `{}`
1070
+ * @example
1071
+ * ```ts
1072
+ * launcherEnv: { GSK_RENDERER: "ngl" },
1073
+ * ```
1074
+ */
1075
+ launcherEnv?: Record<string, string> | undefined;
1076
+ /**
1077
+ * Node.js flags placed before the application bundle in the generated launcher.
1078
+ *
1079
+ * @defaultValue `[]`
1080
+ * @example
1081
+ * ```ts
1082
+ * nodeFlags: ["--max-old-space-size=4096"],
1083
+ * ```
1084
+ */
1085
+ nodeFlags?: string[] | undefined;
1086
+ /**
1087
+ * File extensions and MIME types registered for the application.
1088
+ *
1089
+ * @defaultValue `[]`
1090
+ */
1091
+ fileAssociations?: DeployFileAssociationOptions[] | undefined;
1092
+ /**
1093
+ * URL schemes handled by the application, registered as `x-scheme-handler` MIME types.
1094
+ *
1095
+ * @defaultValue `[]`
1096
+ */
1097
+ protocols?: string[] | undefined;
1098
+ /**
1099
+ * Desktop launcher actions keyed by action ID. With `isDbusActivatable`, the application must register an
1100
+ * `app.<id>` action for each one.
1101
+ *
1102
+ * @defaultValue `{}`
1103
+ * @example
1104
+ * ```ts
1105
+ * desktopActions: { today: { name: "Today", args: ["tasks://today"] } },
1106
+ * ```
1107
+ */
1108
+ desktopActions?: Record<string, DeployDesktopActionOptions> | undefined;
1109
+ /**
1110
+ * Additional desktop entry keys, overriding non-reserved generated values. `DBusActivatable` and `Version`
1111
+ * are rejected; use `deploy.isDbusActivatable` for D-Bus activation.
1112
+ *
1113
+ * @defaultValue `{}`
1114
+ */
1115
+ desktopEntry?: Record<string, string> | undefined;
1116
+ /**
1117
+ * Additional XML fragments appended to the AppStream component.
1118
+ *
1119
+ * @defaultValue `[]`
1120
+ */
1121
+ metainfoExtra?: string[] | undefined;
1122
+ /**
1123
+ * Enable D-Bus activation in the desktop entry and generate a session bus service file.
1124
+ *
1125
+ * @defaultValue `false`
1126
+ */
1127
+ isDbusActivatable?: boolean | undefined;
1128
+ /**
1129
+ * Extra files keyed by destination inside the install prefix, without a leading slash or a `..` segment.
1130
+ * Each value is a source path relative to the project root, or a {@link DeployExtraFileOptions} entry that
1131
+ * also sets the file mode. A directory source installs every file below it at the same path below the
1132
+ * destination; without a mode, each file is executable when its source is. Scripts installed this way, such
1133
+ * as a helper command's launcher, can run the bundled Node.js runtime at `lib/<binaryName>/node` in every
1134
+ * prebuilt target and in source Flatpaks.
1135
+ *
1136
+ * @defaultValue `{}`
1137
+ * @example
1138
+ * ```ts
1139
+ * extraFiles: { "share/tasks/templates": "data/templates" },
1140
+ * ```
1141
+ */
1142
+ extraFiles?: Record<string, string | DeployExtraFileOptions> | undefined;
1143
+ /**
1144
+ * Minimum runtime library versions keyed by GIR library ID, used when deriving package dependencies.
1145
+ *
1146
+ * @defaultValue `{}`: library dependencies carry no version constraint
1147
+ * @example
1148
+ * ```ts
1149
+ * minimumLibraryVersions: { "Adw-1": "1.8", "Gtk-4.0": "4.20" },
1150
+ * ```
1151
+ */
1152
+ minimumLibraryVersions?: Record<string, string> | undefined;
1153
+ /**
1154
+ * Additional Debian and RPM dependencies merged with automatically detected dependencies.
1155
+ *
1156
+ * @defaultValue None: only the detected dependencies, such as `libgtk-4-1` on Debian
1157
+ */
1158
+ depends?: DeployPackageRelationOptions | undefined;
1159
+ /**
1160
+ * Additional package relationships for Debian and RPM.
1161
+ *
1162
+ * @defaultValue `{}`: no relations besides `depends`
1163
+ */
1164
+ relations?: DeployRelationsOptions | undefined;
1165
+ /**
1166
+ * Installation and removal scripts for Debian and RPM packages.
1167
+ *
1168
+ * @defaultValue `{}`: no maintainer scripts
1169
+ */
1170
+ scripts?: DeployScriptsOptions | undefined;
1171
+ /**
1172
+ * Node.js runtime bundled with prebuilt packages and launcher compile-cache settings.
1173
+ *
1174
+ * @defaultValue `{}`: a downloaded Node.js `26.8.2`, stripped, with the compile cache on
1175
+ */
1176
+ node?: DeployNodeOptions | undefined;
1177
+ /**
1178
+ * Overrides for executables used to build packages.
1179
+ *
1180
+ * @defaultValue `{}`: `gtkx deploy` downloads the pinned tools it needs
1181
+ */
1182
+ tools?: DeployToolsOptions | undefined;
1183
+ /**
1184
+ * Per-format package signing options.
1185
+ *
1186
+ * @defaultValue `{}`: every package is unsigned
1187
+ */
1188
+ signing?: DeploySigningOptions | undefined;
1189
+ /**
1190
+ * AppImage packaging options.
1191
+ *
1192
+ * @defaultValue `{}`
1193
+ */
1194
+ appimage?: DeployAppImageOptions | undefined;
1195
+ /**
1196
+ * Debian package metadata and compression options.
1197
+ *
1198
+ * @defaultValue `{}`
1199
+ */
1200
+ deb?: DeployDebOptions | undefined;
1201
+ /**
1202
+ * Flatpak runtime, sandbox, build, and distribution options.
1203
+ *
1204
+ * @defaultValue `{}`
1205
+ */
1206
+ flatpak?: DeployFlatpakOptions | undefined;
1207
+ /**
1208
+ * RPM package metadata and compression options.
1209
+ *
1210
+ * @defaultValue `{}`
1211
+ */
1212
+ rpm?: DeployRpmOptions | undefined;
1213
+ };
378
1214
 
379
1215
  const deploySchema = z.strictObject({
380
- /** Package formats to build. Defaults to `["flatpak"]`; overridden by `gtkx deploy --target`. */
381
1216
  targets: z
382
1217
  .array(z.enum(DEPLOY_TARGET_NAMES, { error: "must be one of appimage, deb, flatpak, rpm" }), {
383
1218
  error: "must be an array of deploy targets",
384
1219
  })
385
1220
  .optional(),
386
- /** Target CPU architectures. Defaults to the host architecture; overridden by `gtkx deploy --arch`. */
387
1221
  architectures: z
388
1222
  .array(z.enum(DEPLOY_ARCH_NAMES, { error: "must be one of arm64, x64" }), {
389
1223
  error: "must be an array of deploy architectures",
390
1224
  })
391
1225
  .optional(),
392
- /** Deployment directory relative to the project root. Defaults to `build`, with packages in its `out` directory. */
393
1226
  outDir: text("must be a directory path relative to the project root").optional(),
394
- /** Display name, derived from package.json's name or the application ID when omitted. */
395
1227
  name: text("must be the display name shown in the launcher").optional(),
396
- /** Generic application description shown by desktop launchers, such as `Text Editor`. */
397
1228
  genericName: text("must be a generic application name").optional(),
398
- /** Launcher command name, derived from package.json's name or the application ID when omitted. */
399
1229
  binaryName: text("must be a kebab-case command name").optional(),
400
- /** Application version. Defaults to the version in package.json. */
401
1230
  version: text(VERSION_ERROR).optional(),
402
- /** Debian packaging revision and RPM release. Defaults to `1`. */
403
1231
  release: text("must be a packaging revision").optional(),
404
- /** Non-negative Debian and RPM version epoch, omitted from package metadata unless configured. */
405
1232
  epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),
406
- /** Single-line summary without a trailing period. Defaults to the first line of package.json's description. */
407
1233
  summary: text("must be a single-line summary without a trailing period").optional(),
408
- /** Long description as paragraphs. Defaults to the summary when omitted or empty. */
409
1234
  description: textList("description paragraph", "must be an array of description paragraphs").optional(),
410
- /** Search keywords included in the desktop entry and AppStream metadata. */
411
1235
  keywords: textList("search keyword", "must be an array of search keywords").optional(),
412
- /** Freedesktop application categories used by launchers, software centers, and package metadata. */
413
1236
  categories: textList("freedesktop category", "must be an array of freedesktop categories").optional(),
414
- /** Supported MIME types, combined with types from file associations and URL protocols. */
415
1237
  mimeTypes: textList("MIME type", "must be an array of MIME types").optional(),
416
- /** Developer identity and package maintainer details. */
417
1238
  developer: developerSchema.optional(),
418
- /** Application license as an SPDX expression. Defaults to the license in package.json. */
419
1239
  license: text(SPDX_ERROR).optional(),
420
- /** License file path relative to the project root, detected from common LICENSE or COPYING names when omitted. */
421
1240
  licenseFile: text("must be a path to a license file").optional(),
422
- /** SPDX license expression for the AppStream metadata. Defaults to `CC0-1.0`. */
423
1241
  metadataLicense: text(SPDX_ERROR).optional(),
424
- /** Copyright notice. Defaults to the build year and developer name. */
425
1242
  copyright: text("must be a copyright line").optional(),
426
- /** Application homepage URL. Defaults to the homepage in package.json. */
427
1243
  homepage: url(URL_ERROR).optional(),
428
- /** Additional AppStream links keyed by their purpose, such as `bugtracker` or `help`. */
429
1244
  urls: z
430
1245
  .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {
431
1246
  error: "must be a record of AppStream url kinds to URLs",
432
1247
  })
433
1248
  .optional(),
434
- /**
435
- * Screenshots for software centers. Each entry requires a `url` or `file`.
436
- * @see {@link DeployScreenshotOptions} for the fields accepted by each entry.
437
- */
438
1249
  screenshots: z.array(screenshotSchema, { error: "must be an array of screenshots" }).optional(),
439
- /** Base URL for screenshot files, inferred from a GitHub or GitLab remote when omitted. */
440
1250
  screenshotBaseUrl: url("must be an absolute base URL").optional(),
441
- /** Primary branding colors included in AppStream metadata. */
442
1251
  branding: brandingSchema.optional(),
443
- /** OARS 1.1 content-rating attributes mapped to their intensities. */
444
1252
  contentRating: z
445
1253
  .record(z.string(), z.enum(OARS_INTENSITIES, { error: "must be one of intense, mild, moderate, none" }), {
446
1254
  error: "must be a record of OARS 1.1 attribute ids to intensities",
447
1255
  })
448
1256
  .optional(),
449
- /**
450
- * AppStream release history, sorted newest first. Defaults to the application version and build date.
451
- * @see {@link DeployReleaseOptions} for the fields accepted by each entry.
452
- */
453
1257
  releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
454
- /** Application arguments included in the desktop entry's launch command. */
455
1258
  execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
456
- /** Environment variables exported by the generated launcher. Keys must be POSIX environment names. */
457
1259
  launcherEnv: launcherEnvSchema.optional(),
458
- /** Node.js flags placed before the application bundle in the generated launcher. */
459
1260
  nodeFlags: nodeFlagsSchema.optional(),
460
- /**
461
- * File extensions and MIME types registered for the application.
462
- * @see {@link DeployFileAssociationOptions} for the fields accepted by each entry.
463
- */
464
1261
  fileAssociations: z.array(fileAssociationSchema, { error: "must be an array of file associations" }).optional(),
465
- /** URL schemes handled by the application, registered as `x-scheme-handler` MIME types. */
466
1262
  protocols: textList("URL scheme", "must be an array of URL schemes").optional(),
467
- /**
468
- * Desktop launcher actions keyed by action ID.
469
- * @see {@link DeployDesktopActionOptions} for the fields accepted by each entry.
470
- */
471
1263
  desktopActions: z
472
1264
  .record(z.string(), desktopActionSchema, { error: "must be a record of action ids to actions" })
473
1265
  .optional(),
474
- /**
475
- * Additional desktop entry keys, overriding non-reserved generated values.
476
- * `DBusActivatable` and `Version` are rejected; use `deploy.isDbusActivatable` for D-Bus activation.
477
- */
478
1266
  desktopEntry: textRecord(
479
1267
  "must be a desktop entry value",
480
1268
  "must be a record of desktop entry keys to values",
481
1269
  ).optional(),
482
- /** Additional XML fragments appended to the AppStream component. */
483
1270
  metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
484
- /** Enable D-Bus activation in the desktop entry and generate a session bus service file. Defaults to `false`. */
485
1271
  isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
486
- /** Extra files keyed by destination inside the install prefix, with source paths relative to the project root. */
487
1272
  extraFiles: relativePathRecord(
488
1273
  "must be a destination path inside the install prefix, without a leading slash or a .. segment",
489
1274
  extraFileEntrySchema,
490
1275
  "must be a record of prefix-relative destinations to source paths or { source, mode } entries",
491
1276
  ).optional(),
492
- /** Minimum runtime library versions keyed by GIR library ID, used when deriving package dependencies. */
493
1277
  minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),
494
- /** Additional Debian and RPM dependencies merged with automatically detected dependencies. */
495
1278
  depends: relationsSchema.optional(),
496
- /** Additional package relationships for Debian and RPM. */
497
1279
  relations: extraRelationsSchema.optional(),
498
- /** Installation and removal scripts for Debian and RPM packages. */
499
1280
  scripts: scriptsSchema.optional(),
500
- /** Node.js runtime bundled with prebuilt packages and launcher compile-cache settings. */
501
1281
  node: nodeRuntimeSchema.optional(),
502
- /** Overrides for executables used to build packages. */
503
1282
  tools: toolsSchema.optional(),
504
- /** Per-format package signing options. */
505
1283
  signing: signingSchema.optional(),
506
- /** AppImage packaging options. */
507
1284
  appimage: appimageSchema.optional(),
508
- /** Debian package metadata and compression options. */
509
1285
  deb: debSchema.optional(),
510
- /** Flatpak runtime, sandbox, build, and distribution options. */
511
1286
  flatpak: flatpakSchema.optional(),
512
- /** RPM package metadata and compression options. */
513
1287
  rpm: rpmSchema.optional(),
514
- });
1288
+ }) satisfies z.ZodType<DeployOptions>;
515
1289
 
516
1290
  export {
517
1291
  deploySchema,
1292
+ type DeployAppImageOptions,
1293
+ type DeployAppImageSigningOptions,
1294
+ type DeployBrandingOptions,
1295
+ type DeployDebOptions,
1296
+ type DeployDebPackageRelationOptions,
1297
+ type DeployDebSigningOptions,
518
1298
  type DeployDesktopActionOptions,
1299
+ type DeployDeveloperOptions,
519
1300
  type DeployExtraFileOptions,
520
1301
  type DeployFileAssociationOptions,
1302
+ type DeployFlatpakOptions,
1303
+ type DeployFlatpakSigningOptions,
1304
+ type DeployFlatpakSourceOptions,
521
1305
  type DeployNodeOptions,
1306
+ type DeployOptions,
1307
+ type DeployPackageRelationOptions,
1308
+ type DeployRelationsOptions,
522
1309
  type DeployReleaseOptions,
1310
+ type DeployRpmOptions,
1311
+ type DeployRpmSigningOptions,
523
1312
  type DeployScreenshotOptions,
1313
+ type DeployScriptsOptions,
1314
+ type DeploySigningOptions,
1315
+ type DeployToolsOptions,
524
1316
  };