@gtkx/cli 1.1.0 → 1.2.1

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 (153) hide show
  1. package/dist/builder.d.ts.map +1 -1
  2. package/dist/builder.js +2 -0
  3. package/dist/builder.js.map +1 -1
  4. package/dist/codegen/report.d.ts.map +1 -1
  5. package/dist/codegen/report.js +3 -0
  6. package/dist/codegen/report.js.map +1 -1
  7. package/dist/codegen/run-codegen.d.ts +1 -0
  8. package/dist/codegen/run-codegen.d.ts.map +1 -1
  9. package/dist/codegen/run-codegen.js +7 -1
  10. package/dist/codegen/run-codegen.js.map +1 -1
  11. package/dist/commands/docs.d.ts.map +1 -1
  12. package/dist/commands/docs.js +1 -0
  13. package/dist/commands/docs.js.map +1 -1
  14. package/dist/deploy/freedesktop/copyright.d.ts +2 -2
  15. package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
  16. package/dist/deploy/freedesktop/copyright.js +105 -14
  17. package/dist/deploy/freedesktop/copyright.js.map +1 -1
  18. package/dist/deploy/install-hints.d.ts.map +1 -1
  19. package/dist/deploy/install-hints.js +7 -4
  20. package/dist/deploy/install-hints.js.map +1 -1
  21. package/dist/deploy/node-runtime/download.d.ts +5 -1
  22. package/dist/deploy/node-runtime/download.d.ts.map +1 -1
  23. package/dist/deploy/node-runtime/download.js +6 -3
  24. package/dist/deploy/node-runtime/download.js.map +1 -1
  25. package/dist/deploy/node-runtime/index.d.ts +2 -1
  26. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  27. package/dist/deploy/node-runtime/index.js +10 -9
  28. package/dist/deploy/node-runtime/index.js.map +1 -1
  29. package/dist/deploy/node-runtime/license.d.ts +4 -0
  30. package/dist/deploy/node-runtime/license.d.ts.map +1 -0
  31. package/dist/deploy/node-runtime/license.js +19 -0
  32. package/dist/deploy/node-runtime/license.js.map +1 -0
  33. package/dist/deploy/notices/collect.d.ts +8 -0
  34. package/dist/deploy/notices/collect.d.ts.map +1 -0
  35. package/dist/deploy/notices/collect.js +17 -0
  36. package/dist/deploy/notices/collect.js.map +1 -0
  37. package/dist/deploy/notices/dependencies.d.ts +5 -0
  38. package/dist/deploy/notices/dependencies.d.ts.map +1 -0
  39. package/dist/deploy/notices/dependencies.js +39 -0
  40. package/dist/deploy/notices/dependencies.js.map +1 -0
  41. package/dist/deploy/notices/gtkx.d.ts +6 -0
  42. package/dist/deploy/notices/gtkx.d.ts.map +1 -0
  43. package/dist/deploy/notices/gtkx.js +68 -0
  44. package/dist/deploy/notices/gtkx.js.map +1 -0
  45. package/dist/deploy/notices/libraries.d.ts +4 -0
  46. package/dist/deploy/notices/libraries.d.ts.map +1 -0
  47. package/dist/deploy/notices/libraries.js +60 -0
  48. package/dist/deploy/notices/libraries.js.map +1 -0
  49. package/dist/deploy/notices/node-runtime.d.ts +4 -0
  50. package/dist/deploy/notices/node-runtime.d.ts.map +1 -0
  51. package/dist/deploy/notices/node-runtime.js +78 -0
  52. package/dist/deploy/notices/node-runtime.js.map +1 -0
  53. package/dist/deploy/notices/packages.d.ts +13 -0
  54. package/dist/deploy/notices/packages.d.ts.map +1 -0
  55. package/dist/deploy/notices/packages.js +115 -0
  56. package/dist/deploy/notices/packages.js.map +1 -0
  57. package/dist/deploy/notices/render.d.ts +4 -0
  58. package/dist/deploy/notices/render.d.ts.map +1 -0
  59. package/dist/deploy/notices/render.js +41 -0
  60. package/dist/deploy/notices/render.js.map +1 -0
  61. package/dist/deploy/notices/text.d.ts +5 -0
  62. package/dist/deploy/notices/text.d.ts.map +1 -0
  63. package/dist/deploy/notices/text.js +34 -0
  64. package/dist/deploy/notices/text.js.map +1 -0
  65. package/dist/deploy/payload/copy-tree.d.ts +2 -1
  66. package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
  67. package/dist/deploy/payload/copy-tree.js +3 -1
  68. package/dist/deploy/payload/copy-tree.js.map +1 -1
  69. package/dist/deploy/payload/stage.d.ts +7 -3
  70. package/dist/deploy/payload/stage.d.ts.map +1 -1
  71. package/dist/deploy/payload/stage.js +25 -14
  72. package/dist/deploy/payload/stage.js.map +1 -1
  73. package/dist/deploy/run-deploy.d.ts.map +1 -1
  74. package/dist/deploy/run-deploy.js +28 -7
  75. package/dist/deploy/run-deploy.js.map +1 -1
  76. package/dist/deploy/settings/extra-files.d.ts +4 -0
  77. package/dist/deploy/settings/extra-files.d.ts.map +1 -0
  78. package/dist/deploy/settings/extra-files.js +11 -0
  79. package/dist/deploy/settings/extra-files.js.map +1 -0
  80. package/dist/deploy/settings/index.d.ts.map +1 -1
  81. package/dist/deploy/settings/index.js +2 -1
  82. package/dist/deploy/settings/index.js.map +1 -1
  83. package/dist/deploy/settings/package-manifest.d.ts +2 -0
  84. package/dist/deploy/settings/package-manifest.d.ts.map +1 -1
  85. package/dist/deploy/settings/package-manifest.js +8 -0
  86. package/dist/deploy/settings/package-manifest.js.map +1 -1
  87. package/dist/deploy/settings/paths.d.ts +2 -1
  88. package/dist/deploy/settings/paths.d.ts.map +1 -1
  89. package/dist/deploy/settings/paths.js +1 -1
  90. package/dist/deploy/settings/paths.js.map +1 -1
  91. package/dist/deploy/targets/flatpak-manifest.d.ts +3 -1
  92. package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
  93. package/dist/deploy/targets/flatpak-manifest.js +50 -4
  94. package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
  95. package/dist/deploy/targets/flatpak-pnpm.d.ts +15 -0
  96. package/dist/deploy/targets/flatpak-pnpm.d.ts.map +1 -0
  97. package/dist/deploy/targets/flatpak-pnpm.js +69 -0
  98. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -0
  99. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  100. package/dist/deploy/targets/flatpak-source.js +70 -7
  101. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  102. package/dist/deploy/targets/flatpak-sources.d.ts +5 -3
  103. package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -1
  104. package/dist/deploy/targets/flatpak-sources.js +23 -9
  105. package/dist/deploy/targets/flatpak-sources.js.map +1 -1
  106. package/dist/deploy/targets/flatpak.d.ts.map +1 -1
  107. package/dist/deploy/targets/flatpak.js +3 -2
  108. package/dist/deploy/targets/flatpak.js.map +1 -1
  109. package/dist/deploy/tools.d.ts +3 -1
  110. package/dist/deploy/tools.d.ts.map +1 -1
  111. package/dist/deploy/tools.js +17 -3
  112. package/dist/deploy/tools.js.map +1 -1
  113. package/dist/deploy/types.d.ts +22 -2
  114. package/dist/deploy/types.d.ts.map +1 -1
  115. package/dist/deploy/types.js.map +1 -1
  116. package/dist/vite-plugins/bundled-packages.d.ts +5 -0
  117. package/dist/vite-plugins/bundled-packages.d.ts.map +1 -0
  118. package/dist/vite-plugins/bundled-packages.js +63 -0
  119. package/dist/vite-plugins/bundled-packages.js.map +1 -0
  120. package/package.json +9 -9
  121. package/src/builder.ts +2 -0
  122. package/src/codegen/report.ts +4 -0
  123. package/src/codegen/run-codegen.ts +11 -1
  124. package/src/commands/docs.ts +1 -0
  125. package/src/deploy/freedesktop/copyright.ts +153 -18
  126. package/src/deploy/install-hints.ts +9 -6
  127. package/src/deploy/node-runtime/download.ts +13 -4
  128. package/src/deploy/node-runtime/index.ts +17 -11
  129. package/src/deploy/node-runtime/license.ts +24 -0
  130. package/src/deploy/notices/collect.ts +26 -0
  131. package/src/deploy/notices/dependencies.ts +53 -0
  132. package/src/deploy/notices/gtkx.ts +92 -0
  133. package/src/deploy/notices/libraries.ts +81 -0
  134. package/src/deploy/notices/node-runtime.ts +101 -0
  135. package/src/deploy/notices/packages.ts +168 -0
  136. package/src/deploy/notices/render.ts +52 -0
  137. package/src/deploy/notices/text.ts +42 -0
  138. package/src/deploy/payload/copy-tree.ts +5 -1
  139. package/src/deploy/payload/stage.ts +40 -16
  140. package/src/deploy/run-deploy.ts +34 -6
  141. package/src/deploy/settings/extra-files.ts +21 -0
  142. package/src/deploy/settings/index.ts +2 -1
  143. package/src/deploy/settings/package-manifest.ts +12 -0
  144. package/src/deploy/settings/paths.ts +1 -1
  145. package/src/deploy/targets/flatpak-manifest.ts +69 -4
  146. package/src/deploy/targets/flatpak-pnpm.ts +115 -0
  147. package/src/deploy/targets/flatpak-source.ts +105 -6
  148. package/src/deploy/targets/flatpak-sources.ts +36 -9
  149. package/src/deploy/targets/flatpak.ts +3 -2
  150. package/src/deploy/tools.ts +23 -2
  151. package/src/deploy/types.ts +27 -1
  152. package/src/vite-plugins/bundled-packages.ts +95 -0
  153. package/LICENSE +0 -373
