@gjsify/cli 0.44.0 → 0.46.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.
Files changed (81) hide show
  1. package/dist/cli.gjs.mjs +202 -167
  2. package/lib/commands/gettext.d.ts +2 -1
  3. package/lib/commands/gettext.js +105 -47
  4. package/lib/commands/onboard.d.ts +7 -0
  5. package/lib/commands/onboard.js +349 -96
  6. package/lib/commands/ship.d.ts +3 -0
  7. package/lib/commands/ship.js +850 -58
  8. package/lib/commands/trust.d.ts +6 -0
  9. package/lib/commands/trust.js +1 -1
  10. package/lib/commands/upgrade.d.ts +23 -0
  11. package/lib/commands/upgrade.js +95 -12
  12. package/lib/templates/install.mjs.tmpl +2 -2
  13. package/lib/types/config-data.d.ts +127 -1
  14. package/lib/utils/gi-search-path.js +11 -3
  15. package/lib/utils/msgfmt-merge.d.ts +35 -0
  16. package/lib/utils/msgfmt-merge.js +102 -0
  17. package/lib/utils/npm-otp.d.ts +27 -2
  18. package/lib/utils/npm-otp.js +82 -7
  19. package/lib/utils/onboard-discovery.d.ts +68 -0
  20. package/lib/utils/onboard-discovery.js +178 -0
  21. package/lib/utils/onboard-probe.d.ts +118 -1
  22. package/lib/utils/onboard-probe.js +153 -4
  23. package/lib/utils/prompt-output.d.ts +12 -0
  24. package/lib/utils/prompt-output.js +54 -0
  25. package/lib/utils/prompt.js +22 -2
  26. package/lib/utils/publishable-packages.d.ts +1 -1
  27. package/lib/utils/publishable-packages.js +1 -0
  28. package/lib/utils/resolve-npm-package.d.ts +56 -0
  29. package/lib/utils/resolve-npm-package.js +69 -0
  30. package/lib/utils/ship/app-runtime.d.ts +214 -0
  31. package/lib/utils/ship/app-runtime.js +429 -0
  32. package/lib/utils/ship/depends.d.ts +50 -0
  33. package/lib/utils/ship/depends.js +117 -3
  34. package/lib/utils/ship/discover.js +103 -1
  35. package/lib/utils/ship/dmg.d.ts +71 -0
  36. package/lib/utils/ship/dmg.js +181 -0
  37. package/lib/utils/ship/flatpak.js +1 -1
  38. package/lib/utils/ship/formats.d.ts +108 -7
  39. package/lib/utils/ship/formats.js +778 -15
  40. package/lib/utils/ship/launcher.d.ts +13 -3
  41. package/lib/utils/ship/launcher.js +419 -17
  42. package/lib/utils/ship/layout.d.ts +330 -0
  43. package/lib/utils/ship/layout.js +504 -0
  44. package/lib/utils/ship/localize-metadata.d.ts +22 -0
  45. package/lib/utils/ship/localize-metadata.js +126 -0
  46. package/lib/utils/ship/mime.js +1 -9
  47. package/lib/utils/ship/msi.d.ts +126 -0
  48. package/lib/utils/ship/msi.js +434 -0
  49. package/lib/utils/ship/node-runtime.d.ts +71 -0
  50. package/lib/utils/ship/node-runtime.js +122 -0
  51. package/lib/utils/ship/payload.d.ts +156 -5
  52. package/lib/utils/ship/payload.js +599 -14
  53. package/lib/utils/ship/pe-launcher.d.ts +29 -0
  54. package/lib/utils/ship/pe-launcher.js +663 -0
  55. package/lib/utils/ship/plan.d.ts +21 -0
  56. package/lib/utils/ship/plan.js +55 -7
  57. package/lib/utils/ship/plist.d.ts +98 -0
  58. package/lib/utils/ship/plist.js +256 -0
  59. package/lib/utils/ship/rpm.js +16 -3
  60. package/lib/utils/ship/schemas.d.ts +61 -0
  61. package/lib/utils/ship/schemas.js +118 -0
  62. package/lib/utils/ship/scripts.js +7 -3
  63. package/lib/utils/ship/settings.d.ts +91 -2
  64. package/lib/utils/ship/settings.js +93 -1
  65. package/lib/utils/ship/share-dirs.d.ts +53 -0
  66. package/lib/utils/ship/share-dirs.js +76 -0
  67. package/lib/utils/ship/signing.d.ts +311 -0
  68. package/lib/utils/ship/signing.js +506 -0
  69. package/lib/utils/ship/stage-manifest.d.ts +40 -12
  70. package/lib/utils/ship/stage-manifest.js +99 -13
  71. package/lib/utils/ship/stage-writer.d.ts +48 -0
  72. package/lib/utils/ship/stage-writer.js +91 -2
  73. package/lib/utils/ship/types.d.ts +191 -14
  74. package/lib/utils/ship/xml.d.ts +7 -0
  75. package/lib/utils/ship/xml.js +25 -0
  76. package/lib/utils/ship/zip.d.ts +69 -0
  77. package/lib/utils/ship/zip.js +245 -0
  78. package/lib/utils/system-gi.d.ts +20 -5
  79. package/lib/utils/system-gi.js +36 -13
  80. package/lib/utils/trust-registry.js +5 -0
  81. package/package.json +19 -19
