@gtkx/cli 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/builder.d.ts +1 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +6 -6
- package/dist/builder.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +3 -2
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +41 -12
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/commands/build.d.ts +0 -4
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +0 -5
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +2 -4
- package/dist/commands/codegen.js.map +1 -1
- package/dist/deploy/depends.d.ts +2 -2
- package/dist/deploy/depends.d.ts.map +1 -1
- package/dist/deploy/depends.js +30 -15
- package/dist/deploy/depends.js.map +1 -1
- package/dist/deploy/freedesktop/localize.d.ts +6 -0
- package/dist/deploy/freedesktop/localize.d.ts.map +1 -0
- package/dist/deploy/freedesktop/localize.js +107 -0
- package/dist/deploy/freedesktop/localize.js.map +1 -0
- package/dist/deploy/install-hints.d.ts.map +1 -1
- package/dist/deploy/install-hints.js +5 -0
- package/dist/deploy/install-hints.js.map +1 -1
- package/dist/deploy/nfpm/config.js +1 -1
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +1 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +2 -2
- package/dist/deploy/node-runtime/elf.js.map +1 -1
- package/dist/deploy/node-runtime/index.js +2 -2
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/notices/collect.d.ts +3 -1
- package/dist/deploy/notices/collect.d.ts.map +1 -1
- package/dist/deploy/notices/collect.js +2 -2
- package/dist/deploy/notices/collect.js.map +1 -1
- package/dist/deploy/notices/packages.d.ts +2 -1
- package/dist/deploy/notices/packages.d.ts.map +1 -1
- package/dist/deploy/notices/packages.js +4 -27
- package/dist/deploy/notices/packages.js.map +1 -1
- package/dist/deploy/payload/icons.d.ts +7 -3
- package/dist/deploy/payload/icons.d.ts.map +1 -1
- package/dist/deploy/payload/icons.js +46 -28
- package/dist/deploy/payload/icons.js.map +1 -1
- package/dist/deploy/payload/launcher.d.ts.map +1 -1
- package/dist/deploy/payload/launcher.js +2 -0
- package/dist/deploy/payload/launcher.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts +1 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +23 -13
- 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 +149 -25
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +9 -0
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -0
- package/dist/deploy/settings/build-manifest.js +80 -0
- package/dist/deploy/settings/build-manifest.js.map +1 -0
- package/dist/deploy/settings/index.d.ts.map +1 -1
- package/dist/deploy/settings/index.js +9 -3
- package/dist/deploy/settings/index.js.map +1 -1
- package/dist/deploy/settings/libraries.d.ts +8 -0
- package/dist/deploy/settings/libraries.d.ts.map +1 -0
- package/dist/deploy/settings/libraries.js +39 -0
- package/dist/deploy/settings/libraries.js.map +1 -0
- package/dist/deploy/settings/paths.d.ts +3 -0
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +6 -32
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/appimage.d.ts.map +1 -1
- package/dist/deploy/targets/appimage.js +19 -13
- package/dist/deploy/targets/appimage.js.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts +2 -1
- package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-manifest.js +5 -1
- package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +30 -16
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/tools.d.ts +6 -1
- package/dist/deploy/tools.d.ts.map +1 -1
- package/dist/deploy/tools.js +26 -1
- package/dist/deploy/tools.js.map +1 -1
- package/dist/deploy/types.d.ts +4 -4
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/dev/icon-dir.d.ts +1 -1
- package/dist/dev/icon-dir.d.ts.map +1 -1
- package/dist/dev/icon-dir.js +20 -7
- package/dist/dev/icon-dir.js.map +1 -1
- package/dist/dev/locale-dir.d.ts +3 -0
- package/dist/dev/locale-dir.d.ts.map +1 -0
- package/dist/dev/locale-dir.js +17 -0
- package/dist/dev/locale-dir.js.map +1 -0
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +5 -1
- package/dist/dev/runner-deps.js.map +1 -1
- package/dist/dev/runner-main.d.ts.map +1 -1
- package/dist/dev/runner-main.js +6 -4
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/runner.d.ts +1 -1
- package/dist/dev/runner.d.ts.map +1 -1
- package/dist/dev/runner.js +7 -1
- package/dist/dev/runner.js.map +1 -1
- package/dist/dev/schema-dir.d.ts +1 -1
- package/dist/dev/schema-dir.d.ts.map +1 -1
- package/dist/dev/schema-dir.js +3 -1
- package/dist/dev/schema-dir.js.map +1 -1
- package/dist/dev/vite-dev-server.d.ts +1 -0
- package/dist/dev/vite-dev-server.d.ts.map +1 -1
- package/dist/dev/vite-dev-server.js.map +1 -1
- package/dist/i18n/binding-extractor.d.ts +30 -0
- package/dist/i18n/binding-extractor.d.ts.map +1 -0
- package/dist/i18n/binding-extractor.js +1324 -0
- package/dist/i18n/binding-extractor.js.map +1 -0
- package/dist/i18n/catalog-template.d.ts +3 -0
- package/dist/i18n/catalog-template.d.ts.map +1 -0
- package/dist/i18n/catalog-template.js +18 -0
- package/dist/i18n/catalog-template.js.map +1 -0
- package/dist/i18n/catalogs.d.ts +21 -0
- package/dist/i18n/catalogs.d.ts.map +1 -0
- package/dist/i18n/catalogs.js +139 -0
- package/dist/i18n/catalogs.js.map +1 -0
- package/dist/i18n/extractor-plugin.d.ts +8 -0
- package/dist/i18n/extractor-plugin.d.ts.map +1 -0
- package/dist/i18n/extractor-plugin.js +247 -0
- package/dist/i18n/extractor-plugin.js.map +1 -0
- package/dist/i18n/metadata-templates.d.ts +11 -0
- package/dist/i18n/metadata-templates.d.ts.map +1 -0
- package/dist/i18n/metadata-templates.js +11 -0
- package/dist/i18n/metadata-templates.js.map +1 -0
- package/dist/i18n/source-messages.d.ts +23 -0
- package/dist/i18n/source-messages.d.ts.map +1 -0
- package/dist/i18n/source-messages.js +403 -0
- package/dist/i18n/source-messages.js.map +1 -0
- package/dist/i18n/types.d.ts +10 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +108 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/internal/build-manifest.d.ts +20 -0
- package/dist/internal/build-manifest.d.ts.map +1 -0
- package/dist/internal/build-manifest.js +6 -0
- package/dist/internal/build-manifest.js.map +1 -0
- package/dist/internal/icon-path.d.ts +13 -0
- package/dist/internal/icon-path.d.ts.map +1 -0
- package/dist/internal/icon-path.js +86 -0
- package/dist/internal/icon-path.js.map +1 -0
- package/dist/internal/source-imports.d.ts +12 -0
- package/dist/internal/source-imports.d.ts.map +1 -0
- package/dist/internal/source-imports.js +123 -0
- package/dist/internal/source-imports.js.map +1 -0
- package/dist/mcp/client.d.ts +0 -1
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +11 -39
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/handlers.d.ts +2 -1
- package/dist/mcp/handlers.d.ts.map +1 -1
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/widget-properties.d.ts.map +1 -1
- package/dist/mcp/widget-properties.js +3 -12
- package/dist/mcp/widget-properties.js.map +1 -1
- package/dist/settings/render.d.ts +10 -1
- package/dist/settings/render.d.ts.map +1 -1
- package/dist/settings/render.js +78 -20
- package/dist/settings/render.js.map +1 -1
- package/dist/settings/schema.d.ts +4 -3
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +124 -15
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-emitter.d.ts +1 -1
- package/dist/vite-plugins/asset-emitter.d.ts.map +1 -1
- package/dist/vite-plugins/asset-emitter.js.map +1 -1
- package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
- package/dist/vite-plugins/asset-extensions.js +1 -0
- package/dist/vite-plugins/asset-extensions.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts +2 -1
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +39 -28
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +13 -1
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +39 -1
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -0
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -0
- package/dist/vite-plugins/{bundled-packages.js → build-manifest.js} +20 -14
- package/dist/vite-plugins/build-manifest.js.map +1 -0
- package/dist/vite-plugins/built-url.d.ts +1 -1
- package/dist/vite-plugins/built-url.d.ts.map +1 -1
- package/dist/vite-plugins/built-url.js +37 -24
- package/dist/vite-plugins/built-url.js.map +1 -1
- package/dist/vite-plugins/i18n.d.ts +5 -0
- package/dist/vite-plugins/i18n.d.ts.map +1 -0
- package/dist/vite-plugins/i18n.js +88 -0
- package/dist/vite-plugins/i18n.js.map +1 -0
- package/dist/vite-plugins/icons.d.ts +2 -1
- package/dist/vite-plugins/icons.d.ts.map +1 -1
- package/dist/vite-plugins/icons.js +25 -12
- package/dist/vite-plugins/icons.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +2 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +9 -5
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/native.d.ts.map +1 -1
- package/dist/vite-plugins/native.js +23 -4
- package/dist/vite-plugins/native.js.map +1 -1
- package/dist/vite-plugins/resource-init-module.d.ts +7 -3
- package/dist/vite-plugins/resource-init-module.d.ts.map +1 -1
- package/dist/vite-plugins/resource-init-module.js +39 -14
- package/dist/vite-plugins/resource-init-module.js.map +1 -1
- package/dist/vite-plugins/resource-shared.d.ts +3 -1
- package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
- package/dist/vite-plugins/resource-shared.js +3 -1
- package/dist/vite-plugins/resource-shared.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +877 -86
- package/dist/vite-plugins/resources.js.map +1 -1
- package/dist/vite-plugins/self-contained.d.ts.map +1 -1
- package/dist/vite-plugins/self-contained.js +128 -135
- package/dist/vite-plugins/self-contained.js.map +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +6 -3
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts +3 -1
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +63 -23
- package/dist/vite-plugins/settings.js.map +1 -1
- package/env.d.ts +11 -192
- package/package.json +11 -10
- package/src/builder.ts +7 -7
- package/src/codegen/run-codegen.ts +64 -15
- package/src/commands/build.ts +0 -5
- package/src/commands/codegen.ts +2 -4
- package/src/deploy/depends.ts +47 -18
- package/src/deploy/freedesktop/localize.ts +144 -0
- package/src/deploy/install-hints.ts +5 -0
- package/src/deploy/nfpm/config.ts +1 -1
- package/src/deploy/node-runtime/elf.ts +3 -3
- package/src/deploy/node-runtime/index.ts +2 -2
- package/src/deploy/notices/collect.ts +4 -2
- package/src/deploy/notices/packages.ts +5 -43
- package/src/deploy/payload/icons.ts +64 -34
- package/src/deploy/payload/launcher.ts +2 -0
- package/src/deploy/payload/stage.ts +40 -12
- package/src/deploy/run-deploy.ts +214 -24
- package/src/deploy/settings/build-manifest.ts +122 -0
- package/src/deploy/settings/index.ts +9 -4
- package/src/deploy/settings/libraries.ts +57 -0
- package/src/deploy/settings/paths.ts +10 -47
- package/src/deploy/targets/appimage.ts +32 -15
- package/src/deploy/targets/flatpak-manifest.ts +7 -1
- package/src/deploy/targets/flatpak-source.ts +42 -20
- package/src/deploy/tools.ts +35 -0
- package/src/deploy/types.ts +4 -4
- package/src/dev/icon-dir.ts +31 -7
- package/src/dev/locale-dir.ts +22 -0
- package/src/dev/runner-deps.ts +5 -1
- package/src/dev/runner-main.ts +6 -4
- package/src/dev/runner.ts +10 -2
- package/src/dev/schema-dir.ts +3 -1
- package/src/dev/vite-dev-server.ts +1 -0
- package/src/i18n/binding-extractor.ts +1969 -0
- package/src/i18n/catalog-template.ts +24 -0
- package/src/i18n/catalogs.ts +216 -0
- package/src/i18n/extractor-plugin.ts +413 -0
- package/src/i18n/metadata-templates.ts +29 -0
- package/src/i18n/source-messages.ts +608 -0
- package/src/i18n/types.ts +154 -0
- package/src/internal/build-manifest.ts +32 -0
- package/src/internal/icon-path.ts +127 -0
- package/src/internal/source-imports.ts +171 -0
- package/src/mcp/client.ts +17 -44
- package/src/mcp/handlers.ts +7 -6
- package/src/mcp/widget-properties.ts +3 -14
- package/src/settings/render.ts +113 -21
- package/src/settings/schema.ts +192 -17
- package/src/vite-plugins/asset-emitter.ts +1 -1
- package/src/vite-plugins/asset-extensions.ts +1 -0
- package/src/vite-plugins/asset-imports.ts +62 -33
- package/src/vite-plugins/asset-specifier.ts +73 -1
- package/src/vite-plugins/{bundled-packages.ts → build-manifest.ts} +30 -19
- package/src/vite-plugins/built-url.ts +49 -28
- package/src/vite-plugins/i18n.ts +146 -0
- package/src/vite-plugins/icons.ts +33 -14
- package/src/vite-plugins/index.ts +15 -5
- package/src/vite-plugins/native.ts +31 -4
- package/src/vite-plugins/resource-init-module.ts +44 -15
- package/src/vite-plugins/resource-shared.ts +4 -0
- package/src/vite-plugins/resources.ts +1397 -100
- package/src/vite-plugins/self-contained.ts +150 -169
- package/src/vite-plugins/settings-worker-env.ts +7 -3
- package/src/vite-plugins/settings.ts +89 -21
- package/dist/vite-plugins/bundled-packages.d.ts +0 -5
- package/dist/vite-plugins/bundled-packages.d.ts.map +0 -1
- package/dist/vite-plugins/bundled-packages.js.map +0 -1
|
@@ -1,53 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { relativeIconPath } from "../../internal/icon-path.js";
|
|
2
3
|
import { listFilesRecursive } from "../../internal/list-files.js";
|
|
3
4
|
import { copyInto } from "./copy-tree.js";
|
|
4
5
|
const ICON_EXTENSIONS = [".svg", ".png", ".xpm"];
|
|
5
6
|
const SHARE_ICONS = "share/icons";
|
|
6
|
-
const
|
|
7
|
-
const SIZE_PATTERN = /^(?<width>[1-9]\d{0,3})x(?<height>[1-9]\d{0,3})$/;
|
|
8
|
-
const SIZE_SEPARATORS = /[-_.]/;
|
|
9
|
-
const isApplicationIcon = (settings, rel) => ICON_EXTENSIONS.some((extension) => basename(rel) === `${settings.applicationId}${extension}`);
|
|
7
|
+
const SIZE_PATTERN = /^(?<width>[1-9]\d{0,3})x(?<height>[1-9]\d{0,3})(?:@(?<scale>[1-9]\d*))?$/;
|
|
10
8
|
const getSquareSize = (token) => {
|
|
11
9
|
const groups = SIZE_PATTERN.exec(token)?.groups;
|
|
12
10
|
if (groups === undefined || groups.width !== groups.height) {
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
|
-
|
|
13
|
+
const pixels = Number(groups.width);
|
|
14
|
+
const scale = Number(groups.scale ?? "1");
|
|
15
|
+
return Number.isSafeInteger(pixels * scale) ? { pixels, scale } : null;
|
|
16
16
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const isIconThemeSize = (segment) => segment === "scalable" || segment === "symbolic" ||
|
|
18
|
+
(segment !== undefined && getSquareSize(segment) !== null);
|
|
19
|
+
const iconExtension = (applicationId, filename) => ICON_EXTENSIONS.find((candidate) => filename === `${applicationId}${candidate}`);
|
|
20
|
+
const isApplicationIconLayout = (segments) => {
|
|
21
|
+
const [share, icons, theme, size, context] = segments;
|
|
22
|
+
return share === "share" &&
|
|
23
|
+
icons === "icons" &&
|
|
24
|
+
theme === "hicolor" &&
|
|
25
|
+
context === "apps" &&
|
|
26
|
+
isIconThemeSize(size);
|
|
25
27
|
};
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const classifyApplicationIcon = (applicationId, rel) => {
|
|
29
|
+
const segments = rel.split(/[\\/]/);
|
|
30
|
+
if (segments.length !== 6) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const size = segments[3];
|
|
34
|
+
const filename = segments[5];
|
|
35
|
+
const extension = iconExtension(applicationId, filename);
|
|
36
|
+
if (extension === undefined || !isApplicationIconLayout(segments)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const square = size === undefined ? null : getSquareSize(size);
|
|
40
|
+
return {
|
|
41
|
+
effectivePixels: square === null ? 0 : square.pixels * square.scale,
|
|
42
|
+
scalable: extension === ".svg",
|
|
43
|
+
};
|
|
30
44
|
};
|
|
31
|
-
const
|
|
45
|
+
const isApplicationIcon = (settings, rel) => classifyApplicationIcon(settings.applicationId, rel) !== null;
|
|
46
|
+
const stageIconTree = (root, themePath) => listFilesRecursive(themePath).map((file) => copyInto(root, join(SHARE_ICONS, file.rel), file.absPath));
|
|
47
|
+
const iconPathFor = (settings, iconPath) => relativeIconPath(settings.applicationId, iconPath);
|
|
48
|
+
const stageIconFile = (settings, root, iconPath) => [copyInto(root, join(SHARE_ICONS, iconPathFor(settings, iconPath)), iconPath)];
|
|
32
49
|
const assertApplicationIcon = (settings, staged) => {
|
|
33
50
|
if (staged.some((file) => isApplicationIcon(settings, file.rel))) {
|
|
34
51
|
return;
|
|
35
52
|
}
|
|
36
|
-
throw new Error(
|
|
37
|
-
`${settings.applicationId}.
|
|
53
|
+
throw new Error("Cannot deploy without a usable application icon: the configured theme must contain " +
|
|
54
|
+
`${settings.applicationId}.svg, ${settings.applicationId}.png, or ${settings.applicationId}.xpm ` +
|
|
55
|
+
"under hicolor/<size>/apps. " +
|
|
38
56
|
"The desktop entry names " +
|
|
39
57
|
`"${settings.applicationId}" as its icon, so the file has to match. ` +
|
|
40
|
-
`
|
|
41
|
-
|
|
58
|
+
"Set `applicationIcon` to a theme directory containing " +
|
|
59
|
+
`hicolor/scalable/apps/${settings.applicationId}.svg, or point it at a single icon file.`);
|
|
42
60
|
};
|
|
43
61
|
const stageIcons = (settings, root) => {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return stageIconFile(settings, root,
|
|
62
|
+
const source = settings.paths.applicationIcon;
|
|
63
|
+
if (source.kind === "file") {
|
|
64
|
+
return stageIconFile(settings, root, source.path);
|
|
47
65
|
}
|
|
48
|
-
const staged =
|
|
66
|
+
const staged = source.kind === "theme" ? stageIconTree(root, source.path) : [];
|
|
49
67
|
assertApplicationIcon(settings, staged);
|
|
50
68
|
return staged;
|
|
51
69
|
};
|
|
52
|
-
export {
|
|
70
|
+
export { classifyApplicationIcon, iconPathFor, stageIcons };
|
|
53
71
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/deploy/payload/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
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,CAAC,aAAa,0CAA0C,CAC5F,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,QAAwB,EAAE,IAAY,EAAgB,EAAE;IACxE,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;IAE9C,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAExC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,UAAU,EAA+B,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport type { DeploySettings, StagedFile } from \"../types.js\";\nimport { relativeIconPath } from \"../../internal/icon-path.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\nimport { copyInto } from \"./copy-tree.js\";\n\ntype ApplicationIconVariant = {\n effectivePixels: number;\n scalable: boolean;\n};\n\nconst ICON_EXTENSIONS = [\".svg\", \".png\", \".xpm\"];\nconst SHARE_ICONS = \"share/icons\";\nconst SIZE_PATTERN = /^(?<width>[1-9]\\d{0,3})x(?<height>[1-9]\\d{0,3})(?:@(?<scale>[1-9]\\d*))?$/;\n\nconst getSquareSize = (token: string): { pixels: number; scale: number } | null => {\n const groups = SIZE_PATTERN.exec(token)?.groups;\n\n if (groups === undefined || groups.width !== groups.height) {\n return null;\n }\n\n const pixels = Number(groups.width);\n const scale = Number(groups.scale ?? \"1\");\n\n return Number.isSafeInteger(pixels * scale) ? { pixels, scale } : null;\n};\n\nconst isIconThemeSize = (segment: string | undefined): boolean =>\n segment === \"scalable\" || segment === \"symbolic\" ||\n (segment !== undefined && getSquareSize(segment) !== null);\n\nconst iconExtension = (applicationId: string, filename: string | undefined): string | undefined =>\n ICON_EXTENSIONS.find((candidate) => filename === `${applicationId}${candidate}`);\n\nconst isApplicationIconLayout = (segments: (string | undefined)[]): boolean => {\n const [share, icons, theme, size, context] = segments;\n\n return share === \"share\" &&\n icons === \"icons\" &&\n theme === \"hicolor\" &&\n context === \"apps\" &&\n isIconThemeSize(size);\n};\n\nconst classifyApplicationIcon = (applicationId: string, rel: string): ApplicationIconVariant | null => {\n const segments = rel.split(/[\\\\/]/);\n\n if (segments.length !== 6) {\n return null;\n }\n\n const size = segments[3];\n const filename = segments[5];\n const extension = iconExtension(applicationId, filename);\n\n if (extension === undefined || !isApplicationIconLayout(segments)) {\n return null;\n }\n\n const square = size === undefined ? null : getSquareSize(size);\n\n return {\n effectivePixels: square === null ? 0 : square.pixels * square.scale,\n scalable: extension === \".svg\",\n };\n};\n\nconst isApplicationIcon = (settings: DeploySettings, rel: string): boolean =>\n classifyApplicationIcon(settings.applicationId, rel) !== null;\n\nconst stageIconTree = (root: string, themePath: string): StagedFile[] =>\n listFilesRecursive(themePath).map((file) => copyInto(root, join(SHARE_ICONS, file.rel), file.absPath));\n\nconst iconPathFor = (settings: DeploySettings, iconPath: string): string =>\n relativeIconPath(settings.applicationId, iconPath);\n\nconst stageIconFile = (settings: DeploySettings, root: string, iconPath: string): StagedFile[] =>\n [copyInto(root, join(SHARE_ICONS, iconPathFor(settings, iconPath)), iconPath)];\n\nconst assertApplicationIcon = (settings: DeploySettings, staged: StagedFile[]): void => {\n if (staged.some((file) => isApplicationIcon(settings, file.rel))) {\n return;\n }\n\n throw new Error(\n \"Cannot deploy without a usable application icon: the configured theme must contain \" +\n `${settings.applicationId}.svg, ${settings.applicationId}.png, or ${settings.applicationId}.xpm ` +\n \"under hicolor/<size>/apps. \" +\n \"The desktop entry names \" +\n `\"${settings.applicationId}\" as its icon, so the file has to match. ` +\n \"Set `applicationIcon` to a theme directory containing \" +\n `hicolor/scalable/apps/${settings.applicationId}.svg, or point it at a single icon file.`,\n );\n};\n\nconst stageIcons = (settings: DeploySettings, root: string): StagedFile[] => {\n const source = settings.paths.applicationIcon;\n\n if (source.kind === \"file\") {\n return stageIconFile(settings, root, source.path);\n }\n\n const staged = source.kind === \"theme\" ? stageIconTree(root, source.path) : [];\n assertApplicationIcon(settings, staged);\n\n return staged;\n};\n\nexport { classifyApplicationIcon, iconPathFor, stageIcons, type ApplicationIconVariant };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,QAAA,MAAM,aAAa,SAAS,CAAC;AAQ7B,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,QAAA,MAAM,aAAa,SAAS,CAAC;AAQ7B,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,MAelD,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -13,6 +13,8 @@ const renderLauncher = (settings) => {
|
|
|
13
13
|
"set -e",
|
|
14
14
|
'self=$(readlink -f "$0")',
|
|
15
15
|
'prefix=$(dirname "$(dirname "$self")")',
|
|
16
|
+
'GTKX_LOCALE_DIR="$prefix/share/locale"',
|
|
17
|
+
"export GTKX_LOCALE_DIR",
|
|
16
18
|
...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),
|
|
17
19
|
`exec "${libDir}/${NODE_FILENAME}" "${libDir}/${BUNDLE_FILENAME}" "$@"`,
|
|
18
20
|
"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAY,EAAE,CAAC;IACxD,oDAAoD;IACpD,mCAAmC,UAAU,QAAQ;IACrD,2BAA2B;CAC9B,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,QAAwB,EAAU,EAAE;IACxD,MAAM,MAAM,GAAG,eAAe,QAAQ,CAAC,UAAU,EAAE,CAAC;IACpD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAqB,KAAK,KAAK,CAAC;IAEpF,OAAO;QACH,WAAW;QACX,QAAQ;QACR,0BAA0B;QAC1B,wCAAwC;QACxC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,SAAS,MAAM,IAAI,aAAa,MAAM,MAAM,IAAI,eAAe,QAAQ;QACvE,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { DeploySettings } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\nconst NODE_FILENAME = \"node\";\n\nconst compileCacheLines = (binaryName: string): string[] => [\n \"cache_home=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}\",\n `NODE_COMPILE_CACHE=\"$cache_home/${binaryName}/node\"`,\n \"export NODE_COMPILE_CACHE\",\n];\n\nconst renderLauncher = (settings: DeploySettings): string => {\n const libDir = `$prefix/lib/${settings.binaryName}`;\n const shouldUseCompileCache = settings.deploy.node?.shouldUseCompileCache !== false;\n\n return [\n \"#!/bin/sh\",\n \"set -e\",\n 'self=$(readlink -f \"$0\")',\n 'prefix=$(dirname \"$(dirname \"$self\")\")',\n ...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),\n `exec \"${libDir}/${NODE_FILENAME}\" \"${libDir}/${BUNDLE_FILENAME}\" \"$@\"`,\n \"\",\n ].join(\"\\n\");\n};\n\nexport { NODE_FILENAME, renderLauncher };\n"]}
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAY,EAAE,CAAC;IACxD,oDAAoD;IACpD,mCAAmC,UAAU,QAAQ;IACrD,2BAA2B;CAC9B,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,QAAwB,EAAU,EAAE;IACxD,MAAM,MAAM,GAAG,eAAe,QAAQ,CAAC,UAAU,EAAE,CAAC;IACpD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAqB,KAAK,KAAK,CAAC;IAEpF,OAAO;QACH,WAAW;QACX,QAAQ;QACR,0BAA0B;QAC1B,wCAAwC;QACxC,wCAAwC;QACxC,wBAAwB;QACxB,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,SAAS,MAAM,IAAI,aAAa,MAAM,MAAM,IAAI,eAAe,QAAQ;QACvE,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { DeploySettings } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\nconst NODE_FILENAME = \"node\";\n\nconst compileCacheLines = (binaryName: string): string[] => [\n \"cache_home=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}\",\n `NODE_COMPILE_CACHE=\"$cache_home/${binaryName}/node\"`,\n \"export NODE_COMPILE_CACHE\",\n];\n\nconst renderLauncher = (settings: DeploySettings): string => {\n const libDir = `$prefix/lib/${settings.binaryName}`;\n const shouldUseCompileCache = settings.deploy.node?.shouldUseCompileCache !== false;\n\n return [\n \"#!/bin/sh\",\n \"set -e\",\n 'self=$(readlink -f \"$0\")',\n 'prefix=$(dirname \"$(dirname \"$self\")\")',\n 'GTKX_LOCALE_DIR=\"$prefix/share/locale\"',\n \"export GTKX_LOCALE_DIR\",\n ...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),\n `exec \"${libDir}/${NODE_FILENAME}\" \"${libDir}/${BUNDLE_FILENAME}\" \"$@\"`,\n \"\",\n ].join(\"\\n\");\n};\n\nexport { NODE_FILENAME, renderLauncher };\n"]}
|
|
@@ -14,6 +14,6 @@ declare const licenseDestination: (settings: DeploySettings) => string;
|
|
|
14
14
|
declare const noticesDestination: (settings: DeploySettings) => string;
|
|
15
15
|
declare const nodeLicenseDestination: (settings: DeploySettings) => string;
|
|
16
16
|
declare const stagePayload: ({ settings, node, metadata }: StageRequest) => StagedFile[];
|
|
17
|
-
declare const stageOverlays: (settings: DeploySettings, notices: NoticeSection[]) => Record<DeployTargetName, StagedFile[]>;
|
|
17
|
+
declare const stageOverlays: (settings: DeploySettings, notices: NoticeSection[], metadata: StagedMetadata) => Record<DeployTargetName, StagedFile[]>;
|
|
18
18
|
export { licenseDestination, nodeLicenseDestination, NOTICES_FILENAME, noticesDestination, type StagedMetadata, stageOverlays, stagePayload, };
|
|
19
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,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;
|
|
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;AAIF,QAAA,MAAM,gBAAgB,wBAAwB,CAAC;AAmB/C,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA8C,CAAC;AACtG,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAA0D,CAAC;AAQlH,QAAA,MAAM,sBAAsB,GAAI,UAAU,cAAc,KAAG,MACe,CAAC;AA8C3E,QAAA,MAAM,YAAY,GAAI,8BAA8B,YAAY,KAAG,UAAU,EAc5E,CAAC;AA0DF,QAAA,MAAM,aAAa,GACf,UAAU,cAAc,EACxB,SAAS,aAAa,EAAE,EACxB,UAAU,cAAc,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"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { sortStringsBy } from "@gtkx/utils";
|
|
2
2
|
import { existsSync, rmSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
|
+
import { LOCALE_DIRNAME } from "../../i18n/catalogs.js";
|
|
5
|
+
import { BUILD_MANIFEST_FILENAME } from "../../internal/build-manifest.js";
|
|
4
6
|
import { listFilesRecursive } from "../../internal/list-files.js";
|
|
5
|
-
import { BUNDLED_PACKAGES_FILENAME } from "../../vite-plugins/bundled-packages.js";
|
|
6
7
|
import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
|
|
7
8
|
import { renderCopyright } from "../freedesktop/copyright.js";
|
|
8
9
|
import { renderDbusService } from "../freedesktop/dbus-service.js";
|
|
9
|
-
import { renderDesktopEntry } from "../freedesktop/desktop-entry.js";
|
|
10
10
|
import { renderNotices } from "../notices/render.js";
|
|
11
11
|
import { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from "./copy-tree.js";
|
|
12
12
|
import { stageIcons } from "./icons.js";
|
|
13
13
|
import { NODE_FILENAME, renderLauncher } from "./launcher.js";
|
|
14
14
|
import { stageSchemas } from "./schemas.js";
|
|
15
15
|
const DIST_ICONS_DIR = "icons";
|
|
16
|
+
const LEGACY_PACKAGES_MANIFEST_FILENAME = "gtkx-packages.json";
|
|
16
17
|
const NOTICES_FILENAME = "THIRD-PARTY-NOTICES";
|
|
17
18
|
const NODE_LICENSE_FILENAME = "LICENSE";
|
|
18
19
|
const SHARE_APPLICATIONS = "share/applications";
|
|
@@ -21,6 +22,7 @@ const SHARE_MIME_PACKAGES = "share/mime/packages";
|
|
|
21
22
|
const SHARE_DOC = "share/doc";
|
|
22
23
|
const SHARE_LICENSES = "share/licenses";
|
|
23
24
|
const SHARE_DBUS_SERVICES = "share/dbus-1/services";
|
|
25
|
+
const SHARE_LOCALE = `share/${LOCALE_DIRNAME}`;
|
|
24
26
|
const PREFIX_FOR = {
|
|
25
27
|
appimage: "/usr",
|
|
26
28
|
deb: "/usr",
|
|
@@ -32,7 +34,8 @@ const licenseDirFor = (settings) => `${SHARE_LICENSES}/${settings.binaryName}`;
|
|
|
32
34
|
const licenseDestination = (settings) => `${licenseDirFor(settings)}/LICENSE`;
|
|
33
35
|
const noticesDestination = (settings) => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;
|
|
34
36
|
const isIconAsset = (rel) => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);
|
|
35
|
-
const isBuildMetadata = (rel) => rel ===
|
|
37
|
+
const isBuildMetadata = (rel) => rel === BUILD_MANIFEST_FILENAME || rel === LEGACY_PACKAGES_MANIFEST_FILENAME;
|
|
38
|
+
const isLocaleAsset = (rel) => rel === LOCALE_DIRNAME || rel.startsWith(`${LOCALE_DIRNAME}/`);
|
|
36
39
|
const nodeLicenseDestination = (settings) => `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;
|
|
37
40
|
const stageRuntimeFiles = (settings, root) => {
|
|
38
41
|
const dist = settings.paths.dist;
|
|
@@ -40,9 +43,11 @@ const stageRuntimeFiles = (settings, root) => {
|
|
|
40
43
|
throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \`gtkx build\` first.`);
|
|
41
44
|
}
|
|
42
45
|
return listFilesRecursive(dist)
|
|
43
|
-
.filter((file) => !isIconAsset(file.rel) && !isBuildMetadata(file.rel))
|
|
46
|
+
.filter((file) => !isIconAsset(file.rel) && !isBuildMetadata(file.rel) && !isLocaleAsset(file.rel))
|
|
44
47
|
.map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));
|
|
45
48
|
};
|
|
49
|
+
const stageCatalogs = (settings, root) => listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))
|
|
50
|
+
.map((file) => copyInto(root, join(SHARE_LOCALE, file.rel), file.absPath));
|
|
46
51
|
const stageNodeBinary = (settings, root, node) => node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];
|
|
47
52
|
const stageMetadata = (settings, root, metadata) => [
|
|
48
53
|
writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), metadata.desktopEntry),
|
|
@@ -69,26 +74,31 @@ const stagePayload = ({ settings, node, metadata }) => {
|
|
|
69
74
|
writeInto(root, join("bin", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),
|
|
70
75
|
...stageNodeBinary(settings, root, node),
|
|
71
76
|
...stageRuntimeFiles(settings, root),
|
|
77
|
+
...stageCatalogs(settings, root),
|
|
72
78
|
...stageMetadata(settings, root, metadata),
|
|
73
79
|
...stageIcons(settings, root),
|
|
74
80
|
...stageSchemas(settings, root),
|
|
75
81
|
...stageExtraFiles(settings, root),
|
|
76
82
|
]);
|
|
77
83
|
};
|
|
78
|
-
const
|
|
84
|
+
const withoutDbusActivation = (desktopEntry) => desktopEntry
|
|
85
|
+
.split("\n")
|
|
86
|
+
.filter((line) => line !== "DBusActivatable=true")
|
|
87
|
+
.join("\n");
|
|
88
|
+
const stageActivation = (settings, root, target, metadata) => {
|
|
79
89
|
if (!settings.isDbusActivatable) {
|
|
80
90
|
return [];
|
|
81
91
|
}
|
|
82
92
|
if (target === "appimage") {
|
|
83
|
-
return [writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`),
|
|
93
|
+
return [writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), withoutDbusActivation(metadata.desktopEntry))];
|
|
84
94
|
}
|
|
85
95
|
return [writeInto(root, join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`), renderDbusService(settings, PREFIX_FOR[target]))];
|
|
86
96
|
};
|
|
87
|
-
const stageOverlay = (settings, target, notices) => {
|
|
97
|
+
const stageOverlay = (settings, target, notices, metadata) => {
|
|
88
98
|
const root = join(settings.paths.overlay, target);
|
|
89
99
|
rmSync(root, { recursive: true, force: true, maxRetries: 5 });
|
|
90
100
|
const licenseFile = settings.paths.licenseFile;
|
|
91
|
-
const activation = stageActivation(settings, root, target);
|
|
101
|
+
const activation = stageActivation(settings, root, target, metadata);
|
|
92
102
|
if (target === "deb") {
|
|
93
103
|
return [
|
|
94
104
|
...activation,
|
|
@@ -101,11 +111,11 @@ const stageOverlay = (settings, target, notices) => {
|
|
|
101
111
|
writeInto(root, noticesDestination(settings), renderNotices(settings, notices)),
|
|
102
112
|
];
|
|
103
113
|
};
|
|
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),
|
|
114
|
+
const stageOverlays = (settings, notices, metadata) => ({
|
|
115
|
+
appimage: stageOverlay(settings, "appimage", notices, metadata),
|
|
116
|
+
deb: stageOverlay(settings, "deb", notices, metadata),
|
|
117
|
+
flatpak: stageOverlay(settings, "flatpak", notices, metadata),
|
|
118
|
+
rpm: stageOverlay(settings, "rpm", notices, metadata),
|
|
109
119
|
});
|
|
110
120
|
export { licenseDestination, nodeLicenseDestination, NOTICES_FILENAME, noticesDestination, stageOverlays, stagePayload, };
|
|
111
121
|
//# 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;A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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,EAAE,OAAO,CAAC,CAAC;SACzG,CAAC;IACN,CAAC;IAED,OAAO;QACH,GAAG,UAAU;QACb,GAAG,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QAC5F,SAAS,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClF,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAClB,QAAwB,EACxB,OAAwB,EACc,EAAE,CAAC,CAAC;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
|
+
{"version":3,"file":"stage.js","sourceRoot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AAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QAC5F,SAAS,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClF,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAClB,QAAwB,EACxB,OAAwB,EACxB,QAAwB,EACc,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC/D,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC7D,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;CACxD,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 { LOCALE_DIRNAME } from \"../../i18n/catalogs.js\";\nimport { BUILD_MANIFEST_FILENAME } from \"../../internal/build-manifest.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 { 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 LEGACY_PACKAGES_MANIFEST_FILENAME = \"gtkx-packages.json\";\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\";\nconst SHARE_LOCALE = `share/${LOCALE_DIRNAME}`;\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}/`);\n\nconst isBuildMetadata = (rel: string): boolean =>\n rel === BUILD_MANIFEST_FILENAME || rel === LEGACY_PACKAGES_MANIFEST_FILENAME;\n\nconst isLocaleAsset = (rel: string): boolean => rel === LOCALE_DIRNAME || rel.startsWith(`${LOCALE_DIRNAME}/`);\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) && !isLocaleAsset(file.rel))\n .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));\n};\n\nconst stageCatalogs = (settings: DeploySettings, root: string): StagedFile[] =>\n listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))\n .map((file) => copyInto(root, join(SHARE_LOCALE, file.rel), file.absPath));\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 ...stageCatalogs(settings, root),\n ...stageMetadata(settings, root, metadata),\n ...stageIcons(settings, root),\n ...stageSchemas(settings, root),\n ...stageExtraFiles(settings, root),\n ]);\n};\n\nconst withoutDbusActivation = (desktopEntry: string): string =>\n desktopEntry\n .split(\"\\n\")\n .filter((line) => line !== \"DBusActivatable=true\")\n .join(\"\\n\");\n\nconst stageActivation = (\n settings: DeploySettings,\n root: string,\n target: DeployTargetName,\n metadata: StagedMetadata,\n): 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 withoutDbusActivation(metadata.desktopEntry),\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 = (\n settings: DeploySettings,\n target: DeployTargetName,\n notices: NoticeSection[],\n metadata: StagedMetadata,\n): 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, metadata);\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 metadata: StagedMetadata,\n): Record<DeployTargetName, StagedFile[]> => ({\n appimage: stageOverlay(settings, \"appimage\", notices, metadata),\n deb: stageOverlay(settings, \"deb\", notices, metadata),\n flatpak: stageOverlay(settings, \"flatpak\", notices, metadata),\n rpm: stageOverlay(settings, \"rpm\", notices, metadata),\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":"AAyDA,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;AA4VF,QAAA,MAAM,SAAS,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,IAAI,CAsC7D,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|