@@ -15,10 +15,24 @@ type StagedFile = {
15
15
  };
16
16
  type NodeRuntime = {
17
17
  path: string;
18
+ licenseFile: string | null;
18
19
  version: string;
19
20
  glibcFloor: string | null;
20
21
  isStripped: boolean;
21
22
  };
23
+ type Notice = {
24
+ subject: string;
25
+ license: string;
26
+ source: string | null;
27
+ copyright: string[];
28
+ text: string | null;
29
+ };
30
+ type NoticeSection = {
31
+ title: string;
32
+ files: string[];
33
+ summary: string[];
34
+ notices: Notice[];
35
+ };
22
36
  type DeployDeveloper = {
23
37
  id: string | null;
24
38
  name: string;
@@ -42,6 +56,11 @@ type DeployFileAssociation = {
42
56
  mimeType: string;
43
57
  description: string | null;
44
58
  };
59
+ type DeployExtraFile = {
60
+ destination: string;
61
+ source: string;
62
+ mode: number | null;
63
+ };
45
64
  type DeployDesktopAction = {
46
65
  id: string;
47
66
  name: string;
@@ -108,7 +127,7 @@ type DeploySettings = {
108
127
  desktopActions: DeployDesktopAction[];
109
128
  desktopEntry: Record<string, string>;
110
129
  isDbusActivatable: boolean;
111
- extraFiles: Record<string, string>;
130
+ extraFiles: DeployExtraFile[];
112
131
  versions: DeployVersions;
113
132
  arch: DeployArch;
114
133
  paths: DeployPaths;
@@ -119,6 +138,7 @@ type DeployPayload = {
119
138
  settings: DeploySettings;
120
139
  node: NodeRuntime | null;
121
140
  stage: StagedFile[];
141
+ notices: NoticeSection[];
122
142
  overlays: Record<DeployTargetName, StagedFile[]>;
123
143
  };
124
144
  type DeployManifest = {
@@ -136,5 +156,5 @@ type DeployTarget = {
136
156
  render: (payload: DeployPayload) => DeployManifest[];
137
157
  pack: (payload: DeployPayload, manifests: DeployManifest[]) => Promise<DeployArtifact[]>;
138
158
  };
139
- export type { DeployArch, DeployArtifact, DeployConfig, DeployDesktopAction, DeployDeveloper, DeployFileAssociation, DeployManifest, DeployPaths, DeployPayload, DeployRelease, DeployScreenshot, DeploySettings, DeployTarget, DeployTargetName, DeployTool, DeployVersions, NodeRuntime, PackageFamily, StagedFile, };
159
+ export type { DeployArch, DeployArtifact, DeployConfig, DeployDesktopAction, DeployDeveloper, DeployExtraFile, DeployFileAssociation, DeployManifest, DeployPaths, DeployPayload, DeployRelease, DeployScreenshot, DeploySettings, DeployTarget, DeployTargetName, DeployTool, DeployVersions, NodeRuntime, Notice, NoticeSection, PackageFamily, StagedFile, };
140
160
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/deploy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,KAAK,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAClD,KAAK,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACrE,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE,KAAK,UAAU,GAAG;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CAC7B,CAAC;AAEF,KAAK,UAAU,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;C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EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;CACpD,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,EAAE,CAAC;IACrD,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAC5F,CAAC;AAEF,YAAY,EACR,UAAU,EACV,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,GACb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/deploy/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from \"@gtkx/config\";\n\ntype DeployConfig = NonNullable<Config[\"deploy\"]>;\ntype DeployTargetName = NonNullable<DeployConfig[\"targets\"]>[number];\ntype PackageFamily = \"arch\" | \"debian\" | \"fedora\" | \"suse\" | \"unknown\";\n\ntype DeployTool = {\n command: string;\n purpose: string;\n isOptional: boolean;\n isPresent?: () => boolean;\n};\n\ntype StagedFile = {\n rel: string;\n abs: string;\n mode: number;\n};\n\ntype NodeRuntime = {\n path: string;\n version: string;\n glibcFloor: string | null;\n isStripped: boolean;\n};\n\ntype DeployDeveloper = {\n id: string | null;\n name: string;\n email: string | null;\n};\n\ntype DeployScreenshot = {\n url: string;\n caption: string | null;\n isDefault: boolean;\n};\n\ntype DeployRelease = {\n version: string;\n date: string;\n type: string | null;\n urgency: string | null;\n notes: string[];\n url: string | null;\n};\n\ntype DeployFileAssociation = {\n extension: string;\n mimeType: string;\n description: string | null;\n};\n\ntype DeployDesktopAction = {\n id: string;\n name: string;\n args: string[];\n icon: string | null;\n};\n\ntype DeployVersions = {\n upstream: string;\n packageVersion: string;\n debRevision: string;\n rpmRelease: string;\n epoch: number | null;\n};\n\ntype DeployArch = {\n deb: string;\n rpm: string;\n flatpak: string;\n appimage: string;\n node: string;\n};\n\ntype DeployPaths = {\n root: string;\n dist: string;\n outDir: string;\n metadata: string;\n runtime: string;\n stage: string;\n overlay: string;\n targets: string;\n output: string;\n dataDir: string | null;\n iconsDir: string | null;\n iconFile: string | null;\n licenseFile: string | null;\n schemaFiles: string[];\n};\n\ntype DeploySettings = {\n applicationId: string;\n binaryName: string;\n name: string;\n genericName: string | null;\n summary: string;\n description: string[];\n keywords: string[];\n categories: string[];\n mimeTypes: string[];\n developer: DeployDeveloper;\n license: string;\n metadataLicense: string;\n copyright: string;\n homepage: string | null;\n urls: Record<string, string>;\n screenshots: DeployScreenshot[];\n branding: { light: string; dark: string } | null;\n contentRating: Record<string, string>;\n releases: DeployRelease[];\n execArgs: string[];\n execToken: string | null;\n fileAssociations: DeployFileAssociation[];\n protocols: string[];\n desktopActions: DeployDesktopAction[];\n desktopEntry: Record<string, string>;\n isDbusActivatable: boolean;\n extraFiles: Record<string, string>;\n versions: DeployVersions;\n arch: DeployArch;\n paths: DeployPaths;\n libraries: string[];\n deploy: DeployConfig;\n};\n\ntype DeployPayload = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n stage: StagedFile[];\n overlays: Record<DeployTargetName, StagedFile[]>;\n};\n\ntype DeployManifest = {\n path: string;\n contents: string;\n};\n\ntype DeployArtifact = {\n path: string;\n size: number;\n};\n\ntype DeployTarget = {\n name: DeployTargetName;\n prefix: string;\n tools: DeployTool[];\n render: (payload: DeployPayload) => DeployManifest[];\n pack: (payload: DeployPayload, manifests: DeployManifest[]) => Promise<DeployArtifact[]>;\n};\n\nexport type {\n DeployArch,\n DeployArtifact,\n DeployConfig,\n DeployDesktopAction,\n DeployDeveloper,\n DeployFileAssociation,\n DeployManifest,\n DeployPaths,\n DeployPayload,\n DeployRelease,\n DeployScreenshot,\n DeploySettings,\n DeployTarget,\n DeployTargetName,\n DeployTool,\n DeployVersions,\n NodeRuntime,\n PackageFamily,\n StagedFile,\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/deploy/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Config } from \"@gtkx/config\";\n\ntype DeployConfig = NonNullable<Config[\"deploy\"]>;\ntype DeployTargetName = NonNullable<DeployConfig[\"targets\"]>[number];\ntype PackageFamily = \"arch\" | \"debian\" | \"fedora\" | \"suse\" | \"unknown\";\n\ntype DeployTool = {\n command: string;\n purpose: string;\n isOptional: boolean;\n isPresent?: () => boolean;\n};\n\ntype StagedFile = {\n rel: string;\n abs: string;\n mode: number;\n};\n\ntype NodeRuntime = {\n path: string;\n licenseFile: string | null;\n version: string;\n glibcFloor: string | null;\n isStripped: boolean;\n};\n\ntype Notice = {\n subject: string;\n license: string;\n source: string | null;\n copyright: string[];\n text: string | null;\n};\n\ntype NoticeSection = {\n title: string;\n files: string[];\n summary: string[];\n notices: Notice[];\n};\n\ntype DeployDeveloper = {\n id: string | null;\n name: string;\n email: string | null;\n};\n\ntype DeployScreenshot = {\n url: string;\n caption: string | null;\n isDefault: boolean;\n};\n\ntype DeployRelease = {\n version: string;\n date: string;\n type: string | null;\n urgency: string | null;\n notes: string[];\n url: string | null;\n};\n\ntype DeployFileAssociation = {\n extension: string;\n mimeType: string;\n description: string | null;\n};\n\ntype DeployExtraFile = {\n destination: string;\n source: string;\n mode: number | null;\n};\n\ntype DeployDesktopAction = {\n id: string;\n name: string;\n args: string[];\n icon: string | null;\n};\n\ntype DeployVersions = {\n upstream: string;\n packageVersion: string;\n debRevision: string;\n rpmRelease: string;\n epoch: number | null;\n};\n\ntype DeployArch = {\n deb: string;\n rpm: string;\n flatpak: string;\n appimage: string;\n node: string;\n};\n\ntype DeployPaths = {\n root: string;\n dist: string;\n outDir: string;\n metadata: string;\n runtime: string;\n stage: string;\n overlay: string;\n targets: string;\n output: string;\n dataDir: string | null;\n iconsDir: string | null;\n iconFile: string | null;\n licenseFile: string | null;\n schemaFiles: string[];\n};\n\ntype DeploySettings = {\n applicationId: string;\n binaryName: string;\n name: string;\n genericName: string | null;\n summary: string;\n description: string[];\n keywords: string[];\n categories: string[];\n mimeTypes: string[];\n developer: DeployDeveloper;\n license: string;\n metadataLicense: string;\n copyright: string;\n homepage: string | null;\n urls: Record<string, string>;\n screenshots: DeployScreenshot[];\n branding: { light: string; dark: string } | null;\n contentRating: Record<string, string>;\n releases: DeployRelease[];\n execArgs: string[];\n execToken: string | null;\n fileAssociations: DeployFileAssociation[];\n protocols: string[];\n desktopActions: DeployDesktopAction[];\n desktopEntry: Record<string, string>;\n isDbusActivatable: boolean;\n extraFiles: DeployExtraFile[];\n versions: DeployVersions;\n arch: DeployArch;\n paths: DeployPaths;\n libraries: string[];\n deploy: DeployConfig;\n};\n\ntype DeployPayload = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n stage: StagedFile[];\n notices: NoticeSection[];\n overlays: Record<DeployTargetName, StagedFile[]>;\n};\n\ntype DeployManifest = {\n path: string;\n contents: string;\n};\n\ntype DeployArtifact = {\n path: string;\n size: number;\n};\n\ntype DeployTarget = {\n name: DeployTargetName;\n prefix: string;\n tools: DeployTool[];\n render: (payload: DeployPayload) => DeployManifest[];\n pack: (payload: DeployPayload, manifests: DeployManifest[]) => Promise<DeployArtifact[]>;\n};\n\nexport type {\n DeployArch,\n DeployArtifact,\n DeployConfig,\n DeployDesktopAction,\n DeployDeveloper,\n DeployExtraFile,\n DeployFileAssociation,\n DeployManifest,\n DeployPaths,\n DeployPayload,\n DeployRelease,\n DeployScreenshot,\n DeploySettings,\n DeployTarget,\n DeployTargetName,\n DeployTool,\n DeployVersions,\n NodeRuntime,\n Notice,\n NoticeSection,\n PackageFamily,\n StagedFile,\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from "vite";
2
+ declare const BUNDLED_PACKAGES_FILENAME = "gtkx-packages.json";
3
+ declare function gtkxBundledPackages(root: string): Plugin;
4
+ export { BUNDLED_PACKAGES_FILENAME, gtkxBundledPackages };
5
+ //# sourceMappingURL=bundled-packages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-packages.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/bundled-packages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAmBnC,QAAA,MAAM,yBAAyB,uBAAuB,CAAC;AAoDvD,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBjD;AAED,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { isRecord, sortStringsBy } from "@gtkx/utils";
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join, relative, resolve } from "node:path";
4
+ import { stripQuery } from "./strip-query.js";
5
+ const BUNDLED_PACKAGES_FILENAME = "gtkx-packages.json";
6
+ const MANIFEST_FILENAME = "package.json";
7
+ const DEFAULT_OUT_DIR = "dist";
8
+ const JSON_INDENT = 4;
9
+ const identityIn = (dir) => {
10
+ try {
11
+ const parsed = JSON.parse(readFileSync(join(dir, MANIFEST_FILENAME), "utf8"));
12
+ if (!isRecord(parsed) || typeof parsed.name !== "string") {
13
+ return null;
14
+ }
15
+ return { name: parsed.name, version: typeof parsed.version === "string" ? parsed.version : null };
16
+ }
17
+ catch {
18
+ return null;
19
+ }
20
+ };
21
+ const packageIn = (dir) => {
22
+ const identity = identityIn(dir);
23
+ if (identity !== null) {
24
+ return { ...identity, dir };
25
+ }
26
+ const parent = dirname(dir);
27
+ return parent === dir ? null : packageIn(parent);
28
+ };
29
+ const packageForModule = (id) => {
30
+ const path = stripQuery(id);
31
+ return path.startsWith("/") ? packageIn(dirname(path)) : null;
32
+ };
33
+ const keyFor = (entry) => `${entry.name}@${entry.version ?? ""}`;
34
+ const relativeTo = (outDir, entry) => ({
35
+ ...entry,
36
+ dir: relative(outDir, entry.dir),
37
+ });
38
+ const renderPackages = (outDir, ids) => {
39
+ const found = ids.map((id) => packageForModule(id)).filter((entry) => entry !== null);
40
+ const unique = new Map(found.map((entry) => [keyFor(entry), entry]));
41
+ const packages = sortStringsBy(unique.values(), keyFor).map((entry) => relativeTo(outDir, entry));
42
+ return `${JSON.stringify({ packages }, null, JSON_INDENT)}\n`;
43
+ };
44
+ function gtkxBundledPackages(root) {
45
+ const state = { outDir: join(root, DEFAULT_OUT_DIR) };
46
+ return {
47
+ name: "gtkx:bundled-packages",
48
+ apply: "build",
49
+ configResolved(config) {
50
+ state.outDir = resolve(config.root, config.build.outDir);
51
+ },
52
+ generateBundle(_options, bundle) {
53
+ const ids = Object.values(bundle).flatMap((output) => (output.type === "chunk" ? output.moduleIds : []));
54
+ this.emitFile({
55
+ type: "asset",
56
+ fileName: BUNDLED_PACKAGES_FILENAME,
57
+ source: renderPackages(state.outDir, ids),
58
+ });
59
+ },
60
+ };
61
+ }
62
+ export { BUNDLED_PACKAGES_FILENAME, gtkxBundledPackages };
63
+ //# sourceMappingURL=bundled-packages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-packages.js","sourceRoot":"","sources":["../../src/vite-plugins/bundled-packages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAe9C,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AACvD,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAG,CAAC,GAAW,EAA0B,EAAE;IACvD,IAAI,CAAC;QACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAEvF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtG,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,GAAW,EAA0B,EAAE;IACtD,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG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isRecord, sortStringsBy } from \"@gtkx/utils\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { stripQuery } from \"./strip-query.js\";\n\ntype PackageIdentity = {\n name: string;\n version: string | null;\n};\n\ntype RecordedPackage = PackageIdentity & {\n dir: string;\n};\n\ntype PackagesState = {\n outDir: string;\n};\n\nconst BUNDLED_PACKAGES_FILENAME = \"gtkx-packages.json\";\nconst MANIFEST_FILENAME = \"package.json\";\nconst DEFAULT_OUT_DIR = \"dist\";\nconst JSON_INDENT = 4;\n\nconst identityIn = (dir: string): PackageIdentity | null => {\n try {\n const parsed: unknown = JSON.parse(readFileSync(join(dir, MANIFEST_FILENAME), \"utf8\"));\n\n if (!isRecord(parsed) || typeof parsed.name !== \"string\") {\n return null;\n }\n\n return { name: parsed.name, version: typeof parsed.version === \"string\" ? parsed.version : null };\n } catch {\n return null;\n }\n};\n\nconst packageIn = (dir: string): RecordedPackage | null => {\n const identity = identityIn(dir);\n\n if (identity !== null) {\n return { ...identity, dir };\n }\n\n const parent = dirname(dir);\n\n return parent === dir ? null : packageIn(parent);\n};\n\nconst packageForModule = (id: string): RecordedPackage | null => {\n const path = stripQuery(id);\n\n return path.startsWith(\"/\") ? packageIn(dirname(path)) : null;\n};\n\nconst keyFor = (entry: RecordedPackage): string => `${entry.name}@${entry.version ?? \"\"}`;\n\nconst relativeTo = (outDir: string, entry: RecordedPackage): RecordedPackage => ({\n ...entry,\n dir: relative(outDir, entry.dir),\n});\n\nconst renderPackages = (outDir: string, ids: string[]): string => {\n const found = ids.map((id) => packageForModule(id)).filter((entry) => entry !== null);\n const unique: Map<string, RecordedPackage> = new Map(found.map((entry) => [keyFor(entry), entry]));\n const packages = sortStringsBy(unique.values(), keyFor).map((entry) => relativeTo(outDir, entry));\n\n return `${JSON.stringify({ packages }, null, JSON_INDENT)}\\n`;\n};\n\nfunction gtkxBundledPackages(root: string): Plugin {\n const state: PackagesState = { outDir: join(root, DEFAULT_OUT_DIR) };\n\n return {\n name: \"gtkx:bundled-packages\",\n apply: \"build\",\n\n configResolved(config) {\n state.outDir = resolve(config.root, config.build.outDir);\n },\n\n generateBundle(_options, bundle) {\n const ids = Object.values(bundle).flatMap((output) => (output.type === \"chunk\" ? output.moduleIds : []));\n\n this.emitFile({\n type: \"asset\",\n fileName: BUNDLED_PACKAGES_FILENAME,\n source: renderPackages(state.outDir, ids),\n });\n },\n };\n}\n\nexport { BUNDLED_PACKAGES_FILENAME, gtkxBundledPackages };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Command-line tool and Vite plugin stack that scaffolds, develops, builds, and documents GTKX applications",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -73,19 +73,19 @@
73
73
  "react-refresh": "^0.18.0",
74
74
  "vite": "^8.2.1",
75
75
  "yaml": "^2.9.0",
76
- "@gtkx/codegen": "1.1.0",
77
- "@gtkx/runtime": "1.1.0",
78
- "@gtkx/mcp": "1.1.0",
79
- "@gtkx/config": "1.1.0",
80
- "@gtkx/utils": "1.1.0",
81
- "create-gtkx": "1.1.0",
82
- "@gtkx/vitest": "1.1.0"
76
+ "@gtkx/codegen": "1.2.1",
77
+ "@gtkx/mcp": "1.2.1",
78
+ "@gtkx/config": "1.2.1",
79
+ "@gtkx/runtime": "1.2.1",
80
+ "@gtkx/utils": "1.2.1",
81
+ "@gtkx/vitest": "1.2.1",
82
+ "create-gtkx": "1.2.1"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/babel__core": "^7.20.5",
86
86
  "@types/react-refresh": "^0.14.7",
87
87
  "vitest": "^4.1.10",
88
- "@gtkx/testing": "1.1.0"
88
+ "@gtkx/testing": "1.2.1"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^19"
package/src/builder.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { join, posix } from "node:path";
2
2
  import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
3
3
  import { gtkxBuiltUrl } from "./vite-plugins/built-url.js";
4
+ import { gtkxBundledPackages } from "./vite-plugins/bundled-packages.js";
4
5
  import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
5
6
  import { gtkxVitePlugins } from "./vite-plugins/index.js";
6
7
  import { gtkxNative } from "./vite-plugins/native.js";
@@ -42,6 +43,7 @@ const build = async (options: BuildOptions): Promise<string> => {
42
43
  gtkxWorker(),
43
44
  gtkxBuiltUrl(assetBase),
44
45
  gtkxNative(root),
46
+ gtkxBundledPackages(root),
45
47
  gtkxSelfContained(),
46
48
  ],
47
49
  build: {
@@ -17,6 +17,10 @@ const formatCodegenResult = (result: RunCodegenResult, totalMs: number): string[
17
17
  details.push(`girPath=${result.girPath.join(":")}`);
18
18
  }
19
19
 
20
+ if (result.future && result.future.length > 0) {
21
+ details.push(`future=${result.future.join(", ")}`);
22
+ }
23
+
20
24
  details.push(
21
25
  `${String(result.namespaces)} namespaces, ${String(result.intrinsicElements)} intrinsic elements ` +
22
26
  `in ${String(result.duration)}ms (total ${String(totalMs)}ms)`,
@@ -36,6 +36,7 @@ type RunCodegenResult = {
36
36
  girPath?: string[] | undefined;
37
37
  configFile?: string | undefined;
38
38
  libraries?: string[] | undefined;
39
+ future?: string[] | undefined;
39
40
  };
40
41
 
41
42
  type CodegenOptionsInput = {
@@ -43,6 +44,7 @@ type CodegenOptionsInput = {
43
44
  libraries: string[];
44
45
  girPath: string[];
45
46
  elements: Config["elements"];
47
+ isByteArrayTyped: boolean;
46
48
  };
47
49
 
48
50
  type PreparedCodegen = CodegenInputs & { isForced: boolean };
@@ -71,9 +73,10 @@ const removeShadowingStores = (cwd: string): void => {
71
73
  removeStores(getShadowingStorePaths(cwd));
72
74
  };
73
75
 
74
- const codegenOptions = ({ store, libraries, girPath, elements }: CodegenOptionsInput) => ({
76
+ const codegenOptions = ({ store, libraries, girPath, elements, isByteArrayTyped }: CodegenOptionsInput) => ({
75
77
  libraries,
76
78
  girPath,
79
+ isByteArrayTyped,
77
80
  gi: {
78
81
  storeDir: store.giStoreDir,
79
82
  linkDir: store.giLinkDir,
@@ -94,6 +97,11 @@ const codegenOptions = ({ store, libraries, girPath, elements }: CodegenOptionsI
94
97
  userOmittedProps: resolveOmittedProps(elements),
95
98
  });
96
99
 
100
+ const enabledFutureFlags = (config: Config): string[] =>
101
+ Object.entries(config.future ?? {})
102
+ .filter(([, value]) => value === true)
103
+ .map(([name]) => name);
104
+
97
105
  const disabledCodegenResult = (configFile: string): RunCodegenResult => ({
98
106
  isRegenerated: false,
99
107
  namespaces: 0,
@@ -153,6 +161,7 @@ const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenRe
153
161
  libraries,
154
162
  girPath,
155
163
  elements: config.elements,
164
+ isByteArrayTyped: config.future?.v2ByteArrays === true,
156
165
  }),
157
166
  isForced,
158
167
  });
@@ -165,6 +174,7 @@ const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenRe
165
174
  girPath,
166
175
  configFile,
167
176
  libraries,
177
+ future: enabledFutureFlags(config),
168
178
  };
169
179
  };
170
180
 
@@ -78,6 +78,7 @@ const docs = defineCommand({
78
78
  props: builtin.props,
79
79
  omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
80
80
  isForced: args.force,
81
+ isByteArrayTyped: config.future?.v2ByteArrays === true,
81
82
  });
82
83
 
83
84
  if (!isRegenerated) {
@@ -1,41 +1,176 @@
1
1
  import { readFileSync } from "node:fs";
2
- import type { DeploySettings } from "../types.js";
2
+ import type { DeploySettings, Notice, NoticeSection } from "../types.js";
3
+ import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
4
+
5
+ type FileStanza = {
6
+ settings: DeploySettings;
7
+ files: string;
8
+ sections: NoticeSection[];
9
+ reproduced: Set<string>;
10
+ };
3
11
 
4
12
  const FORMAT_URL = "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/";
5
13
  const CONTINUATION_BLANK = " .";
14
+ const UNKNOWN_COPYRIGHT = "unknown";
15
+ const UNKNOWN_LICENSE = "unknown";
16
+ const LICENSE_SEPARATOR = " and ";
17
+ const SPDX_GROUPING = /[()]/g;
18
+ const SPDX_OPERATOR = /\b(?:AND|OR|WITH)\b/g;
19
+ const REPEATED_SPACE = / {2,}/g;
20
+ const OUTSIDE_NAME = /[^\w.+-]+/g;
21
+ const NAME_JOINER = "-";
22
+ const NAME_TOKEN = /^[\w.+-]+$/;
23
+ const NAME_CONNECTIVE = / (?:or|with) /;
24
+
25
+ const indentLine = (line: string): string => (line.trim().length === 0 ? CONTINUATION_BLANK : ` ${line}`);
6
26
 
7
- const indentLicenseBody = (body: string): string[] =>
8
- body
9
- .split("\n")
10
- .map((line) => (line.trim().length === 0 ? CONTINUATION_BLANK : ` ${line}`));
27
+ const foldedField = (name: string, lines: string[]): string[] => {
28
+ const [first, ...rest] = lines;
11
29
 
12
- const licenseBody = (licenseFile: string | null): string[] => {
30
+ return first === undefined ? [] : [`${name}: ${first}`, ...rest.map((line) => indentLine(line))];
31
+ };
32
+
33
+ const licenseText = (licenseFile: string | null): string | null => {
13
34
  if (licenseFile === null) {
14
- return [];
35
+ return null;
15
36
  }
16
37
 
17
38
  try {
18
- return indentLicenseBody(readFileSync(licenseFile, "utf8").trimEnd());
39
+ return readFileSync(licenseFile, "utf8").trimEnd();
19
40
  } catch {
20
- return [];
41
+ return null;
21
42
  }
22
43
  };
23
44
 
24
- const headerLines = (settings: DeploySettings): string[] => [
45
+ const shortName = (license: string): string =>
46
+ license
47
+ .replaceAll(SPDX_GROUPING, " ")
48
+ .replaceAll(SPDX_OPERATOR, (operator) => operator.toLowerCase())
49
+ .replaceAll(REPEATED_SPACE, " ")
50
+ .trim();
51
+
52
+ const isShortName = (part: string): boolean =>
53
+ part.split(NAME_CONNECTIVE).every((token) => NAME_TOKEN.test(token));
54
+
55
+ const namePart = (part: string): string =>
56
+ isShortName(part) ? part : part.split(OUTSIDE_NAME).filter((token) => token.length > 0).join(NAME_JOINER);
57
+
58
+ const shortNames = (license: string): string[] =>
59
+ shortName(license).split(LICENSE_SEPARATOR).map((part) => namePart(part)).filter((part) => part.length > 0);
60
+
61
+ const licenseNames = (notices: Notice[]): string => {
62
+ const names = [...new Set(notices.flatMap((notice) => shortNames(notice.license)))];
63
+
64
+ return names.length === 0 ? UNKNOWN_LICENSE : names.join(LICENSE_SEPARATOR);
65
+ };
66
+
67
+ const compactNotice = (notice: Notice): string => {
68
+ const label = `${notice.subject} (${licenseNames([notice])})`;
69
+
70
+ return notice.source === null ? label : `${label}: ${notice.source}`;
71
+ };
72
+
73
+ const noticeBody = (notice: Notice, reproduced: Set<string>): string[] => {
74
+ const head = [
75
+ "",
76
+ `${notice.subject} (${licenseNames([notice])})`,
77
+ ...(notice.source === null ? [] : [`Source: ${notice.source}`]),
78
+ ];
79
+
80
+ if (notice.text === null || reproduced.has(notice.text)) {
81
+ return head;
82
+ }
83
+
84
+ reproduced.add(notice.text);
85
+
86
+ return [...head, "", ...notice.text.split("\n")];
87
+ };
88
+
89
+ const copyrightNames = (notices: Notice[]): string[] => {
90
+ const lines = [...new Set(notices.flatMap((notice) => notice.copyright))];
91
+
92
+ return lines.length === 0 ? [UNKNOWN_COPYRIGHT] : lines;
93
+ };
94
+
95
+ const stanzaComment = (sections: NoticeSection[]): string[] =>
96
+ sections.flatMap((section, index) => [...(index === 0 ? [] : [""]), section.title, ...section.summary]);
97
+
98
+ const sectionComment = (section: NoticeSection): string[] => [
99
+ section.title,
100
+ "",
101
+ ...section.summary,
102
+ "",
103
+ ...section.notices.map((notice) => compactNotice(notice)),
104
+ ];
105
+
106
+ const bundlePath = (settings: DeploySettings): string => `lib/${settings.binaryName}/${BUNDLE_FILENAME}`;
107
+
108
+ const applicationNotice = (settings: DeploySettings): Notice => ({
109
+ subject: settings.name,
110
+ license: settings.license,
111
+ source: settings.homepage,
112
+ copyright: [settings.copyright],
113
+ text: null,
114
+ });
115
+
116
+ const stanzaNotices = (settings: DeploySettings, files: string, sections: NoticeSection[]): Notice[] => {
117
+ const own = files === bundlePath(settings) ? [applicationNotice(settings)] : [];
118
+
119
+ return [...own, ...sections.flatMap((section) => section.notices)];
120
+ };
121
+
122
+ const fileStanza = ({ settings, files, sections, reproduced }: FileStanza): string[] => {
123
+ const notices = stanzaNotices(settings, files, sections);
124
+ const texts = notices.flatMap((notice) => noticeBody(notice, reproduced));
125
+
126
+ return [
127
+ `Files: ${files}`,
128
+ ...foldedField("Comment", stanzaComment(sections)),
129
+ ...foldedField("Copyright", copyrightNames(notices)),
130
+ ...foldedField("License", [licenseNames(notices), ...texts]),
131
+ "",
132
+ ];
133
+ };
134
+
135
+ const filePatterns = (sections: NoticeSection[]): string[] =>
136
+ [...new Set(sections.flatMap((section) => section.files))];
137
+
138
+ const sectionsFor = (sections: NoticeSection[], files: string): NoticeSection[] =>
139
+ sections.filter((section) => section.files.includes(files));
140
+
141
+ const headerComment = (sections: NoticeSection[]): string[] =>
142
+ sections.filter((section) => section.files.length === 0).flatMap((section) => sectionComment(section));
143
+
144
+ const headerLines = (settings: DeploySettings, sections: NoticeSection[]): string[] => [
25
145
  `Format: ${FORMAT_URL}`,
26
146
  `Upstream-Name: ${settings.name}`,
27
147
  ...(settings.homepage === null ? [] : [`Source: ${settings.homepage}`]),
148
+ ...foldedField("Comment", headerComment(sections)),
28
149
  ];
29
150
 
30
- const renderCopyright = (settings: DeploySettings): string =>
31
- [
32
- ...headerLines(settings),
33
- "",
34
- "Files: *",
35
- `Copyright: ${settings.copyright}`,
36
- `License: ${settings.license}`,
37
- ...licenseBody(settings.paths.licenseFile),
151
+ const applicationStanza = (settings: DeploySettings, text: string | null): string[] => [
152
+ "Files: *",
153
+ `Copyright: ${settings.copyright}`,
154
+ ...foldedField("License", [
155
+ licenseNames([applicationNotice(settings)]),
156
+ ...(text === null ? [] : text.split("\n")),
157
+ ]),
158
+ "",
159
+ ];
160
+
161
+ const renderCopyright = (settings: DeploySettings, sections: NoticeSection[]): string => {
162
+ const own = licenseText(settings.paths.licenseFile);
163
+ const reproduced: Set<string> = new Set(own === null ? [] : [own]);
164
+
165
+ const stanzas = filePatterns(sections).flatMap((files) =>
166
+ fileStanza({ settings, files, sections: sectionsFor(sections, files), reproduced }));
167
+
168
+ return [
169
+ ...headerLines(settings, sections),
38
170
  "",
171
+ ...applicationStanza(settings, own),
172
+ ...stanzas,
39
173
  ].join("\n");
174
+ };
40
175
 
41
176
  export { renderCopyright };
@@ -47,10 +47,14 @@ const PACKAGE_FOR_TOOL: Record<string, FamilyPackages> = {
47
47
  tar: { arch: "tar", debian: "tar", fedora: "tar", suse: "tar" },
48
48
  };
49
49
 
50
- const EXTRA_HINTS: Record<string, string> = {
51
- "flatpak-builder": "or: flatpak install --user -y flathub org.flatpak.Builder",
52
- "flatpak-node-generator":
53
- "pipx install git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=node",
50
+ const GENERATOR_SOURCE = "git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=node";
51
+
52
+ const EXTRA_HINTS: Record<string, string[]> = {
53
+ "flatpak-builder": ["or: flatpak install --user -y flathub org.flatpak.Builder"],
54
+ "flatpak-node-generator": [
55
+ `pipx install ${GENERATOR_SOURCE}`,
56
+ `or, when the installed copy is too old to vendor pnpm: pipx install --force ${GENERATOR_SOURCE}`,
57
+ ],
54
58
  };
55
59
 
56
60
  const unquote = (value: string): string => QUOTED.exec(value)?.[1] ?? value;
@@ -99,10 +103,9 @@ const detectPackageFamily = (): PackageFamily => {
99
103
  const installHints = (tool: string, family: PackageFamily): string[] => {
100
104
  const packageName = PACKAGE_FOR_TOOL[tool]?.[family];
101
105
  const command = INSTALL_COMMAND[family];
102
- const extra = EXTRA_HINTS[tool];
103
106
  const install = packageName !== undefined && command !== undefined ? [`${command} ${packageName}`] : [];
104
107
 
105
- return extra === undefined ? install : [...install, extra];
108
+ return [...install, ...(EXTRA_HINTS[tool] ?? [])];
106
109
  };
107
110
 
108
111
  export { detectPackageFamily, installHints };
@@ -3,10 +3,17 @@ import { join } from "node:path";
3
3
  import type { DigestRequest } from "../download.js";
4
4
  import { runCliTool } from "../../internal/run-cli-tool.js";
5
5
  import { cachedDigest, cacheDir, downloadFile, publishedDigest } from "../download.js";
6
+ import { LICENSE_FILENAME } from "./license.js";
7
+
8
+ type DownloadedNode = {
9
+ path: string;
10
+ licenseFile: string;
11
+ };
6
12
 
7
13
  const DIST_BASE_URL = "https://nodejs.org/dist";
8
- const STRIP_COMPONENTS = "2";
14
+ const STRIP_COMPONENTS = "1";
9
15
  const CHECKSUMS_FILE = "SHASUMS256.txt";
16
+ const NODE_PATH = "bin/node";
10
17
 
11
18
  const releaseName = (version: string, arch: string): string => `node-v${version}-linux-${arch}`;
12
19
 
@@ -18,15 +25,17 @@ const digestRequest = (version: string, assetName: string, dir: string): DigestR
18
25
  });
19
26
 
20
27
  const extractNode = (archive: string, dir: string, version: string, arch: string): void => {
28
+ const release = releaseName(version, arch);
29
+
21
30
  runCliTool({
22
31
  tool: "tar",
23
32
  args: ["-xJf", archive, "-C", dir, "--strip-components", STRIP_COMPONENTS,
24
- `${releaseName(version, arch)}/bin/node`],
33
+ `${release}/${NODE_PATH}`, `${release}/${LICENSE_FILENAME}`],
25
34
  target: `Node.js ${version}`,
26
35
  });
27
36
  };
28
37
 
29
- const downloadNode = async (version: string, arch: string, destDir: string): Promise<string> => {
38
+ const downloadNode = async (version: string, arch: string, destDir: string): Promise<DownloadedNode> => {
30
39
  const assetName = `${releaseName(version, arch)}.tar.xz`;
31
40
  const dir = cacheDir(["node", `${version}-linux-${arch}`]);
32
41
  const request = digestRequest(version, assetName, dir);
@@ -42,7 +51,7 @@ const downloadNode = async (version: string, arch: string, destDir: string): Pro
42
51
  mkdirSync(destDir, { recursive: true });
43
52
  extractNode(archive, destDir, version, arch);
44
53
 
45
- return join(destDir, "node");
54
+ return { path: join(destDir, NODE_PATH), licenseFile: join(destDir, LICENSE_FILENAME) };
46
55
  };
47
56
 
48
57
  export { downloadNode };