@@ -1,9 +1,40 @@
1
- import type { FormatDescriptor, FormatId } from './types.js';
1
+ import { type Layout } from './layout.js';
2
+ import type { FormatDescriptor, FormatId, HostOs, PackSettings, RequiredTools } from './types.js';
3
+ /**
4
+ * The directory `windows-dir` produces, and the top level `windows-dir-zip` puts
5
+ * its entries under.
6
+ *
7
+ * ONE function with TWO readers, deliberately: the zip has to expand to the same
8
+ * directory the other row writes, and two literals would be two names a user is
9
+ * asked to believe are one.
10
+ */
11
+ export declare function windowsProgramDirName(settings: PackSettings): string;
12
+ /**
13
+ * The tools ONE host needs for a format, whichever shape the row declares.
14
+ *
15
+ * The one place the union in {@link RequiredTools} is opened, so a caller cannot
16
+ * read the map and get `undefined.filter` or read the array on a row that has a
17
+ * map. An OS the map does not name answers `[]` — not because nothing is needed
18
+ * there, but because {@link assertHostCanFinish} has already refused that host by
19
+ * the time this is asked, and inventing a tool list for a host that cannot finish
20
+ * the format would answer a question nobody may ask.
21
+ */
22
+ export declare function requiredToolsOn(tools: RequiredTools, host: string): readonly string[];
23
+ /**
24
+ * Every tool any host could need for a format — the question `installHint`'s
25
+ * presence is gated on.
26
+ *
27
+ * Deliberately NOT what {@link assertToolsInstalled} checks. "Does this row need a
28
+ * hint at all" is a property of the ROW; "is this tool here" is a question about
29
+ * one machine, and answering the first with the second would let a row declare a
30
+ * Windows-only tool and no hint, because the gate happened to run on Linux.
31
+ */
32
+ export declare function allRequiredTools(tools: RequiredTools): readonly string[];
2
33
  export declare const FORMATS: Record<FormatId, FormatDescriptor>;
3
34
  export declare const FORMAT_IDS: FormatId[];
4
35
  /**
5
- * What `gjsify ship` builds when nothing said otherwise — every format that
6
- * needs no tool and no particular host.
36
+ * What `gjsify ship <os>` builds when nothing said otherwise — every format that
37
+ * wraps THAT OS's layout and needs no tool and no particular host.
7
38
  *
8
39
  * A SECOND derivation from the same table, and it has to be one: `FORMAT_IDS`
9
40
  * used to be both "every format that exists" and "every format to build by
@@ -14,8 +45,22 @@ export declare const FORMAT_IDS: FormatId[];
14
45
  * packs `@gjsify/cli` itself on a bare ubuntu runner. A host-bound format is
15
46
  * opt-in through `--target` or `gjsify.ship.targets`; `--help` still lists all
16
47
  * of them.
48
+ *
49
+ * `layoutOs` is the SECOND criterion, and it is what the layout axis needed: a
50
+ * `.app` and its zip and a Windows program directory are all `finishOn: 'any'`,
51
+ * so on the one criterion a bare `gjsify ship` on Linux would start emitting
52
+ * five artifacts (ADR 0024 issue #1354, open question 3). Answered with § A2's
53
+ * positional rather than instead of it — the positional picks the layout, this
54
+ * picks the formats that wrap it, and `gjsify ship` on Linux keeps emitting
55
+ * exactly `deb` and `rpm`.
56
+ *
57
+ * An EMPTY answer is legal and is what darwin and windows give today: their
58
+ * layouts assemble (`--stage`) and no format wraps them yet. `assemble` refuses
59
+ * a pack with nothing to pack rather than exiting 0 having produced no artifact.
17
60
  */
