@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.
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +2 -0
- package/dist/builder.js.map +1 -1
- package/dist/codegen/report.d.ts.map +1 -1
- package/dist/codegen/report.js +3 -0
- package/dist/codegen/report.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +1 -0
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +7 -1
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +1 -0
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/freedesktop/copyright.d.ts +2 -2
- package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
- package/dist/deploy/freedesktop/copyright.js +105 -14
- package/dist/deploy/freedesktop/copyright.js.map +1 -1
- package/dist/deploy/install-hints.d.ts.map +1 -1
- package/dist/deploy/install-hints.js +7 -4
- package/dist/deploy/install-hints.js.map +1 -1
- package/dist/deploy/node-runtime/download.d.ts +5 -1
- package/dist/deploy/node-runtime/download.d.ts.map +1 -1
- package/dist/deploy/node-runtime/download.js +6 -3
- package/dist/deploy/node-runtime/download.js.map +1 -1
- package/dist/deploy/node-runtime/index.d.ts +2 -1
- package/dist/deploy/node-runtime/index.d.ts.map +1 -1
- package/dist/deploy/node-runtime/index.js +10 -9
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/license.d.ts +4 -0
- package/dist/deploy/node-runtime/license.d.ts.map +1 -0
- package/dist/deploy/node-runtime/license.js +19 -0
- package/dist/deploy/node-runtime/license.js.map +1 -0
- package/dist/deploy/notices/collect.d.ts +8 -0
- package/dist/deploy/notices/collect.d.ts.map +1 -0
- package/dist/deploy/notices/collect.js +17 -0
- package/dist/deploy/notices/collect.js.map +1 -0
- package/dist/deploy/notices/dependencies.d.ts +5 -0
- package/dist/deploy/notices/dependencies.d.ts.map +1 -0
- package/dist/deploy/notices/dependencies.js +39 -0
- package/dist/deploy/notices/dependencies.js.map +1 -0
- package/dist/deploy/notices/gtkx.d.ts +6 -0
- package/dist/deploy/notices/gtkx.d.ts.map +1 -0
- package/dist/deploy/notices/gtkx.js +68 -0
- package/dist/deploy/notices/gtkx.js.map +1 -0
- package/dist/deploy/notices/libraries.d.ts +4 -0
- package/dist/deploy/notices/libraries.d.ts.map +1 -0
- package/dist/deploy/notices/libraries.js +60 -0
- package/dist/deploy/notices/libraries.js.map +1 -0
- package/dist/deploy/notices/node-runtime.d.ts +4 -0
- package/dist/deploy/notices/node-runtime.d.ts.map +1 -0
- package/dist/deploy/notices/node-runtime.js +78 -0
- package/dist/deploy/notices/node-runtime.js.map +1 -0
- package/dist/deploy/notices/packages.d.ts +13 -0
- package/dist/deploy/notices/packages.d.ts.map +1 -0
- package/dist/deploy/notices/packages.js +115 -0
- package/dist/deploy/notices/packages.js.map +1 -0
- package/dist/deploy/notices/render.d.ts +4 -0
- package/dist/deploy/notices/render.d.ts.map +1 -0
- package/dist/deploy/notices/render.js +41 -0
- package/dist/deploy/notices/render.js.map +1 -0
- package/dist/deploy/notices/text.d.ts +5 -0
- package/dist/deploy/notices/text.d.ts.map +1 -0
- package/dist/deploy/notices/text.js +34 -0
- package/dist/deploy/notices/text.js.map +1 -0
- package/dist/deploy/payload/copy-tree.d.ts +2 -1
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
- package/dist/deploy/payload/copy-tree.js +3 -1
- package/dist/deploy/payload/copy-tree.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts +7 -3
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +25 -14
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +28 -7
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +4 -0
- package/dist/deploy/settings/extra-files.d.ts.map +1 -0
- package/dist/deploy/settings/extra-files.js +11 -0
- package/dist/deploy/settings/extra-files.js.map +1 -0
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +2 -1
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/package-manifest.d.ts +2 -0
- package/dist/deploy/settings/package-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/package-manifest.js +8 -0
- package/dist/deploy/settings/package-manifest.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +2 -1
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +1 -1
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts +3 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.js +50 -4
- package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
- package/dist/deploy/targets/flatpak-pnpm.d.ts +15 -0
- package/dist/deploy/targets/flatpak-pnpm.d.ts.map +1 -0
- package/dist/deploy/targets/flatpak-pnpm.js +69 -0
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -0
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +70 -7
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak-sources.d.ts +5 -3
- package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-sources.js +23 -9
- package/dist/deploy/targets/flatpak-sources.js.map +1 -1
- package/dist/deploy/targets/flatpak.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak.js +3 -2
- package/dist/deploy/targets/flatpak.js.map +1 -1
- package/dist/deploy/tools.d.ts +3 -1
- package/dist/deploy/tools.d.ts.map +1 -1
- package/dist/deploy/tools.js +17 -3
- package/dist/deploy/tools.js.map +1 -1
- package/dist/deploy/types.d.ts +22 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/vite-plugins/bundled-packages.d.ts +5 -0
- package/dist/vite-plugins/bundled-packages.d.ts.map +1 -0
- package/dist/vite-plugins/bundled-packages.js +63 -0
- package/dist/vite-plugins/bundled-packages.js.map +1 -0
- package/package.json +9 -9
- package/src/builder.ts +2 -0
- package/src/codegen/report.ts +4 -0
- package/src/codegen/run-codegen.ts +11 -1
- package/src/commands/docs.ts +1 -0
- package/src/deploy/freedesktop/copyright.ts +153 -18
- package/src/deploy/install-hints.ts +9 -6
- package/src/deploy/node-runtime/download.ts +13 -4
- package/src/deploy/node-runtime/index.ts +17 -11
- package/src/deploy/node-runtime/license.ts +24 -0
- package/src/deploy/notices/collect.ts +26 -0
- package/src/deploy/notices/dependencies.ts +53 -0
- package/src/deploy/notices/gtkx.ts +92 -0
- package/src/deploy/notices/libraries.ts +81 -0
- package/src/deploy/notices/node-runtime.ts +101 -0
- package/src/deploy/notices/packages.ts +168 -0
- package/src/deploy/notices/render.ts +52 -0
- package/src/deploy/notices/text.ts +42 -0
- package/src/deploy/payload/copy-tree.ts +5 -1
- package/src/deploy/payload/stage.ts +40 -16
- package/src/deploy/run-deploy.ts +34 -6
- package/src/deploy/settings/extra-files.ts +21 -0
- package/src/deploy/settings/index.ts +2 -1
- package/src/deploy/settings/package-manifest.ts +12 -0
- package/src/deploy/settings/paths.ts +1 -1
- package/src/deploy/targets/flatpak-manifest.ts +69 -4
- package/src/deploy/targets/flatpak-pnpm.ts +115 -0
- package/src/deploy/targets/flatpak-source.ts +105 -6
- package/src/deploy/targets/flatpak-sources.ts +36 -9
- package/src/deploy/targets/flatpak.ts +3 -2
- package/src/deploy/tools.ts +23 -2
- package/src/deploy/types.ts +27 -1
- package/src/vite-plugins/bundled-packages.ts +95 -0
- package/LICENSE +0 -373
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { isRecord, sortStringsBy, warn } from "@gtkx/utils";
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { BUNDLED_PACKAGES_FILENAME } from "../../vite-plugins/bundled-packages.js";
|
|
5
|
+
import { readPackageManifest } from "../settings/package-manifest.js";
|
|
6
|
+
import { copyrightLines, licenseTextIn } from "./text.js";
|
|
7
|
+
const MANIFEST_FILENAME = "package.json";
|
|
8
|
+
const GIT_PREFIX = /^git\+/;
|
|
9
|
+
const GIT_SUFFIX = /\.git$/;
|
|
10
|
+
const GIT_SCHEME = /^git:\/\//;
|
|
11
|
+
const GITHUB_SLUG = /^(?:github:)?(?<slug>[\w.-]+\/[\w.-]+)$/;
|
|
12
|
+
const realPath = (path) => {
|
|
13
|
+
try {
|
|
14
|
+
return realpathSync(path);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return path;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const optionalString = (value) => (typeof value === "string" ? value : null);
|
|
21
|
+
const recordedPackage = (entry) => {
|
|
22
|
+
if (!isRecord(entry) || typeof entry.name !== "string" || typeof entry.dir !== "string") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return { name: entry.name, version: optionalString(entry.version), dir: entry.dir };
|
|
26
|
+
};
|
|
27
|
+
const recordedList = (value) => {
|
|
28
|
+
if (!Array.isArray(value)) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const entries = value;
|
|
32
|
+
return entries.map((entry) => recordedPackage(entry)).filter((entry) => entry !== null);
|
|
33
|
+
};
|
|
34
|
+
const readRecordedPackages = (settings) => {
|
|
35
|
+
const path = join(settings.paths.dist, BUNDLED_PACKAGES_FILENAME);
|
|
36
|
+
if (!existsSync(path)) {
|
|
37
|
+
throw new Error(`Cannot deploy: ${path} is missing. Run \`gtkx build\` first.`);
|
|
38
|
+
}
|
|
39
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
40
|
+
return recordedList(isRecord(parsed) ? parsed.packages : null);
|
|
41
|
+
};
|
|
42
|
+
const authorLine = (manifest) => {
|
|
43
|
+
const { name, email } = manifest.author;
|
|
44
|
+
if (name === null) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
return [email === null ? name : `${name} <${email}>`];
|
|
48
|
+
};
|
|
49
|
+
const sourceUrl = (manifest) => {
|
|
50
|
+
const configured = manifest.repository ?? manifest.homepage;
|
|
51
|
+
if (configured === null) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const url = configured.replace(GIT_PREFIX, "").replace(GIT_SUFFIX, "").replace(GIT_SCHEME, "https://");
|
|
55
|
+
const slug = GITHUB_SLUG.exec(url)?.groups?.slug;
|
|
56
|
+
if (slug !== undefined) {
|
|
57
|
+
return `https://github.com/${slug}`;
|
|
58
|
+
}
|
|
59
|
+
return url.startsWith("http") ? url : null;
|
|
60
|
+
};
|
|
61
|
+
const missingPackage = (entry) => ({
|
|
62
|
+
name: entry.name,
|
|
63
|
+
version: entry.version,
|
|
64
|
+
license: null,
|
|
65
|
+
source: null,
|
|
66
|
+
copyright: [],
|
|
67
|
+
text: null,
|
|
68
|
+
isPresent: false,
|
|
69
|
+
});
|
|
70
|
+
const packageIn = (entry, dir) => {
|
|
71
|
+
if (!existsSync(join(dir, MANIFEST_FILENAME))) {
|
|
72
|
+
return missingPackage(entry);
|
|
73
|
+
}
|
|
74
|
+
const manifest = readPackageManifest(dir);
|
|
75
|
+
const text = licenseTextIn(dir);
|
|
76
|
+
const copyright = copyrightLines(text);
|
|
77
|
+
return {
|
|
78
|
+
name: manifest.name ?? entry.name,
|
|
79
|
+
version: manifest.version ?? entry.version,
|
|
80
|
+
license: manifest.license,
|
|
81
|
+
source: sourceUrl(manifest),
|
|
82
|
+
copyright: copyright.length === 0 ? authorLine(manifest) : copyright,
|
|
83
|
+
text,
|
|
84
|
+
isPresent: true,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const keyFor = (entry) => `${entry.name}@${entry.version ?? ""}`;
|
|
88
|
+
const dedupe = (entries) => {
|
|
89
|
+
const unique = new Map();
|
|
90
|
+
for (const entry of entries) {
|
|
91
|
+
unique.set(keyFor(entry), entry);
|
|
92
|
+
}
|
|
93
|
+
return sortStringsBy(unique.values(), keyFor);
|
|
94
|
+
};
|
|
95
|
+
const warnMissing = (entries) => {
|
|
96
|
+
const missing = entries.filter((entry) => !entry.isPresent);
|
|
97
|
+
if (missing.length === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
warn(`The third-party notices name ${missing.map((entry) => keyFor(entry)).join(", ")} without any license: ` +
|
|
101
|
+
"`gtkx build` recorded where each package was installed and those directories are no longer there. " +
|
|
102
|
+
"Deploy from the tree the build ran in, or build again, so the notices carry their terms.");
|
|
103
|
+
};
|
|
104
|
+
const bundledPackages = (settings) => {
|
|
105
|
+
const root = realPath(settings.paths.root);
|
|
106
|
+
const entries = readRecordedPackages(settings)
|
|
107
|
+
.map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))
|
|
108
|
+
.filter(({ dir }) => realPath(dir) !== root)
|
|
109
|
+
.map(({ entry, dir }) => packageIn(entry, dir));
|
|
110
|
+
const bundled = dedupe(entries);
|
|
111
|
+
warnMissing(bundled);
|
|
112
|
+
return bundled;
|
|
113
|
+
};
|
|
114
|
+
export { bundledPackages };
|
|
115
|
+
//# sourceMappingURL=packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,yB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;AAEF,MAAM,eAAe,GAAG,CAAC,QAAwB,EAAoB,EAAE;IACnE,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC;SACzC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACzE,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;SAC3C,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,WAAW,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAuB,eAAe,EAAE,CAAC","sourcesContent":["import { isRecord, sortStringsBy, warn } from \"@gtkx/utils\";\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings } from \"../types.js\";\nimport { BUNDLED_PACKAGES_FILENAME } from \"../../vite-plugins/bundled-packages.js\";\nimport { type PackageManifest, readPackageManifest } from \"../settings/package-manifest.js\";\nimport { copyrightLines, licenseTextIn } from \"./text.js\";\n\ntype RecordedPackage = {\n name: string;\n version: string | null;\n dir: string;\n};\n\ntype BundledPackage = {\n name: string;\n version: string | null;\n license: string | null;\n source: string | null;\n copyright: string[];\n text: string | null;\n isPresent: boolean;\n};\n\nconst MANIFEST_FILENAME = \"package.json\";\nconst GIT_PREFIX = /^git\\+/;\nconst GIT_SUFFIX = /\\.git$/;\nconst GIT_SCHEME = /^git:\\/\\//;\nconst GITHUB_SLUG = /^(?:github:)?(?<slug>[\\w.-]+\\/[\\w.-]+)$/;\n\nconst realPath = (path: string): string => {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n};\n\nconst optionalString = (value: unknown): string | null => (typeof value === \"string\" ? value : null);\n\nconst recordedPackage = (entry: unknown): RecordedPackage | null => {\n if (!isRecord(entry) || typeof entry.name !== \"string\" || typeof entry.dir !== \"string\") {\n return null;\n }\n\n return { name: entry.name, version: optionalString(entry.version), dir: entry.dir };\n};\n\nconst recordedList = (value: unknown): RecordedPackage[] => {\n if (!Array.isArray(value)) {\n return [];\n }\n\n const entries: unknown[] = value;\n\n return entries.map((entry) => recordedPackage(entry)).filter((entry) => entry !== null);\n};\n\nconst readRecordedPackages = (settings: DeploySettings): RecordedPackage[] => {\n const path = join(settings.paths.dist, BUNDLED_PACKAGES_FILENAME);\n\n if (!existsSync(path)) {\n throw new Error(`Cannot deploy: ${path} is missing. Run \\`gtkx build\\` first.`);\n }\n\n const parsed: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n\n return recordedList(isRecord(parsed) ? parsed.packages : null);\n};\n\nconst authorLine = (manifest: PackageManifest): string[] => {\n const { name, email } = manifest.author;\n\n if (name === null) {\n return [];\n }\n\n return [email === null ? name : `${name} <${email}>`];\n};\n\nconst sourceUrl = (manifest: PackageManifest): string | null => {\n const configured = manifest.repository ?? manifest.homepage;\n\n if (configured === null) {\n return null;\n }\n\n const url = configured.replace(GIT_PREFIX, \"\").replace(GIT_SUFFIX, \"\").replace(GIT_SCHEME, \"https://\");\n const slug = GITHUB_SLUG.exec(url)?.groups?.slug;\n\n if (slug !== undefined) {\n return `https://github.com/${slug}`;\n }\n\n return url.startsWith(\"http\") ? url : null;\n};\n\nconst missingPackage = (entry: RecordedPackage): BundledPackage => ({\n name: entry.name,\n version: entry.version,\n license: null,\n source: null,\n copyright: [],\n text: null,\n isPresent: false,\n});\n\nconst packageIn = (entry: RecordedPackage, dir: string): BundledPackage => {\n if (!existsSync(join(dir, MANIFEST_FILENAME))) {\n return missingPackage(entry);\n }\n\n const manifest = readPackageManifest(dir);\n const text = licenseTextIn(dir);\n const copyright = copyrightLines(text);\n\n return {\n name: manifest.name ?? entry.name,\n version: manifest.version ?? entry.version,\n license: manifest.license,\n source: sourceUrl(manifest),\n copyright: copyright.length === 0 ? authorLine(manifest) : copyright,\n text,\n isPresent: true,\n };\n};\n\nconst keyFor = (entry: BundledPackage): string => `${entry.name}@${entry.version ?? \"\"}`;\n\nconst dedupe = (entries: BundledPackage[]): BundledPackage[] => {\n const unique: Map<string, BundledPackage> = new Map();\n\n for (const entry of entries) {\n unique.set(keyFor(entry), entry);\n }\n\n return sortStringsBy(unique.values(), keyFor);\n};\n\nconst warnMissing = (entries: BundledPackage[]): void => {\n const missing = entries.filter((entry) => !entry.isPresent);\n\n if (missing.length === 0) {\n return;\n }\n\n warn(\n `The third-party notices name ${missing.map((entry) => keyFor(entry)).join(\", \")} without any license: ` +\n \"`gtkx build` recorded where each package was installed and those directories are no longer there. \" +\n \"Deploy from the tree the build ran in, or build again, so the notices carry their terms.\",\n );\n};\n\nconst bundledPackages = (settings: DeploySettings): BundledPackage[] => {\n const root = realPath(settings.paths.root);\n\n const entries = readRecordedPackages(settings)\n .map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))\n .filter(({ dir }) => realPath(dir) !== root)\n .map(({ entry, dir }) => packageIn(entry, dir));\n\n const bundled = dedupe(entries);\n warnMissing(bundled);\n\n return bundled;\n};\n\nexport { type BundledPackage, bundledPackages };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,aAAa,EAAE,MAAM,aAAa,CAAC;AAgDzE,QAAA,MAAM,aAAa,GAAI,UAAU,cAAc,EAAE,UAAU,aAAa,EAAE,KAAG,MAC2B,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const RULE_WIDTH = 100;
|
|
2
|
+
const HEADING = "THIRD-PARTY NOTICES";
|
|
3
|
+
const SECTION_RULE = "=".repeat(RULE_WIDTH);
|
|
4
|
+
const NOTICE_RULE = "-".repeat(RULE_WIDTH);
|
|
5
|
+
const FILE_SEPARATOR = ", ";
|
|
6
|
+
const introFor = (settings) => [
|
|
7
|
+
HEADING,
|
|
8
|
+
`${settings.name} ${settings.versions.upstream}`,
|
|
9
|
+
"",
|
|
10
|
+
`This file lists the software that ships inside ${settings.name} without having been written by its`,
|
|
11
|
+
"authors, and the terms each piece of it is distributed under.",
|
|
12
|
+
];
|
|
13
|
+
const headerFor = (section) => [
|
|
14
|
+
SECTION_RULE,
|
|
15
|
+
section.title,
|
|
16
|
+
...(section.files.length === 0 ? [] : [`Files: ${section.files.join(FILE_SEPARATOR)}`]),
|
|
17
|
+
SECTION_RULE,
|
|
18
|
+
"",
|
|
19
|
+
];
|
|
20
|
+
const detailLines = (notice) => [
|
|
21
|
+
`License: ${notice.license}`,
|
|
22
|
+
...(notice.source === null ? [] : [`Source: ${notice.source}`]),
|
|
23
|
+
];
|
|
24
|
+
const bodyLines = (notice) => notice.text === null ? notice.copyright : ["", notice.text];
|
|
25
|
+
const renderNotice = (notice) => [
|
|
26
|
+
NOTICE_RULE,
|
|
27
|
+
notice.subject,
|
|
28
|
+
...detailLines(notice),
|
|
29
|
+
NOTICE_RULE,
|
|
30
|
+
...bodyLines(notice),
|
|
31
|
+
"",
|
|
32
|
+
];
|
|
33
|
+
const renderSection = (section) => [
|
|
34
|
+
...headerFor(section),
|
|
35
|
+
...section.summary,
|
|
36
|
+
"",
|
|
37
|
+
...section.notices.flatMap((notice) => renderNotice(notice)),
|
|
38
|
+
];
|
|
39
|
+
const renderNotices = (settings, sections) => [...introFor(settings), "", ...sections.flatMap((section) => renderSection(section)), ""].join("\n");
|
|
40
|
+
export { renderNotices };
|
|
41
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/deploy/notices/render.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,OAAO,GAAG,qBAAqB,CAAC;AACtC,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC5C,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,QAAQ,GAAG,CAAC,QAAwB,EAAY,EAAE,CAAC;IACrD,OAAO;IACP,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE;IAChD,EAAE;IACF,kDAAkD,QAAQ,CAAC,IAAI,qCAAqC;IACpG,+DAA+D;CAClE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAsB,EAAY,EAAE,CAAC;IACpD,YAAY;IACZ,OAAO,CAAC,KAAK;IACb,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACvF,YAAY;IACZ,EAAE;CACL,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAY,EAAE,CAAC;IAC9C,YAAY,MAAM,CAAC,OAAO,EAAE;IAC5B,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAc,EAAY,EAAE,CAC3C,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhE,MAAM,YAAY,GAAG,CAAC,MAAc,EAAY,EAAE,CAAC;IAC/C,WAAW;IACX,MAAM,CAAC,OAAO;IACd,GAAG,WAAW,CAAC,MAAM,CAAC;IACtB,WAAW;IACX,GAAG,SAAS,CAAC,MAAM,CAAC;IACpB,EAAE;CACL,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,OAAsB,EAAY,EAAE,CAAC;IACxD,GAAG,SAAS,CAAC,OAAO,CAAC;IACrB,GAAG,OAAO,CAAC,OAAO;IAClB,EAAE;IACF,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAE,QAAyB,EAAU,EAAE,CAClF,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import type { DeploySettings, Notice, NoticeSection } from \"../types.js\";\n\nconst RULE_WIDTH = 100;\nconst HEADING = \"THIRD-PARTY NOTICES\";\nconst SECTION_RULE = \"=\".repeat(RULE_WIDTH);\nconst NOTICE_RULE = \"-\".repeat(RULE_WIDTH);\nconst FILE_SEPARATOR = \", \";\n\nconst introFor = (settings: DeploySettings): string[] => [\n HEADING,\n `${settings.name} ${settings.versions.upstream}`,\n \"\",\n `This file lists the software that ships inside ${settings.name} without having been written by its`,\n \"authors, and the terms each piece of it is distributed under.\",\n];\n\nconst headerFor = (section: NoticeSection): string[] => [\n SECTION_RULE,\n section.title,\n ...(section.files.length === 0 ? [] : [`Files: ${section.files.join(FILE_SEPARATOR)}`]),\n SECTION_RULE,\n \"\",\n];\n\nconst detailLines = (notice: Notice): string[] => [\n `License: ${notice.license}`,\n ...(notice.source === null ? [] : [`Source: ${notice.source}`]),\n];\n\nconst bodyLines = (notice: Notice): string[] =>\n notice.text === null ? notice.copyright : [\"\", notice.text];\n\nconst renderNotice = (notice: Notice): string[] => [\n NOTICE_RULE,\n notice.subject,\n ...detailLines(notice),\n NOTICE_RULE,\n ...bodyLines(notice),\n \"\",\n];\n\nconst renderSection = (section: NoticeSection): string[] => [\n ...headerFor(section),\n ...section.summary,\n \"\",\n ...section.notices.flatMap((notice) => renderNotice(notice)),\n];\n\nconst renderNotices = (settings: DeploySettings, sections: NoticeSection[]): string =>\n [...introFor(settings), \"\", ...sections.flatMap((section) => renderSection(section)), \"\"].join(\"\\n\");\n\nexport { renderNotices };\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const readLicenseText: (path: string) => string | null;
|
|
2
|
+
declare const licenseTextIn: (dir: string) => string | null;
|
|
3
|
+
declare const copyrightLines: (text: string | null) => string[];
|
|
4
|
+
export { copyrightLines, licenseTextIn, readLicenseText };
|
|
5
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/text.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAMhD,CAAC;AAQF,QAAA,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAM7C,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,IAAI,KAAG,MAAM,EASnD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const LICENSE_FILE = /^(?:licen[cs]e|copying|notice)(?:[-._].*)?$/i;
|
|
4
|
+
const COPYRIGHT_LINE = /^(?:Copyright\b|©)/;
|
|
5
|
+
const MAX_COPYRIGHT_LINES = 20;
|
|
6
|
+
const MORE_COPYRIGHT = "and the other holders named in the license text";
|
|
7
|
+
const readLicenseText = (path) => {
|
|
8
|
+
try {
|
|
9
|
+
return readFileSync(path, "utf8").trimEnd();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const licenseFilesIn = (dir) => readdirSync(dir, { withFileTypes: true })
|
|
16
|
+
.filter((entry) => entry.isFile() && LICENSE_FILE.test(entry.name))
|
|
17
|
+
.map((entry) => entry.name)
|
|
18
|
+
.toSorted((left, right) => left.localeCompare(right));
|
|
19
|
+
const licenseTextIn = (dir) => {
|
|
20
|
+
const texts = licenseFilesIn(dir)
|
|
21
|
+
.map((name) => readLicenseText(join(dir, name)))
|
|
22
|
+
.filter((text) => text !== null);
|
|
23
|
+
return texts.length === 0 ? null : texts.join("\n\n");
|
|
24
|
+
};
|
|
25
|
+
const copyrightLines = (text) => {
|
|
26
|
+
const found = (text ?? "")
|
|
27
|
+
.split("\n")
|
|
28
|
+
.map((line) => line.trim())
|
|
29
|
+
.filter((line) => COPYRIGHT_LINE.test(line));
|
|
30
|
+
const unique = [...new Set(found)];
|
|
31
|
+
return unique.length > MAX_COPYRIGHT_LINES ? [...unique.slice(0, MAX_COPYRIGHT_LINES), MORE_COPYRIGHT] : unique;
|
|
32
|
+
};
|
|
33
|
+
export { copyrightLines, licenseTextIn, readLicenseText };
|
|
34
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAErC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAY,EAAE;IACrD,MAAM,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;SACrB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACpH,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst LICENSE_FILE = /^(?:licen[cs]e|copying|notice)(?:[-._].*)?$/i;\nconst COPYRIGHT_LINE = /^(?:Copyright\\b|©)/;\nconst MAX_COPYRIGHT_LINES = 20;\nconst MORE_COPYRIGHT = \"and the other holders named in the license text\";\n\nconst readLicenseText = (path: string): string | null => {\n try {\n return readFileSync(path, \"utf8\").trimEnd();\n } catch {\n return null;\n }\n};\n\nconst licenseFilesIn = (dir: string): string[] =>\n readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isFile() && LICENSE_FILE.test(entry.name))\n .map((entry) => entry.name)\n .toSorted((left, right) => left.localeCompare(right));\n\nconst licenseTextIn = (dir: string): string | null => {\n const texts = licenseFilesIn(dir)\n .map((name) => readLicenseText(join(dir, name)))\n .filter((text) => text !== null);\n\n return texts.length === 0 ? null : texts.join(\"\\n\\n\");\n};\n\nconst copyrightLines = (text: string | null): string[] => {\n const found = (text ?? \"\")\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => COPYRIGHT_LINE.test(line));\n\n const unique = [...new Set(found)];\n\n return unique.length > MAX_COPYRIGHT_LINES ? [...unique.slice(0, MAX_COPYRIGHT_LINES), MORE_COPYRIGHT] : unique;\n};\n\nexport { copyrightLines, licenseTextIn, readLicenseText };\n"]}
|
|
@@ -2,6 +2,7 @@ import type { StagedFile } from "../types.js";
|
|
|
2
2
|
declare const EXECUTABLE_MODE = 493;
|
|
3
3
|
declare const copyInto: (root: string, rel: string, source: string, mode?: number) => StagedFile;
|
|
4
4
|
declare const writeInto: (root: string, rel: string, contents: string, mode?: number) => StagedFile;
|
|
5
|
+
declare const executableModeFor: (path: string) => number;
|
|
5
6
|
declare const copyTree: (root: string, relBase: string, sourceDir: string) => StagedFile[];
|
|
6
|
-
export { copyInto, copyTree, EXECUTABLE_MODE, writeInto };
|
|
7
|
+
export { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };
|
|
7
8
|
//# sourceMappingURL=copy-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;AA8B9B,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,aAAmB,KAAG,UAG7E,CAAC;AAEP,QAAA,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,MAAM,EAAE,aAAoB,KAAG,UAGjF,CAAC;AAIP,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MACmC,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,UAAU,EAEwB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -5,6 +5,7 @@ const EXECUTABLE_MODE = 0o755;
|
|
|
5
5
|
const READABLE_MODE = 0o644;
|
|
6
6
|
const EXECUTABLE_SUFFIXES = [".node", ".so"];
|
|
7
7
|
const MODE_MASK = 0o7777;
|
|
8
|
+
const EXECUTE_MASK = 0o111;
|
|
8
9
|
const modeFor = (rel) => {
|
|
9
10
|
const name = rel.split("/").at(-1) ?? rel;
|
|
10
11
|
return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;
|
|
@@ -30,7 +31,8 @@ const writeInto = (root, rel, contents, mode = READABLE_MODE) => placeFile(root,
|
|
|
30
31
|
writeFileSync(target, contents);
|
|
31
32
|
});
|
|
32
33
|
const sourceMode = (path) => statSync(path).mode & MODE_MASK;
|
|
34
|
+
const executableModeFor = (path) => (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;
|
|
33
35
|
const copyTree = (root, relBase, sourceDir) => listFilesRecursive(sourceDir)
|
|
34
36
|
.map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));
|
|
35
|
-
export { copyInto, copyTree, EXECUTABLE_MODE, writeInto };
|
|
37
|
+
export { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };
|
|
36
38
|
//# sourceMappingURL=copy-tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-tree.js","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-tree.js","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,OAAO,GA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I,GAAG,OAAO,CAAC,GAAG,CAAC,EAAc,EAAE,CAC5F,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;IAClC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEP,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,QAAgB,EAAE,IAAI,GAAG,aAAa,EAAc,EAAE,CAChG,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE;IAClC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC;AAEP,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7E,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/C,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC;AAE9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAgB,EAAE,CAChF,kBAAkB,CAAC,SAAS,CAAC;KACxB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative } from \"node:path\";\nimport type { StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\n\nconst EXECUTABLE_MODE = 0o755;\nconst READABLE_MODE = 0o644;\nconst EXECUTABLE_SUFFIXES = [\".node\", \".so\"];\nconst MODE_MASK = 0o7777;\nconst EXECUTE_MASK = 0o111;\n\nconst modeFor = (rel: string): number => {\n const name = rel.split(\"/\").at(-1) ?? rel;\n\n return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;\n};\n\nconst assertInsideRoot = (root: string, rel: string, abs: string): void => {\n const escape = relative(root, abs);\n\n if (escape.length === 0 || escape.startsWith(\"..\") || isAbsolute(escape)) {\n throw new Error(`Cannot stage \"${rel}\": it resolves outside the staging directory`);\n }\n};\n\nconst placeFile = (root: string, rel: string, mode: number, write: (target: string) => void): StagedFile => {\n const abs = join(root, rel);\n assertInsideRoot(root, rel, abs);\n mkdirSync(dirname(abs), { recursive: true });\n write(abs);\n chmodSync(abs, mode);\n\n return { rel, abs, mode };\n};\n\nconst copyInto = (root: string, rel: string, source: string, mode = modeFor(rel)): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n copyFileSync(source, target);\n });\n\nconst writeInto = (root: string, rel: string, contents: string, mode = READABLE_MODE): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n writeFileSync(target, contents);\n });\n\nconst sourceMode = (path: string): number => statSync(path).mode & MODE_MASK;\n\nconst executableModeFor = (path: string): number =>\n (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;\n\nconst copyTree = (root: string, relBase: string, sourceDir: string): StagedFile[] =>\n listFilesRecursive(sourceDir)\n .map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));\n\nexport { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeploySettings, DeployTargetName, NodeRuntime, StagedFile } from "../types.js";
|
|
1
|
+
import type { DeploySettings, DeployTargetName, NodeRuntime, NoticeSection, StagedFile } from "../types.js";
|
|
2
2
|
type StageRequest = {
|
|
3
3
|
settings: DeploySettings;
|
|
4
4
|
node: NodeRuntime | null;
|
|
@@ -9,7 +9,11 @@ type StagedMetadata = {
|
|
|
9
9
|
metainfo: string;
|
|
10
10
|
mimePackage: string | null;
|
|
11
11
|
};
|
|
12
|
+
declare const NOTICES_FILENAME = "THIRD-PARTY-NOTICES";
|
|
13
|
+
declare const licenseDestination: (settings: DeploySettings) => string;
|
|
14
|
+
declare const noticesDestination: (settings: DeploySettings) => string;
|
|
15
|
+
declare const nodeLicenseDestination: (settings: DeploySettings) => string;
|
|
12
16
|
declare const stagePayload: ({ settings, node, metadata }: StageRequest) => StagedFile[];
|
|
13
|
-
declare const stageOverlays: (settings: DeploySettings) => Record<DeployTargetName, StagedFile[]>;
|
|
14
|
-
export { type StagedMetadata, stageOverlays, stagePayload };
|
|
17
|
+
declare const stageOverlays: (settings: DeploySettings, notices: NoticeSection[]) => Record<DeployTargetName, StagedFile[]>;
|
|
18
|
+
export { licenseDestination, nodeLicenseDestination, NOTICES_FILENAME, noticesDestination, type StagedMetadata, stageOverlays, stagePayload, };
|
|
15
19
|
//# sourceMappingURL=stage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAa5G,KAAK,YAAY,GAAG;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAGF,QAAA,MAAM,gBAAgB,wBAAwB,CAAC;AAkB/C,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA8C,CAAC;AACtG,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA0D,CAAC;AAIlH,QAAA,MAAM,sBAAsB,GAAI,UAAU,cAAc,KAAG,MACe,CAAC;AA0C3E,QAAA,MAAM,YAAY,GAAI,8BAA8B,YAAY,KAAG,UAAU,EAa5E,CAAC;AA0CF,QAAA,MAAM,aAAa,GACf,UAAU,cAAc,EACxB,SAAS,aAAa,EAAE,KACzB,MAAM,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAKtC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,cAAc,EACnB,aAAa,EACb,YAAY,GACf,CAAC"}
|
|
@@ -2,15 +2,19 @@ import { sortStringsBy } from "@gtkx/utils";
|
|
|
2
2
|
import { existsSync, rmSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { listFilesRecursive } from "../../internal/list-files.js";
|
|
5
|
+
import { BUNDLED_PACKAGES_FILENAME } from "../../vite-plugins/bundled-packages.js";
|
|
5
6
|
import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
|
|
6
7
|
import { renderCopyright } from "../freedesktop/copyright.js";
|
|
7
8
|
import { renderDbusService } from "../freedesktop/dbus-service.js";
|
|
8
9
|
import { renderDesktopEntry } from "../freedesktop/desktop-entry.js";
|
|
9
|
-
import {
|
|
10
|
+
import { renderNotices } from "../notices/render.js";
|
|
11
|
+
import { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from "./copy-tree.js";
|
|
10
12
|
import { stageIcons } from "./icons.js";
|
|
11
13
|
import { NODE_FILENAME, renderLauncher } from "./launcher.js";
|
|
12
14
|
import { stageSchemas } from "./schemas.js";
|
|
13
15
|
const DIST_ICONS_DIR = "icons";
|
|
16
|
+
const NOTICES_FILENAME = "THIRD-PARTY-NOTICES";
|
|
17
|
+
const NODE_LICENSE_FILENAME = "LICENSE";
|
|
14
18
|
const SHARE_APPLICATIONS = "share/applications";
|
|
15
19
|
const SHARE_METAINFO = "share/metainfo";
|
|
16
20
|
const SHARE_MIME_PACKAGES = "share/mime/packages";
|
|
@@ -24,14 +28,19 @@ const PREFIX_FOR = {
|
|
|
24
28
|
rpm: "/usr",
|
|
25
29
|
};
|
|
26
30
|
const libDirFor = (settings) => `lib/${settings.binaryName}`;
|
|
31
|
+
const licenseDirFor = (settings) => `${SHARE_LICENSES}/${settings.binaryName}`;
|
|
32
|
+
const licenseDestination = (settings) => `${licenseDirFor(settings)}/LICENSE`;
|
|
33
|
+
const noticesDestination = (settings) => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;
|
|
27
34
|
const isIconAsset = (rel) => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);
|
|
35
|
+
const isBuildMetadata = (rel) => rel === BUNDLED_PACKAGES_FILENAME;
|
|
36
|
+
const nodeLicenseDestination = (settings) => `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;
|
|
28
37
|
const stageRuntimeFiles = (settings, root) => {
|
|
29
38
|
const dist = settings.paths.dist;
|
|
30
39
|
if (!existsSync(join(dist, BUNDLE_FILENAME))) {
|
|
31
40
|
throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \`gtkx build\` first.`);
|
|
32
41
|
}
|
|
33
42
|
return listFilesRecursive(dist)
|
|
34
|
-
.filter((file) => !isIconAsset(file.rel))
|
|
43
|
+
.filter((file) => !isIconAsset(file.rel) && !isBuildMetadata(file.rel))
|
|
35
44
|
.map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));
|
|
36
45
|
};
|
|
37
46
|
const stageNodeBinary = (settings, root, node) => node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];
|
|
@@ -42,7 +51,10 @@ const stageMetadata = (settings, root, metadata) => [
|
|
|
42
51
|
? []
|
|
43
52
|
: [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),
|
|
44
53
|
];
|
|
45
|
-
const stageExtraFiles = (settings, root) =>
|
|
54
|
+
const stageExtraFiles = (settings, root) => settings.extraFiles.map((file) => {
|
|
55
|
+
const source = resolve(settings.paths.root, file.source);
|
|
56
|
+
return copyInto(root, file.destination, source, file.mode ?? executableModeFor(source));
|
|
57
|
+
});
|
|
46
58
|
const byRelativePath = (files) => {
|
|
47
59
|
const latest = new Map();
|
|
48
60
|
for (const file of files) {
|
|
@@ -72,7 +84,7 @@ const stageActivation = (settings, root, target) => {
|
|
|
72
84
|
}
|
|
73
85
|
return [writeInto(root, join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`), renderDbusService(settings, PREFIX_FOR[target]))];
|
|
74
86
|
};
|
|
75
|
-
const stageOverlay = (settings, target) => {
|
|
87
|
+
const stageOverlay = (settings, target, notices) => {
|
|
76
88
|
const root = join(settings.paths.overlay, target);
|
|
77
89
|
rmSync(root, { recursive: true, force: true, maxRetries: 5 });
|
|
78
90
|
const licenseFile = settings.paths.licenseFile;
|
|
@@ -80,21 +92,20 @@ const stageOverlay = (settings, target) => {
|
|
|
80
92
|
if (target === "deb") {
|
|
81
93
|
return [
|
|
82
94
|
...activation,
|
|
83
|
-
writeInto(root, join(SHARE_DOC, settings.binaryName, "copyright"), renderCopyright(settings)),
|
|
95
|
+
writeInto(root, join(SHARE_DOC, settings.binaryName, "copyright"), renderCopyright(settings, notices)),
|
|
84
96
|
];
|
|
85
97
|
}
|
|
86
98
|
return [
|
|
87
99
|
...activation,
|
|
88
|
-
...(licenseFile === null
|
|
89
|
-
|
|
90
|
-
: [copyInto(root, join(SHARE_LICENSES, settings.binaryName, "LICENSE"), licenseFile)]),
|
|
100
|
+
...(licenseFile === null ? [] : [copyInto(root, licenseDestination(settings), licenseFile)]),
|
|
101
|
+
writeInto(root, noticesDestination(settings), renderNotices(settings, notices)),
|
|
91
102
|
];
|
|
92
103
|
};
|
|
93
|
-
const stageOverlays = (settings) => ({
|
|
94
|
-
appimage: stageOverlay(settings, "appimage"),
|
|
95
|
-
deb: stageOverlay(settings, "deb"),
|
|
96
|
-
flatpak: stageOverlay(settings, "flatpak"),
|
|
97
|
-
rpm: stageOverlay(settings, "rpm"),
|
|
104
|
+
const stageOverlays = (settings, notices) => ({
|
|
105
|
+
appimage: stageOverlay(settings, "appimage", notices),
|
|
106
|
+
deb: stageOverlay(settings, "deb", notices),
|
|
107
|
+
flatpak: stageOverlay(settings, "flatpak", notices),
|
|
108
|
+
rpm: stageOverlay(settings, "rpm", notices),
|
|
98
109
|
});
|
|
99
|
-
export { stageOverlays, stagePayload };
|
|
110
|
+
export { licenseDestination, nodeLicenseDestination, NOTICES_FILENAME, noticesDestination, stageOverlays, stagePayload, };
|
|
100
111
|
//# sourceMappingURL=stage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe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AC;IAC9D,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC;IAC/C,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAE3D,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO;YACH,GAAG,UAAU;YACb,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;SAChG,CAAC;IACN,CAAC;IAED,OAAO;QACH,GAAG,UAAU;QACb,GAAG,CAAC,WAAW,KAAK,IAAI;YACpB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;KAC7F,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,QAAwB,EAA0C,EAAE,CAAC,CAAC;IACzF,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC5C,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;IAClC,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC1C,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC;CACrC,CAAC,CAAC;AAEH,OAAO,EAAuB,aAAa,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { sortStringsBy } from \"@gtkx/utils\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings, DeployTargetName, NodeRuntime, StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\nimport { renderCopyright } from \"../freedesktop/copyright.js\";\nimport { renderDbusService } from \"../freedesktop/dbus-service.js\";\nimport { renderDesktopEntry } from \"../freedesktop/desktop-entry.js\";\nimport { copyInto, EXECUTABLE_MODE, writeInto } from \"./copy-tree.js\";\nimport { stageIcons } from \"./icons.js\";\nimport { NODE_FILENAME, renderLauncher } from \"./launcher.js\";\nimport { stageSchemas } from \"./schemas.js\";\n\ntype StageRequest = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n metadata: StagedMetadata;\n};\n\ntype StagedMetadata = {\n desktopEntry: string;\n metainfo: string;\n mimePackage: string | null;\n};\n\nconst DIST_ICONS_DIR = \"icons\";\nconst SHARE_APPLICATIONS = \"share/applications\";\nconst SHARE_METAINFO = \"share/metainfo\";\nconst SHARE_MIME_PACKAGES = \"share/mime/packages\";\nconst SHARE_DOC = \"share/doc\";\nconst SHARE_LICENSES = \"share/licenses\";\nconst SHARE_DBUS_SERVICES = \"share/dbus-1/services\";\n\nconst PREFIX_FOR: Record<DeployTargetName, string> = {\n appimage: \"/usr\",\n deb: \"/usr\",\n flatpak: \"/app\",\n rpm: \"/usr\",\n};\n\nconst libDirFor = (settings: DeploySettings): string => `lib/${settings.binaryName}`;\nconst isIconAsset = (rel: string): boolean => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);\n\nconst stageRuntimeFiles = (settings: DeploySettings, root: string): StagedFile[] => {\n const dist = settings.paths.dist;\n\n if (!existsSync(join(dist, BUNDLE_FILENAME))) {\n throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \\`gtkx build\\` first.`);\n }\n\n return listFilesRecursive(dist)\n .filter((file) => !isIconAsset(file.rel))\n .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));\n};\n\nconst stageNodeBinary = (settings: DeploySettings, root: string, node: NodeRuntime | null): StagedFile[] =>\n node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];\n\nconst stageMetadata = (settings: DeploySettings, root: string, metadata: StagedMetadata): StagedFile[] => [\n writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), metadata.desktopEntry),\n writeInto(root, join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`), metadata.metainfo),\n ...(metadata.mimePackage === null\n ? []\n : [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),\n];\n\nconst stageExtraFiles = (settings: DeploySettings, root: string): StagedFile[] =>\n Object.entries(settings.extraFiles).map(([destination, source]) =>\n copyInto(root, destination, resolve(settings.paths.root, source)));\n\nconst byRelativePath = (files: StagedFile[]): StagedFile[] => {\n const latest: Map<string, StagedFile> = new Map();\n\n for (const file of files) {\n latest.set(file.rel, file);\n }\n\n return sortStringsBy(latest.values(), (file) => file.rel);\n};\n\nconst stagePayload = ({ settings, node, metadata }: StageRequest): StagedFile[] => {\n const root = settings.paths.stage;\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n\n return byRelativePath([\n writeInto(root, join(\"bin\", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),\n ...stageNodeBinary(settings, root, node),\n ...stageRuntimeFiles(settings, root),\n ...stageMetadata(settings, root, metadata),\n ...stageIcons(settings, root),\n ...stageSchemas(settings, root),\n ...stageExtraFiles(settings, root),\n ]);\n};\n\nconst stageActivation = (settings: DeploySettings, root: string, target: DeployTargetName): StagedFile[] => {\n if (!settings.isDbusActivatable) {\n return [];\n }\n\n if (target === \"appimage\") {\n return [writeInto(\n root,\n join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`),\n renderDesktopEntry({ ...settings, isDbusActivatable: false }),\n )];\n }\n\n return [writeInto(\n root,\n join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`),\n renderDbusService(settings, PREFIX_FOR[target]),\n )];\n};\n\nconst stageOverlay = (settings: DeploySettings, target: DeployTargetName): StagedFile[] => {\n const root = join(settings.paths.overlay, target);\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n const licenseFile = settings.paths.licenseFile;\n const activation = stageActivation(settings, root, target);\n\n if (target === \"deb\") {\n return [\n ...activation,\n writeInto(root, join(SHARE_DOC, settings.binaryName, \"copyright\"), renderCopyright(settings)),\n ];\n }\n\n return [\n ...activation,\n ...(licenseFile === null\n ? []\n : [copyInto(root, join(SHARE_LICENSES, settings.binaryName, \"LICENSE\"), licenseFile)]),\n ];\n};\n\nconst stageOverlays = (settings: DeploySettings): Record<DeployTargetName, StagedFile[]> => ({\n appimage: stageOverlay(settings, \"appimage\"),\n deb: stageOverlay(settings, \"deb\"),\n flatpak: stageOverlay(settings, \"flatpak\"),\n rpm: stageOverlay(settings, \"rpm\"),\n});\n\nexport { type StagedMetadata, stageOverlays, stagePayload };\n"]}
|
|
1
|
+
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC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AC;IAC1C,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC;IACrD,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;IAC3C,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;IACnD,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;CAC9C,CAAC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAElB,aAAa,EACb,YAAY,GACf,CAAC","sourcesContent":["import { sortStringsBy } from \"@gtkx/utils\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings, DeployTargetName, NodeRuntime, NoticeSection, StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\nimport { BUNDLED_PACKAGES_FILENAME } from \"../../vite-plugins/bundled-packages.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\nimport { renderCopyright } from \"../freedesktop/copyright.js\";\nimport { renderDbusService } from \"../freedesktop/dbus-service.js\";\nimport { renderDesktopEntry } from \"../freedesktop/desktop-entry.js\";\nimport { renderNotices } from \"../notices/render.js\";\nimport { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from \"./copy-tree.js\";\nimport { stageIcons } from \"./icons.js\";\nimport { NODE_FILENAME, renderLauncher } from \"./launcher.js\";\nimport { stageSchemas } from \"./schemas.js\";\n\ntype StageRequest = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n metadata: StagedMetadata;\n};\n\ntype StagedMetadata = {\n desktopEntry: string;\n metainfo: string;\n mimePackage: string | null;\n};\n\nconst DIST_ICONS_DIR = \"icons\";\nconst NOTICES_FILENAME = \"THIRD-PARTY-NOTICES\";\nconst NODE_LICENSE_FILENAME = \"LICENSE\";\nconst SHARE_APPLICATIONS = \"share/applications\";\nconst SHARE_METAINFO = \"share/metainfo\";\nconst SHARE_MIME_PACKAGES = \"share/mime/packages\";\nconst SHARE_DOC = \"share/doc\";\nconst SHARE_LICENSES = \"share/licenses\";\nconst SHARE_DBUS_SERVICES = \"share/dbus-1/services\";\n\nconst PREFIX_FOR: Record<DeployTargetName, string> = {\n appimage: \"/usr\",\n deb: \"/usr\",\n flatpak: \"/app\",\n rpm: \"/usr\",\n};\n\nconst libDirFor = (settings: DeploySettings): string => `lib/${settings.binaryName}`;\nconst licenseDirFor = (settings: DeploySettings): string => `${SHARE_LICENSES}/${settings.binaryName}`;\nconst licenseDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/LICENSE`;\nconst noticesDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;\nconst isIconAsset = (rel: string): boolean => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);\nconst isBuildMetadata = (rel: string): boolean => rel === BUNDLED_PACKAGES_FILENAME;\n\nconst nodeLicenseDestination = (settings: DeploySettings): string =>\n `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;\n\nconst stageRuntimeFiles = (settings: DeploySettings, root: string): StagedFile[] => {\n const dist = settings.paths.dist;\n\n if (!existsSync(join(dist, BUNDLE_FILENAME))) {\n throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \\`gtkx build\\` first.`);\n }\n\n return listFilesRecursive(dist)\n .filter((file) => !isIconAsset(file.rel) && !isBuildMetadata(file.rel))\n .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));\n};\n\nconst stageNodeBinary = (settings: DeploySettings, root: string, node: NodeRuntime | null): StagedFile[] =>\n node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];\n\nconst stageMetadata = (settings: DeploySettings, root: string, metadata: StagedMetadata): StagedFile[] => [\n writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), metadata.desktopEntry),\n writeInto(root, join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`), metadata.metainfo),\n ...(metadata.mimePackage === null\n ? []\n : [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),\n];\n\nconst stageExtraFiles = (settings: DeploySettings, root: string): StagedFile[] =>\n settings.extraFiles.map((file) => {\n const source = resolve(settings.paths.root, file.source);\n\n return copyInto(root, file.destination, source, file.mode ?? executableModeFor(source));\n });\n\nconst byRelativePath = (files: StagedFile[]): StagedFile[] => {\n const latest: Map<string, StagedFile> = new Map();\n\n for (const file of files) {\n latest.set(file.rel, file);\n }\n\n return sortStringsBy(latest.values(), (file) => file.rel);\n};\n\nconst stagePayload = ({ settings, node, metadata }: StageRequest): StagedFile[] => {\n const root = settings.paths.stage;\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n\n return byRelativePath([\n writeInto(root, join(\"bin\", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),\n ...stageNodeBinary(settings, root, node),\n ...stageRuntimeFiles(settings, root),\n ...stageMetadata(settings, root, metadata),\n ...stageIcons(settings, root),\n ...stageSchemas(settings, root),\n ...stageExtraFiles(settings, root),\n ]);\n};\n\nconst stageActivation = (settings: DeploySettings, root: string, target: DeployTargetName): StagedFile[] => {\n if (!settings.isDbusActivatable) {\n return [];\n }\n\n if (target === \"appimage\") {\n return [writeInto(\n root,\n join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`),\n renderDesktopEntry({ ...settings, isDbusActivatable: false }),\n )];\n }\n\n return [writeInto(\n root,\n join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`),\n renderDbusService(settings, PREFIX_FOR[target]),\n )];\n};\n\nconst stageOverlay = (settings: DeploySettings, target: DeployTargetName, notices: NoticeSection[]): StagedFile[] => {\n const root = join(settings.paths.overlay, target);\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n const licenseFile = settings.paths.licenseFile;\n const activation = stageActivation(settings, root, target);\n\n if (target === \"deb\") {\n return [\n ...activation,\n writeInto(root, join(SHARE_DOC, settings.binaryName, \"copyright\"), renderCopyright(settings, notices)),\n ];\n }\n\n return [\n ...activation,\n ...(licenseFile === null ? [] : [copyInto(root, licenseDestination(settings), licenseFile)]),\n writeInto(root, noticesDestination(settings), renderNotices(settings, notices)),\n ];\n};\n\nconst stageOverlays = (\n settings: DeploySettings,\n notices: NoticeSection[],\n): Record<DeployTargetName, StagedFile[]> => ({\n appimage: stageOverlay(settings, \"appimage\", notices),\n deb: stageOverlay(settings, \"deb\", notices),\n flatpak: stageOverlay(settings, \"flatpak\", notices),\n rpm: stageOverlay(settings, \"rpm\", notices),\n});\n\nexport {\n licenseDestination,\n nodeLicenseDestination,\n NOTICES_FILENAME,\n noticesDestination,\n type StagedMetadata,\n stageOverlays,\n stagePayload,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-deploy.d.ts","sourceRoot":"","sources":["../../src/deploy/run-deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-deploy.d.ts","sourceRoot":"","sources":["../../src/deploy/run-deploy.ts"],"names":[],"mappings":"AAuCA,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;CAC5B,CAAC;AAgMF,QAAA,MAAM,SAAS,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,IAAI,CAsB7D,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -9,12 +9,15 @@ import { renderMetainfo } from "./freedesktop/metainfo.js";
|
|
|
9
9
|
import { renderMimePackage } from "./freedesktop/mime-package.js";
|
|
10
10
|
import { validateDesktopEntry, validateMetainfo } from "./freedesktop/validate.js";
|
|
11
11
|
import { resolveNodeRuntime } from "./node-runtime/index.js";
|
|
12
|
+
import { collectNotices } from "./notices/collect.js";
|
|
12
13
|
import { stageOverlays, stagePayload } from "./payload/stage.js";
|
|
13
14
|
import { DEFAULT_TARGETS, parseTargetList, targetsFor } from "./registry.js";
|
|
14
15
|
import { resolveDeploySettings } from "./settings/index.js";
|
|
15
16
|
import { readPackageManifest } from "./settings/package-manifest.js";
|
|
16
17
|
import { missingDeployError } from "./settings/starter.js";
|
|
17
|
-
import {
|
|
18
|
+
import { finishArgsFor, hasDisplaySocket } from "./targets/flatpak-manifest.js";
|
|
19
|
+
import { detectPackageManager } from "./targets/flatpak-sources.js";
|
|
20
|
+
import { APPSTREAMCLI, assertTools, DESKTOP_FILE_VALIDATE, FLATPAK_NODE_GENERATOR, FLATPAK_NODE_GENERATOR_PNPM, probeTools, STRIP, TAR, warnMissingOptional, } from "./tools.js";
|
|
18
21
|
const BUILD_MODE = "production";
|
|
19
22
|
const BYTES_PER_MIB = 1024 * 1024;
|
|
20
23
|
const WEBKIT_LIBRARY = "WebKit-6.0";
|
|
@@ -42,9 +45,15 @@ const validateMetadata = (settings, metadata, areWarningsFatal) => {
|
|
|
42
45
|
validateMetainfo(metainfoPath, areWarningsFatal);
|
|
43
46
|
info("Validated the desktop entry and the metainfo");
|
|
44
47
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
const warnMissingDisplay = (settings, finishArgs) => {
|
|
49
|
+
if (hasDisplaySocket(finishArgs)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
warn(`The flatpak permissions grant no display socket, so ${settings.name} will start without a window. ` +
|
|
53
|
+
"Grant one through `deploy.flatpak.finishArgs`, such as `--socket=wayland`.");
|
|
54
|
+
};
|
|
55
|
+
const warnMissingNetwork = (settings, finishArgs) => {
|
|
56
|
+
if (settings.deploy.flatpak?.finishArgs === undefined || finishArgs.includes(NETWORK_ARG)) {
|
|
48
57
|
return;
|
|
49
58
|
}
|
|
50
59
|
if (!settings.libraries.includes(WEBKIT_LIBRARY)) {
|
|
@@ -52,9 +61,20 @@ const warnMissingNetwork = (settings) => {
|
|
|
52
61
|
}
|
|
53
62
|
warn(`This app declares ${WEBKIT_LIBRARY} but its flatpak permissions omit ${NETWORK_ARG}, so pages will not load`);
|
|
54
63
|
};
|
|
64
|
+
const warnFlatpakPermissions = (targets, settings) => {
|
|
65
|
+
if (targets.every((target) => target.name !== "flatpak")) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const finishArgs = finishArgsFor(settings);
|
|
69
|
+
warnMissingDisplay(settings, finishArgs);
|
|
70
|
+
warnMissingNetwork(settings, finishArgs);
|
|
71
|
+
};
|
|
55
72
|
const sourceModeTools = (targets, settings) => {
|
|
56
73
|
const isFlatpakSource = settings.deploy.flatpak?.mode === "source";
|
|
57
|
-
|
|
74
|
+
if (!isFlatpakSource || targets.every((target) => target.name !== "flatpak")) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
return detectPackageManager(settings) === "pnpm" ? [FLATPAK_NODE_GENERATOR_PNPM] : [FLATPAK_NODE_GENERATOR];
|
|
58
78
|
};
|
|
59
79
|
const isNodeRequired = (targets, settings) => !(settings.deploy.flatpak?.mode === "source" && targets.every((target) => target.name === "flatpak"));
|
|
60
80
|
const runtimeToolsFor = (targets, settings) => {
|
|
@@ -73,7 +93,7 @@ const preflight = (targets, settings, shouldPrintManifests) => {
|
|
|
73
93
|
const report = probeTools([...required, ...packagerTools]);
|
|
74
94
|
assertTools(report);
|
|
75
95
|
warnMissingOptional(report);
|
|
76
|
-
|
|
96
|
+
warnFlatpakPermissions(targets, settings);
|
|
77
97
|
};
|
|
78
98
|
const resolveTargetNames = (options, settings) => {
|
|
79
99
|
if (options.targets !== undefined) {
|
|
@@ -100,7 +120,8 @@ const buildPayload = async (options, settings, targets) => {
|
|
|
100
120
|
: await resolveNodeRuntime(settings);
|
|
101
121
|
const stage = stagePayload({ settings, node, metadata });
|
|
102
122
|
info(`Staged ${String(stage.length)} files into ${displayPath(settings, settings.paths.stage)}`);
|
|
103
|
-
|
|
123
|
+
const notices = collectNotices({ settings, node });
|
|
124
|
+
return { settings, node, stage, notices, overlays: stageOverlays(settings, notices) };
|
|
104
125
|
};
|
|
105
126
|
const renderTargetManifests = (targets, payload) => {
|
|
106
127
|
const rendered = new Map();
|