18
- export declare const DEFAULT_FORMAT_IDS: FormatId[];
61
+ export declare function defaultFormatIds(layoutOs: HostOs): FormatId[];
62
+ /** Every format that wraps one OS's layout, tool-bound ones included. */
63
+ export declare function formatIdsFor(layoutOs: HostOs): FormatId[];
19
64
  /**
20
65
  * Refuse a format this host cannot finish, BEFORE anything is built or written.
21
66
  *
@@ -35,6 +80,62 @@ export declare function assertHostCanFinish(format: FormatDescriptor, host?: str
35
80
  * a build: `gjsify ship` runs the project's `build` script first, and finding
36
81
  * out afterwards that `flatpak-builder` is absent costs the whole build.
37
82
  */
38
- export declare function assertToolsInstalled(format: FormatDescriptor, present?: (cmd: string) => boolean): void;
39
- /** Parse `--target deb,rpm` into a sorted, deduplicated descriptor list. */
40
- export declare function resolveFormats(raw: readonly string[]): FormatDescriptor[];
83
+ export declare function assertToolsInstalled(format: FormatDescriptor, present?: (cmd: string) => boolean, host?: string): void;
84
+ /**
85
+ * Parse an explicit `--target deb,rpm` into a sorted, deduplicated descriptor list.
86
+ *
87
+ * A format belonging to another layout is an ERROR here, not a filter:
88
+ * `gjsify ship darwin --target deb` is a mistake worth naming, and dropping it
89
+ * silently would stage the darwin layout, pack nothing and exit 0 — the shape
90
+ * the empty-list refusal above already exists to prevent, arriving through a
91
+ * different door.
92
+ *
93
+ * The FLAG is what makes that the right answer, and it is the whole difference
94
+ * from {@link configuredFormats}: a value typed on this command line is a claim
95
+ * about THIS run.
96
+ */
97
+ export declare function resolveFormats(raw: readonly string[], layout: Layout): FormatDescriptor[];
98
+ /**
99
+ * The same names from `gjsify.ship.targets`, FILTERED to the current layout.
100
+ *
101
+ * A configured list is a project-level DEFAULT — "when I ship this, build these"
102
+ * — written once and read by every run, so it cannot be a claim about a layout
103
+ * the author had not heard of when they wrote it. Refusing it the way
104
+ * {@link resolveFormats} refuses a flag makes the new positional unusable in
105
+ * every project that has the key, and this repository is the proof: with
106
+ * `targets: ["deb", "rpm"]` in `packages/infra/cli/package.json`,
107
+ * `gjsify ship darwin --stage` exited 1 telling the author to run
108
+ * `gjsify ship darwin --stage`. There was no `--target` value that got a darwin
109
+ * stage out of such a project at all.
110
+ *
111
+ * Filtering is safe HERE and only here, because an empty result is not a silent
112
+ * success: `assemble` refuses a PACK with nothing to pack, and a `--stage` run
113
+ * legitimately wants exactly this — assemble the layout, wrap nothing.
114
+ */
115
+ export declare function configuredFormats(raw: readonly string[], layout: Layout): {
116
+ formats: FormatDescriptor[];
117
+ dropped: FormatId[];
118
+ };
119
+ /**
120
+ * Can this format's container hold a notarisation ticket?
121
+ *
122
+ * A SWITCH WITH A `never` GUARD and not a field, deliberately — the difference
123
+ * from `FormatDescriptor.host` is who owns the fact. Where a format can be PACKED
124
+ * is a property of this project's toolchain and belongs on the descriptor; whether
125
+ * `stapler` will write a ticket into it is Apple's list, unchanged by anything
126
+ * here, and six of the nine rows are only "no" because notarisation is a macOS
127
+ * concept they have nothing to do with. Putting it in a `switch` keeps the answer
128
+ * beside its citation and still makes a tenth format a compile error.
129
+ *
130
+ * `stapler(1)`: *"stapler works only with UDIF disk images, signed \"flat\"
131
+ * installer packages, and certain code-signed executable bundles such as
132
+ * \".app\"."* And Apple's notarisation guide for the exception that decides the
133
+ * zip: *"While you can notarize a ZIP archive, you can't staple to it directly.
134
+ * Instead, run stapler against each item that you added to the archive. Then
135
+ * create a new ZIP file containing the stapled items for distribution."*
136
+ *
137
+ * `macos-app` is `true` here even though `notarytool` cannot SUBMIT a directory:
138
+ * the two questions are separate, and a `.app` is precisely the item Apple's
139
+ * remedy above tells you to staple after submitting the archive around it.
140
+ */
141
+ export declare function canCarryTicket(id: FormatId): boolean;