@gtkx/cli 1.6.0 → 2.0.0-beta.2
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 -5
- package/dist/builder.d.ts +1 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +17 -5
- package/dist/builder.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/codegen/freshness.d.ts.map +1 -1
- package/dist/codegen/freshness.js +45 -16
- package/dist/codegen/freshness.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +1 -7
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/report.d.ts.map +1 -1
- package/dist/codegen/report.js +5 -16
- package/dist/codegen/report.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +7 -7
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +35 -107
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +1 -2
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +10 -19
- package/dist/codegen/store-resolver.js.map +1 -1
- package/dist/commands/build.d.ts +5 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +83 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/codegen.d.ts +1 -0
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +6 -5
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +4 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +19 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +5 -15
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
- package/dist/deploy/freedesktop/copyright.js +2 -13
- package/dist/deploy/freedesktop/copyright.js.map +1 -1
- package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
- package/dist/deploy/freedesktop/metainfo.js +41 -2
- package/dist/deploy/freedesktop/metainfo.js.map +1 -1
- package/dist/deploy/freedesktop/xml.d.ts.map +1 -1
- package/dist/deploy/freedesktop/xml.js +21 -25
- package/dist/deploy/freedesktop/xml.js.map +1 -1
- package/dist/deploy/nfpm/config.d.ts.map +1 -1
- package/dist/deploy/nfpm/config.js +5 -2
- package/dist/deploy/nfpm/config.js.map +1 -1
- package/dist/deploy/nfpm/contents.d.ts.map +1 -1
- package/dist/deploy/nfpm/contents.js +8 -0
- package/dist/deploy/nfpm/contents.js.map +1 -1
- package/dist/deploy/node-runtime/elf.d.ts +2 -1
- package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
- package/dist/deploy/node-runtime/elf.js +32 -5
- package/dist/deploy/node-runtime/elf.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 +73 -4
- package/dist/deploy/node-runtime/index.js.map +1 -1
- package/dist/deploy/node-runtime/license.d.ts.map +1 -1
- package/dist/deploy/node-runtime/license.js +2 -9
- package/dist/deploy/node-runtime/license.js.map +1 -1
- package/dist/deploy/notices/node-runtime.js +2 -2
- package/dist/deploy/notices/node-runtime.js.map +1 -1
- package/dist/deploy/notices/packages.d.ts.map +1 -1
- package/dist/deploy/notices/packages.js +3 -10
- package/dist/deploy/notices/packages.js.map +1 -1
- package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
- package/dist/deploy/payload/copy-tree.js +3 -3
- package/dist/deploy/payload/copy-tree.js.map +1 -1
- package/dist/deploy/payload/launcher.d.ts.map +1 -1
- package/dist/deploy/payload/launcher.js +14 -1
- package/dist/deploy/payload/launcher.js.map +1 -1
- package/dist/deploy/payload/stage.d.ts.map +1 -1
- package/dist/deploy/payload/stage.js +2 -4
- package/dist/deploy/payload/stage.js.map +1 -1
- package/dist/deploy/run-deploy.d.ts +1 -0
- package/dist/deploy/run-deploy.d.ts.map +1 -1
- package/dist/deploy/run-deploy.js +100 -14
- package/dist/deploy/run-deploy.js.map +1 -1
- package/dist/deploy/settings/build-manifest.d.ts +6 -1
- package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
- package/dist/deploy/settings/build-manifest.js +17 -17
- package/dist/deploy/settings/build-manifest.js.map +1 -1
- package/dist/deploy/settings/extra-files.d.ts +1 -1
- package/dist/deploy/settings/extra-files.d.ts.map +1 -1
- package/dist/deploy/settings/extra-files.js +22 -1
- package/dist/deploy/settings/extra-files.js.map +1 -1
- package/dist/deploy/settings/index.d.ts +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/libraries.d.ts.map +1 -1
- package/dist/deploy/settings/libraries.js +2 -19
- package/dist/deploy/settings/libraries.js.map +1 -1
- package/dist/deploy/settings/paths.d.ts +2 -2
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +110 -12
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/settings/screenshots.d.ts.map +1 -1
- package/dist/deploy/settings/screenshots.js +6 -31
- package/dist/deploy/settings/screenshots.js.map +1 -1
- package/dist/deploy/targets/flatpak-pnpm.js +4 -4
- package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +15 -6
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/flatpak-sources.js +1 -1
- package/dist/deploy/targets/flatpak-sources.js.map +1 -1
- package/dist/deploy/types.d.ts +1 -0
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/deploy/types.js.map +1 -1
- package/dist/dev/headless.d.ts +3 -0
- package/dist/dev/headless.d.ts.map +1 -0
- package/dist/dev/headless.js +35 -0
- package/dist/dev/headless.js.map +1 -0
- package/dist/dev/runner-deps.js +1 -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 +1 -2
- package/dist/dev/runner-main.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 +2 -4
- package/dist/dev/schema-dir.js.map +1 -1
- package/dist/i18n/catalogs.d.ts.map +1 -1
- package/dist/i18n/catalogs.js +2 -1
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/metadata-templates.d.ts.map +1 -1
- package/dist/i18n/metadata-templates.js +2 -1
- package/dist/i18n/metadata-templates.js.map +1 -1
- package/dist/i18n/source-messages.d.ts +3 -21
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +900 -85
- package/dist/i18n/source-messages.js.map +1 -1
- package/dist/i18n/types.d.ts +6 -7
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/i18n/types.js +83 -96
- package/dist/i18n/types.js.map +1 -1
- package/dist/internal/build-manifest.d.ts +5 -2
- package/dist/internal/build-manifest.d.ts.map +1 -1
- package/dist/internal/build-manifest.js +15 -2
- package/dist/internal/build-manifest.js.map +1 -1
- package/dist/internal/build-output.d.ts +8 -0
- package/dist/internal/build-output.d.ts.map +1 -0
- package/dist/internal/build-output.js +69 -0
- package/dist/internal/build-output.js.map +1 -0
- package/dist/internal/docs-elements.js +2 -2
- package/dist/internal/docs-elements.js.map +1 -1
- package/dist/internal/entry-arg.d.ts +4 -1
- package/dist/internal/entry-arg.d.ts.map +1 -1
- package/dist/internal/entry-arg.js +7 -1
- package/dist/internal/entry-arg.js.map +1 -1
- package/dist/internal/icon-path.d.ts.map +1 -1
- package/dist/internal/icon-path.js +5 -16
- package/dist/internal/icon-path.js.map +1 -1
- package/dist/internal/output-directory.d.ts +15 -0
- package/dist/internal/output-directory.d.ts.map +1 -0
- package/dist/internal/output-directory.js +490 -0
- package/dist/internal/output-directory.js.map +1 -0
- package/dist/internal/prepare-project.d.ts +2 -0
- package/dist/internal/prepare-project.d.ts.map +1 -1
- package/dist/internal/prepare-project.js +3 -3
- package/dist/internal/prepare-project.js.map +1 -1
- package/dist/internal/source-imports.d.ts.map +1 -1
- package/dist/internal/source-imports.js +10 -41
- package/dist/internal/source-imports.js.map +1 -1
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/client.js.map +1 -1
- package/dist/settings/render.d.ts +0 -1
- package/dist/settings/render.d.ts.map +1 -1
- package/dist/settings/render.js +1 -11
- package/dist/settings/render.js.map +1 -1
- package/dist/settings/schema.d.ts +2 -2
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +21 -62
- package/dist/settings/schema.js.map +1 -1
- package/dist/vite-plugins/asset-imports.d.ts +1 -2
- package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
- package/dist/vite-plugins/asset-imports.js +19 -32
- package/dist/vite-plugins/asset-imports.js.map +1 -1
- package/dist/vite-plugins/asset-specifier.d.ts +1 -3
- package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
- package/dist/vite-plugins/asset-specifier.js +1 -4
- package/dist/vite-plugins/asset-specifier.js.map +1 -1
- package/dist/vite-plugins/build-manifest.d.ts +5 -1
- package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
- package/dist/vite-plugins/build-manifest.js +2 -1
- package/dist/vite-plugins/build-manifest.js.map +1 -1
- package/dist/vite-plugins/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +59 -6
- package/dist/vite-plugins/i18n.js.map +1 -1
- package/dist/vite-plugins/index.d.ts +8 -1
- package/dist/vite-plugins/index.d.ts.map +1 -1
- package/dist/vite-plugins/index.js +8 -6
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/resources.d.ts.map +1 -1
- package/dist/vite-plugins/resources.js +32 -97
- 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 +159 -158
- 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 +2 -4
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vite-plugins/settings.d.ts +1 -2
- package/dist/vite-plugins/settings.d.ts.map +1 -1
- package/dist/vite-plugins/settings.js +8 -14
- package/dist/vite-plugins/settings.js.map +1 -1
- package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
- package/dist/vite-plugins/undeclared-library.js +10 -13
- package/dist/vite-plugins/undeclared-library.js.map +1 -1
- package/dist/vite-plugins/worker.d.ts.map +1 -1
- package/dist/vite-plugins/worker.js +0 -1
- package/dist/vite-plugins/worker.js.map +1 -1
- package/package.json +21 -15
- package/src/builder.ts +18 -5
- package/src/cli.ts +3 -0
- package/src/codegen/freshness.ts +66 -17
- package/src/codegen/reference.ts +1 -8
- package/src/codegen/report.ts +5 -21
- package/src/codegen/run-codegen.ts +42 -151
- package/src/codegen/store-resolver.ts +10 -26
- package/src/commands/build.ts +13 -2
- package/src/commands/codegen.ts +6 -5
- package/src/commands/deploy.ts +4 -2
- package/src/commands/dev.ts +20 -1
- package/src/commands/docs.ts +5 -17
- package/src/deploy/freedesktop/copyright.ts +2 -14
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/xml.ts +24 -32
- package/src/deploy/nfpm/config.ts +5 -2
- package/src/deploy/nfpm/contents.ts +8 -0
- package/src/deploy/node-runtime/elf.ts +43 -5
- package/src/deploy/node-runtime/index.ts +105 -5
- package/src/deploy/node-runtime/license.ts +2 -8
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/notices/packages.ts +3 -11
- package/src/deploy/payload/copy-tree.ts +3 -4
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +3 -7
- package/src/deploy/run-deploy.ts +56 -16
- package/src/deploy/settings/build-manifest.ts +30 -17
- package/src/deploy/settings/extra-files.ts +26 -2
- package/src/deploy/settings/index.ts +3 -1
- package/src/deploy/settings/libraries.ts +1 -22
- package/src/deploy/settings/paths.ts +68 -13
- package/src/deploy/settings/screenshots.ts +8 -46
- package/src/deploy/targets/flatpak-pnpm.ts +4 -4
- package/src/deploy/targets/flatpak-source.ts +17 -6
- package/src/deploy/targets/flatpak-sources.ts +1 -1
- package/src/deploy/types.ts +1 -0
- package/src/dev/headless.ts +40 -0
- package/src/dev/runner-deps.ts +1 -1
- package/src/dev/runner-main.ts +1 -2
- package/src/dev/schema-dir.ts +2 -4
- package/src/i18n/catalogs.ts +2 -1
- package/src/i18n/metadata-templates.ts +2 -1
- package/src/i18n/source-messages.ts +1442 -262
- package/src/i18n/types.ts +97 -131
- package/src/internal/build-manifest.ts +25 -1
- package/src/internal/build-output.ts +99 -0
- package/src/internal/docs-elements.ts +2 -2
- package/src/internal/entry-arg.ts +8 -1
- package/src/internal/icon-path.ts +6 -19
- package/src/internal/output-directory.ts +699 -0
- package/src/internal/prepare-project.ts +5 -5
- package/src/internal/source-imports.ts +14 -50
- package/src/mcp/client.ts +2 -2
- package/src/settings/render.ts +1 -13
- package/src/settings/schema.ts +19 -81
- package/src/vite-plugins/asset-imports.ts +20 -44
- package/src/vite-plugins/asset-specifier.ts +0 -5
- package/src/vite-plugins/build-manifest.ts +7 -1
- package/src/vite-plugins/i18n.ts +87 -5
- package/src/vite-plugins/index.ts +16 -11
- package/src/vite-plugins/resources.ts +37 -140
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +2 -4
- package/src/vite-plugins/settings.ts +11 -20
- package/src/vite-plugins/undeclared-library.ts +14 -20
- package/src/vite-plugins/worker.ts +0 -1
- package/dist/i18n/binding-extractor.d.ts +0 -30
- package/dist/i18n/binding-extractor.d.ts.map +0 -1
- package/dist/i18n/binding-extractor.js +0 -1324
- package/dist/i18n/binding-extractor.js.map +0 -1
- package/dist/i18n/extractor-plugin.d.ts +0 -8
- package/dist/i18n/extractor-plugin.d.ts.map +0 -1
- package/dist/i18n/extractor-plugin.js +0 -247
- package/dist/i18n/extractor-plugin.js.map +0 -1
- package/dist/internal/data-dir.d.ts +0 -4
- package/dist/internal/data-dir.d.ts.map +0 -1
- package/dist/internal/data-dir.js +0 -52
- package/dist/internal/data-dir.js.map +0 -1
- package/dist/vite-plugins/animated.d.ts +0 -5
- package/dist/vite-plugins/animated.d.ts.map +0 -1
- package/dist/vite-plugins/animated.js +0 -325
- package/dist/vite-plugins/animated.js.map +0 -1
- package/src/i18n/binding-extractor.ts +0 -1969
- package/src/i18n/extractor-plugin.ts +0 -413
- package/src/internal/data-dir.ts +0 -70
- package/src/vite-plugins/animated.ts +0 -486
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { Config } from "@gtkx/config";
|
|
1
2
|
import type { DeploySettings } from "../types.js";
|
|
2
3
|
import { type RecordedPackage } from "../../internal/build-manifest.js";
|
|
3
4
|
type ResolvedBuildManifest = {
|
|
4
5
|
packages: RecordedPackage[];
|
|
5
6
|
schemaFiles: string[];
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
type ExpectedBuildConfig = {
|
|
9
|
+
config: Config;
|
|
10
|
+
configFile: string;
|
|
11
|
+
};
|
|
12
|
+
declare const readBuildManifest: (settings: DeploySettings, expected: ExpectedBuildConfig) => ResolvedBuildManifest;
|
|
8
13
|
export { readBuildManifest };
|
|
9
14
|
//# sourceMappingURL=build-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-manifest.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/build-manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-manifest.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/build-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAMH,KAAK,eAAe,EACvB,MAAM,kCAAkC,CAAC;AAO1C,KAAK,qBAAqB,GAAG;IACzB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AA0FF,QAAA,MAAM,iBAAiB,GAAI,UAAU,cAAc,EAAE,UAAU,mBAAmB,KAAG,qBAepF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isRecord, sortStrings } from "@gtkx/utils";
|
|
1
|
+
import { isPathInside, isRecord, sortStrings, toPosixPath } from "@gtkx/utils";
|
|
2
2
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
-
import { isAbsolute, join, relative, resolve
|
|
4
|
-
import { BUILD_MANIFEST_FILENAME, BUILD_MANIFEST_FORMAT_VERSION, BUILD_MANIFEST_GENERATOR, } from "../../internal/build-manifest.js";
|
|
3
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
import { BUILD_MANIFEST_FILENAME, BUILD_MANIFEST_FORMAT_VERSION, BUILD_MANIFEST_GENERATOR, configDigest, } from "../../internal/build-manifest.js";
|
|
5
5
|
import { assertUniqueSchemaBasenames, projectRelativeSchemaPath, SCHEMA_SUFFIX, } from "../../settings/schema.js";
|
|
6
6
|
const invalidManifest = (path) => new Error(`Cannot deploy: ${path} is not a valid GTKX build manifest. Run \`gtkx build\` again.`);
|
|
7
7
|
const recordedSchemas = (value, path) => value.map((entry) => {
|
|
@@ -24,6 +24,8 @@ const parseBuildManifest = (value, path) => {
|
|
|
24
24
|
if (!isRecord(value) ||
|
|
25
25
|
value.generator !== BUILD_MANIFEST_GENERATOR ||
|
|
26
26
|
value.formatVersion !== BUILD_MANIFEST_FORMAT_VERSION ||
|
|
27
|
+
typeof value.configFile !== "string" ||
|
|
28
|
+
typeof value.configDigest !== "string" ||
|
|
27
29
|
!Array.isArray(value.schemas) ||
|
|
28
30
|
!Array.isArray(value.packages)) {
|
|
29
31
|
throw invalidManifest(path);
|
|
@@ -32,28 +34,19 @@ const parseBuildManifest = (value, path) => {
|
|
|
32
34
|
return {
|
|
33
35
|
generator: BUILD_MANIFEST_GENERATOR,
|
|
34
36
|
formatVersion: BUILD_MANIFEST_FORMAT_VERSION,
|
|
37
|
+
configFile: value.configFile,
|
|
38
|
+
configDigest: value.configDigest,
|
|
35
39
|
schemas: recordedSchemas(value.schemas, path),
|
|
36
40
|
packages: packages.map((entry) => recordedPackage(entry, path)),
|
|
37
41
|
};
|
|
38
42
|
};
|
|
39
|
-
const isFile = (path) => {
|
|
40
|
-
try {
|
|
41
|
-
return statSync(path, { throwIfNoEntry: false })?.isFile() === true;
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const isInsideProject = (root, filePath) => {
|
|
48
|
-
const rel = relative(root, filePath);
|
|
49
|
-
return rel.length > 0 && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
|
|
50
|
-
};
|
|
43
|
+
const isFile = (path) => statSync(path, { throwIfNoEntry: false })?.isFile() === true;
|
|
51
44
|
const resolveRecordedSchema = (root, manifestPath, entry) => {
|
|
52
45
|
if (isAbsolute(entry) || !entry.endsWith(SCHEMA_SUFFIX)) {
|
|
53
46
|
throw new Error(`Cannot deploy: ${manifestPath} records an invalid GSettings schema path.`);
|
|
54
47
|
}
|
|
55
48
|
const filePath = resolve(root, entry);
|
|
56
|
-
if (!
|
|
49
|
+
if (!isPathInside(root, filePath)) {
|
|
57
50
|
throw new Error(`Cannot deploy: ${manifestPath} records a GSettings schema outside the project.`);
|
|
58
51
|
}
|
|
59
52
|
if (!isFile(filePath)) {
|
|
@@ -64,13 +57,20 @@ const resolveRecordedSchema = (root, manifestPath, entry) => {
|
|
|
64
57
|
}
|
|
65
58
|
return filePath;
|
|
66
59
|
};
|
|
67
|
-
const
|
|
60
|
+
const assertBuildConfig = (settings, manifestPath, manifest, expected) => {
|
|
61
|
+
const expectedFile = toPosixPath(relative(settings.paths.root, expected.configFile));
|
|
62
|
+
if (manifest.configFile !== expectedFile || manifest.configDigest !== configDigest(expected.config)) {
|
|
63
|
+
throw new Error(`Cannot deploy: ${manifestPath} was built from a different GTKX configuration.`);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const readBuildManifest = (settings, expected) => {
|
|
68
67
|
const manifestPath = join(settings.paths.dist, BUILD_MANIFEST_FILENAME);
|
|
69
68
|
if (!existsSync(manifestPath)) {
|
|
70
69
|
throw new Error(`Cannot deploy: ${manifestPath} is missing. Run \`gtkx build\` first.`);
|
|
71
70
|
}
|
|
72
71
|
const parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
73
72
|
const manifest = parseBuildManifest(parsed, manifestPath);
|
|
73
|
+
assertBuildConfig(settings, manifestPath, manifest, expected);
|
|
74
74
|
const files = manifest.schemas.map((entry) => resolveRecordedSchema(settings.paths.root, manifestPath, entry));
|
|
75
75
|
const unique = sortStrings(new Set(files));
|
|
76
76
|
assertUniqueSchemaBasenames(unique);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-manifest.js","sourceRoot":"","sources":["../../../src/deploy/settings/build-manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-manifest.js","sourceRoot":"","sources":["../../../src/deploy/settings/build-manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,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CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,kBAAkB,YAAY,wCAAwC,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1D,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/G,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AAChE,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport { isPathInside, isRecord, sortStrings, toPosixPath } from \"@gtkx/utils\";\nimport { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { isAbsolute, join, relative, resolve } from \"node:path\";\nimport type { DeploySettings } from \"../types.js\";\nimport {\n BUILD_MANIFEST_FILENAME,\n BUILD_MANIFEST_FORMAT_VERSION,\n BUILD_MANIFEST_GENERATOR,\n type BuildManifest,\n configDigest,\n type RecordedPackage,\n} from \"../../internal/build-manifest.js\";\nimport {\n assertUniqueSchemaBasenames,\n projectRelativeSchemaPath,\n SCHEMA_SUFFIX,\n} from \"../../settings/schema.js\";\n\ntype ResolvedBuildManifest = {\n packages: RecordedPackage[];\n schemaFiles: string[];\n};\n\ntype ExpectedBuildConfig = {\n config: Config;\n configFile: string;\n};\n\nconst invalidManifest = (path: string): Error =>\n new Error(`Cannot deploy: ${path} is not a valid GTKX build manifest. Run \\`gtkx build\\` again.`);\n\nconst recordedSchemas = (value: unknown[], path: string): string[] =>\n value.map((entry) => {\n if (typeof entry !== \"string\") {\n throw invalidManifest(path);\n }\n\n return entry;\n });\n\nconst recordedPackage = (value: unknown, path: string): RecordedPackage => {\n if (\n !isRecord(value) ||\n typeof value.name !== \"string\" ||\n typeof value.dir !== \"string\" ||\n isAbsolute(value.dir) ||\n (value.version !== null && typeof value.version !== \"string\")\n ) {\n throw invalidManifest(path);\n }\n\n return { name: value.name, version: value.version, dir: value.dir };\n};\n\nconst parseBuildManifest = (value: unknown, path: string): BuildManifest => {\n if (\n !isRecord(value) ||\n value.generator !== BUILD_MANIFEST_GENERATOR ||\n value.formatVersion !== BUILD_MANIFEST_FORMAT_VERSION ||\n typeof value.configFile !== \"string\" ||\n typeof value.configDigest !== \"string\" ||\n !Array.isArray(value.schemas) ||\n !Array.isArray(value.packages)\n ) {\n throw invalidManifest(path);\n }\n\n const packages: unknown[] = value.packages;\n\n return {\n generator: BUILD_MANIFEST_GENERATOR,\n formatVersion: BUILD_MANIFEST_FORMAT_VERSION,\n configFile: value.configFile,\n configDigest: value.configDigest,\n schemas: recordedSchemas(value.schemas, path),\n packages: packages.map((entry) => recordedPackage(entry, path)),\n };\n};\n\nconst isFile = (path: string): boolean => statSync(path, { throwIfNoEntry: false })?.isFile() === true;\n\nconst resolveRecordedSchema = (root: string, manifestPath: string, entry: string): string => {\n if (isAbsolute(entry) || !entry.endsWith(SCHEMA_SUFFIX)) {\n throw new Error(`Cannot deploy: ${manifestPath} records an invalid GSettings schema path.`);\n }\n\n const filePath = resolve(root, entry);\n\n if (!isPathInside(root, filePath)) {\n throw new Error(`Cannot deploy: ${manifestPath} records a GSettings schema outside the project.`);\n }\n\n if (!isFile(filePath)) {\n throw new Error(`Cannot deploy: the recorded GSettings schema ${filePath} is missing.`);\n }\n\n if (projectRelativeSchemaPath(root, filePath) === null) {\n throw new Error(`Cannot deploy: ${manifestPath} records a GSettings schema outside the project.`);\n }\n\n return filePath;\n};\n\nconst assertBuildConfig = (\n settings: DeploySettings,\n manifestPath: string,\n manifest: BuildManifest,\n expected: ExpectedBuildConfig,\n): void => {\n const expectedFile = toPosixPath(relative(settings.paths.root, expected.configFile));\n\n if (manifest.configFile !== expectedFile || manifest.configDigest !== configDigest(expected.config)) {\n throw new Error(`Cannot deploy: ${manifestPath} was built from a different GTKX configuration.`);\n }\n};\n\nconst readBuildManifest = (settings: DeploySettings, expected: ExpectedBuildConfig): ResolvedBuildManifest => {\n const manifestPath = join(settings.paths.dist, BUILD_MANIFEST_FILENAME);\n\n if (!existsSync(manifestPath)) {\n throw new Error(`Cannot deploy: ${manifestPath} is missing. Run \\`gtkx build\\` first.`);\n }\n\n const parsed: unknown = JSON.parse(readFileSync(manifestPath, \"utf8\"));\n const manifest = parseBuildManifest(parsed, manifestPath);\n assertBuildConfig(settings, manifestPath, manifest, expected);\n const files = manifest.schemas.map((entry) => resolveRecordedSchema(settings.paths.root, manifestPath, entry));\n const unique = sortStrings(new Set(files));\n assertUniqueSchemaBasenames(unique);\n\n return { packages: manifest.packages, schemaFiles: unique };\n};\n\nexport { readBuildManifest };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DeployConfig, DeployExtraFile } from "../types.js";
|
|
2
|
-
declare const resolveExtraFiles: (deploy: DeployConfig) => DeployExtraFile[];
|
|
2
|
+
declare const resolveExtraFiles: (root: string, deploy: DeployConfig) => DeployExtraFile[];
|
|
3
3
|
export { resolveExtraFiles };
|
|
4
4
|
//# sourceMappingURL=extra-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra-files.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/extra-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extra-files.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/extra-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+BjE,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,QAAQ,YAAY,KAAG,eAAe,EAS9E,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import { statSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
1
3
|
const OCTAL_RADIX = 8;
|
|
4
|
+
const assertSourceFile = (root, file) => {
|
|
5
|
+
const source = resolve(root, file.source);
|
|
6
|
+
try {
|
|
7
|
+
if (statSync(source).isFile()) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
throw new Error(`Cannot install "${file.destination}": its source file "${file.source}" does not exist`);
|
|
13
|
+
}
|
|
14
|
+
throw new Error(`Cannot install "${file.destination}": its source "${file.source}" is not a file`);
|
|
15
|
+
};
|
|
2
16
|
const resolveExtraFile = (destination, entry) => {
|
|
3
17
|
if (typeof entry === "string") {
|
|
4
18
|
return { destination, source: entry, mode: null };
|
|
@@ -6,6 +20,13 @@ const resolveExtraFile = (destination, entry) => {
|
|
|
6
20
|
const mode = entry.mode === undefined ? null : Number.parseInt(entry.mode, OCTAL_RADIX);
|
|
7
21
|
return { destination, source: entry.source, mode };
|
|
8
22
|
};
|
|
9
|
-
const resolveExtraFiles = (deploy) =>
|
|
23
|
+
const resolveExtraFiles = (root, deploy) => {
|
|
24
|
+
const files = Object.entries(deploy.extraFiles ?? {})
|
|
25
|
+
.map(([destination, entry]) => resolveExtraFile(destination, entry));
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
assertSourceFile(root, file);
|
|
28
|
+
}
|
|
29
|
+
return files;
|
|
30
|
+
};
|
|
10
31
|
export { resolveExtraFiles };
|
|
11
32
|
//# sourceMappingURL=extra-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extra-files.js","sourceRoot":"","sources":["../../../src/deploy/settings/extra-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extra-files.js","sourceRoot":"","sources":["../../../src/deploy/settings/extra-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,IAAqB,EAAQ,EAAE;IACnE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE1C,IAAI,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5B,OAAO;QACX,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,WAAW,uBAAuB,IAAI,CAAC,MAAM,kBAAkB,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,WAAW,kBAAkB,IAAI,CAAC,MAAM,iBAAiB,CAAC,CAAC;AACvG,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,KAAqB,EAAmB,EAAE;IACrF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAExF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,MAAoB,EAAqB,EAAE;IAChF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport type { DeployConfig, DeployExtraFile } from \"../types.js\";\n\ntype ExtraFiles = NonNullable<DeployConfig[\"extraFiles\"]>;\ntype ExtraFileEntry = NonNullable<ExtraFiles[string]>;\n\nconst OCTAL_RADIX = 8;\n\nconst assertSourceFile = (root: string, file: DeployExtraFile): void => {\n const source = resolve(root, file.source);\n\n try {\n if (statSync(source).isFile()) {\n return;\n }\n } catch {\n throw new Error(`Cannot install \"${file.destination}\": its source file \"${file.source}\" does not exist`);\n }\n\n throw new Error(`Cannot install \"${file.destination}\": its source \"${file.source}\" is not a file`);\n};\n\nconst resolveExtraFile = (destination: string, entry: ExtraFileEntry): DeployExtraFile => {\n if (typeof entry === \"string\") {\n return { destination, source: entry, mode: null };\n }\n\n const mode = entry.mode === undefined ? null : Number.parseInt(entry.mode, OCTAL_RADIX);\n\n return { destination, source: entry.source, mode };\n};\n\nconst resolveExtraFiles = (root: string, deploy: DeployConfig): DeployExtraFile[] => {\n const files = Object.entries(deploy.extraFiles ?? {})\n .map(([destination, entry]) => resolveExtraFile(destination, entry));\n\n for (const file of files) {\n assertSourceFile(root, file);\n }\n\n return files;\n};\n\nexport { resolveExtraFiles };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAKR,cAAc,EAEjB,MAAM,aAAa,CAAC;AAsBrB,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC1B,CAAC;AAwIF,QAAA,MAAM,qBAAqB,GAAI,SAAS,eAAe,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAKR,cAAc,EAEjB,MAAM,aAAa,CAAC;AAsBrB,KAAK,eAAe,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC1B,CAAC;AAwIF,QAAA,MAAM,qBAAqB,GAAI,SAAS,eAAe,KAAG,cAsBzD,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -89,10 +89,11 @@ const resolveDeploySettings = (request) => {
|
|
|
89
89
|
const core = resolveCore(request);
|
|
90
90
|
const deploy = core.identity.deploy;
|
|
91
91
|
return {
|
|
92
|
+
configFile: request.configFile,
|
|
92
93
|
...identitySlice(core),
|
|
93
94
|
...metadataSlice(request.root, core),
|
|
94
95
|
...desktopSlice(deploy),
|
|
95
|
-
extraFiles: resolveExtraFiles(deploy),
|
|
96
|
+
extraFiles: resolveExtraFiles(request.root, deploy),
|
|
96
97
|
versions: core.versions,
|
|
97
98
|
arch: resolveArch(),
|
|
98
99
|
paths: resolvePaths({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deploy/settings/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAEH,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,oBAAoB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA+C/C,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,MAAM,gBAAgB,GAAG,CAAC,KAAyB,EAAe,EAAE;IAChE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IACh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AC,MAAM,CAAC,OAAO;QAChC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK;KAC/B,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;AACrH,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,OAAwB,EAAkB,EAAE;IACvE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAEpC,OAAO;QACH,GAAG,aAAa,CAAC,IAAI,CAAC;QACtB,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;QACpC,GAAG,YAAY,CAAC,MAAM,CAAC;QACvB,UAAU,EAAE,iBAAiB,CAAC,MAAM,CAAC;QACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,WAAW,EAAE;QACnB,KAAK,EAAE,YAAY,CAAC;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM;YACN,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe;YAC/C,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa;YAC3C,cAAc,EAAE,OAAO,CAAC,cAAc;SACzC,CAAC;QACF,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;QACjD,MAAM;KACT,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport type {\n DeployConfig,\n DeployDesktopAction,\n DeployDeveloper,\n DeployRelease,\n DeploySettings,\n DeployVersions,\n} from \"../types.js\";\nimport { resolveArch } from \"./arch.js\";\nimport { resolveExecToken, resolveFileAssociations, resolveMimeTypes } from \"./exec.js\";\nimport { resolveExtraFiles } from \"./extra-files.js\";\nimport {\n type IdentityRequest,\n resolveBinaryName,\n resolveCopyright,\n resolveDescription,\n resolveDeveloper,\n resolveLicense,\n resolveMetadataLicense,\n resolveName,\n resolveSummary,\n resolveVersionString,\n} from \"./identity.js\";\nimport { resolveLibraries } from \"./libraries.js\";\nimport { readPackageManifest } from \"./package-manifest.js\";\nimport { resolvePaths } from \"./paths.js\";\nimport { resolveScreenshots } from \"./screenshots.js\";\nimport { resolveVersions } from \"./version.js\";\n\ntype SettingsRequest = {\n root: string;\n config: Config;\n outDirOverride?: string | undefined;\n now?: Date | undefined;\n};\n\ntype ResolvedCore = {\n identity: IdentityRequest;\n developer: DeployDeveloper;\n versions: DeployVersions;\n date: string;\n};\n\ntype IdentitySlice = Pick<\n DeploySettings,\n | \"applicationId\" |\n \"binaryName\" |\n \"copyright\" |\n \"description\" |\n \"developer\" |\n \"genericName\" |\n \"homepage\" |\n \"license\" |\n \"metadataLicense\" |\n \"name\" |\n \"summary\"\n>;\n\ntype MetadataSlice = Pick<\n DeploySettings,\n \"branding\" | \"categories\" | \"contentRating\" | \"keywords\" | \"mimeTypes\" | \"releases\" | \"screenshots\" | \"urls\"\n>;\n\ntype DesktopSlice = Pick<\n DeploySettings,\n | \"desktopActions\" |\n \"desktopEntry\" |\n \"execArgs\" |\n \"execToken\" |\n \"fileAssociations\" |\n \"isDbusActivatable\" |\n \"protocols\"\n>;\n\nconst ISO_DATE_LENGTH = 10;\nconst MILLISECONDS_PER_SECOND = 1000;\n\nconst reproducibleDate = (epoch: string | undefined): Date | null => {\n if (epoch === undefined || epoch.trim().length === 0) {\n return null;\n }\n\n const seconds = Number(epoch);\n\n return Number.isFinite(seconds) ? new Date(seconds * MILLISECONDS_PER_SECOND) : null;\n};\n\nconst buildDate = (now: Date): string => {\n const stamp = reproducibleDate(process.env.SOURCE_DATE_EPOCH) ?? now;\n\n return stamp.toISOString().slice(0, ISO_DATE_LENGTH);\n};\n\nconst newestFirst = (a: DeployRelease, b: DeployRelease): number => Number(a.date < b.date) - Number(a.date > b.date);\n\nconst resolveReleases = (deploy: DeployConfig, version: string, date: string): DeployRelease[] =>\n (deploy.releases ?? [{ version, date }])\n .map((entry) => ({\n version: entry.version,\n date: entry.date,\n type: entry.type ?? null,\n urgency: entry.urgency ?? null,\n notes: entry.notes ?? [],\n url: entry.url ?? null,\n }))\n .toSorted(newestFirst);\n\nconst resolveDesktopActions = (deploy: DeployConfig): DeployDesktopAction[] =>\n Object.entries(deploy.desktopActions ?? {}).map(([id, action]) => ({\n id,\n name: action.name,\n args: action.args ?? [],\n icon: action.icon ?? null,\n }));\n\nconst identitySlice = ({ identity, developer, date }: ResolvedCore): IdentitySlice => ({\n applicationId: identity.applicationId,\n binaryName: resolveBinaryName(identity),\n name: resolveName(identity),\n genericName: identity.deploy.genericName ?? null,\n summary: resolveSummary(identity),\n description: resolveDescription(identity),\n developer,\n license: resolveLicense(identity),\n metadataLicense: resolveMetadataLicense(identity),\n copyright: resolveCopyright(identity, developer, new Date(date).getUTCFullYear()),\n homepage: identity.deploy.homepage ?? identity.manifest.homepage,\n});\n\nconst metadataSlice = (root: string, { identity, versions, date }: ResolvedCore): MetadataSlice => {\n const deploy = identity.deploy;\n\n return {\n keywords: deploy.keywords ?? [],\n categories: deploy.categories ?? [],\n mimeTypes: resolveMimeTypes(deploy),\n urls: deploy.urls ?? {},\n screenshots: resolveScreenshots({ root, deploy }),\n branding: deploy.branding ?? null,\n contentRating: deploy.contentRating ?? {},\n releases: resolveReleases(deploy, versions.packageVersion, date),\n };\n};\n\nconst desktopSlice = (deploy: DeployConfig): DesktopSlice => ({\n execArgs: deploy.execArgs ?? [],\n execToken: resolveExecToken(deploy),\n fileAssociations: resolveFileAssociations(deploy),\n protocols: deploy.protocols ?? [],\n desktopActions: resolveDesktopActions(deploy),\n desktopEntry: deploy.desktopEntry ?? {},\n isDbusActivatable: deploy.isDbusActivatable ?? false,\n});\n\nconst resolveCore = (request: SettingsRequest): ResolvedCore => {\n const identity: IdentityRequest = {\n applicationId: request.config.applicationId,\n deploy: request.config.deploy ?? {},\n manifest: readPackageManifest(request.root),\n };\n\n const versions = resolveVersions({\n version: resolveVersionString(identity),\n release: identity.deploy.release,\n epoch: identity.deploy.epoch,\n });\n\n return { identity, developer: resolveDeveloper(identity), versions, date: buildDate(request.now ?? new Date()) };\n};\n\nconst resolveDeploySettings = (request: SettingsRequest): DeploySettings => {\n const core = resolveCore(request);\n const deploy = core.identity.deploy;\n\n return {\n ...identitySlice(core),\n ...metadataSlice(request.root, core),\n ...desktopSlice(deploy),\n extraFiles: resolveExtraFiles(deploy),\n versions: core.versions,\n arch: resolveArch(),\n paths: resolvePaths({\n root: request.root,\n deploy,\n applicationIcon: request.config.applicationIcon,\n applicationId: request.config.applicationId,\n outDirOverride: request.outDirOverride,\n }),\n ...resolveLibraries(request.root, request.config),\n deploy,\n };\n};\n\nexport { resolveDeploySettings };\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deploy/settings/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAEH,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,cAAc,EACd,oBAAoB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,kBAAkB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aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa;YAC3C,cAAc,EAAE,OAAO,CAAC,cAAc;SACzC,CAAC;QACF,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;QACjD,MAAM;KACT,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport type {\n DeployConfig,\n DeployDesktopAction,\n DeployDeveloper,\n DeployRelease,\n DeploySettings,\n DeployVersions,\n} from \"../types.js\";\nimport { resolveArch } from \"./arch.js\";\nimport { resolveExecToken, resolveFileAssociations, resolveMimeTypes } from \"./exec.js\";\nimport { resolveExtraFiles } from \"./extra-files.js\";\nimport {\n type IdentityRequest,\n resolveBinaryName,\n resolveCopyright,\n resolveDescription,\n resolveDeveloper,\n resolveLicense,\n resolveMetadataLicense,\n resolveName,\n resolveSummary,\n resolveVersionString,\n} from \"./identity.js\";\nimport { resolveLibraries } from \"./libraries.js\";\nimport { readPackageManifest } from \"./package-manifest.js\";\nimport { resolvePaths } from \"./paths.js\";\nimport { resolveScreenshots } from \"./screenshots.js\";\nimport { resolveVersions } from \"./version.js\";\n\ntype SettingsRequest = {\n root: string;\n config: Config;\n configFile: string;\n outDirOverride?: string | undefined;\n now?: Date | undefined;\n};\n\ntype ResolvedCore = {\n identity: IdentityRequest;\n developer: DeployDeveloper;\n versions: DeployVersions;\n date: string;\n};\n\ntype IdentitySlice = Pick<\n DeploySettings,\n | \"applicationId\" |\n \"binaryName\" |\n \"copyright\" |\n \"description\" |\n \"developer\" |\n \"genericName\" |\n \"homepage\" |\n \"license\" |\n \"metadataLicense\" |\n \"name\" |\n \"summary\"\n>;\n\ntype MetadataSlice = Pick<\n DeploySettings,\n \"branding\" | \"categories\" | \"contentRating\" | \"keywords\" | \"mimeTypes\" | \"releases\" | \"screenshots\" | \"urls\"\n>;\n\ntype DesktopSlice = Pick<\n DeploySettings,\n | \"desktopActions\" |\n \"desktopEntry\" |\n \"execArgs\" |\n \"execToken\" |\n \"fileAssociations\" |\n \"isDbusActivatable\" |\n \"protocols\"\n>;\n\nconst ISO_DATE_LENGTH = 10;\nconst MILLISECONDS_PER_SECOND = 1000;\n\nconst reproducibleDate = (epoch: string | undefined): Date | null => {\n if (epoch === undefined || epoch.trim().length === 0) {\n return null;\n }\n\n const seconds = Number(epoch);\n\n return Number.isFinite(seconds) ? new Date(seconds * MILLISECONDS_PER_SECOND) : null;\n};\n\nconst buildDate = (now: Date): string => {\n const stamp = reproducibleDate(process.env.SOURCE_DATE_EPOCH) ?? now;\n\n return stamp.toISOString().slice(0, ISO_DATE_LENGTH);\n};\n\nconst newestFirst = (a: DeployRelease, b: DeployRelease): number => Number(a.date < b.date) - Number(a.date > b.date);\n\nconst resolveReleases = (deploy: DeployConfig, version: string, date: string): DeployRelease[] =>\n (deploy.releases ?? [{ version, date }])\n .map((entry) => ({\n version: entry.version,\n date: entry.date,\n type: entry.type ?? null,\n urgency: entry.urgency ?? null,\n notes: entry.notes ?? [],\n url: entry.url ?? null,\n }))\n .toSorted(newestFirst);\n\nconst resolveDesktopActions = (deploy: DeployConfig): DeployDesktopAction[] =>\n Object.entries(deploy.desktopActions ?? {}).map(([id, action]) => ({\n id,\n name: action.name,\n args: action.args ?? [],\n icon: action.icon ?? null,\n }));\n\nconst identitySlice = ({ identity, developer, date }: ResolvedCore): IdentitySlice => ({\n applicationId: identity.applicationId,\n binaryName: resolveBinaryName(identity),\n name: resolveName(identity),\n genericName: identity.deploy.genericName ?? null,\n summary: resolveSummary(identity),\n description: resolveDescription(identity),\n developer,\n license: resolveLicense(identity),\n metadataLicense: resolveMetadataLicense(identity),\n copyright: resolveCopyright(identity, developer, new Date(date).getUTCFullYear()),\n homepage: identity.deploy.homepage ?? identity.manifest.homepage,\n});\n\nconst metadataSlice = (root: string, { identity, versions, date }: ResolvedCore): MetadataSlice => {\n const deploy = identity.deploy;\n\n return {\n keywords: deploy.keywords ?? [],\n categories: deploy.categories ?? [],\n mimeTypes: resolveMimeTypes(deploy),\n urls: deploy.urls ?? {},\n screenshots: resolveScreenshots({ root, deploy }),\n branding: deploy.branding ?? null,\n contentRating: deploy.contentRating ?? {},\n releases: resolveReleases(deploy, versions.packageVersion, date),\n };\n};\n\nconst desktopSlice = (deploy: DeployConfig): DesktopSlice => ({\n execArgs: deploy.execArgs ?? [],\n execToken: resolveExecToken(deploy),\n fileAssociations: resolveFileAssociations(deploy),\n protocols: deploy.protocols ?? [],\n desktopActions: resolveDesktopActions(deploy),\n desktopEntry: deploy.desktopEntry ?? {},\n isDbusActivatable: deploy.isDbusActivatable ?? false,\n});\n\nconst resolveCore = (request: SettingsRequest): ResolvedCore => {\n const identity: IdentityRequest = {\n applicationId: request.config.applicationId,\n deploy: request.config.deploy ?? {},\n manifest: readPackageManifest(request.root),\n };\n\n const versions = resolveVersions({\n version: resolveVersionString(identity),\n release: identity.deploy.release,\n epoch: identity.deploy.epoch,\n });\n\n return { identity, developer: resolveDeveloper(identity), versions, date: buildDate(request.now ?? new Date()) };\n};\n\nconst resolveDeploySettings = (request: SettingsRequest): DeploySettings => {\n const core = resolveCore(request);\n const deploy = core.identity.deploy;\n\n return {\n configFile: request.configFile,\n ...identitySlice(core),\n ...metadataSlice(request.root, core),\n ...desktopSlice(deploy),\n extraFiles: resolveExtraFiles(request.root, deploy),\n versions: core.versions,\n arch: resolveArch(),\n paths: resolvePaths({\n root: request.root,\n deploy,\n applicationIcon: request.config.applicationIcon,\n applicationId: request.config.applicationId,\n outDirOverride: request.outDirOverride,\n }),\n ...resolveLibraries(request.root, request.config),\n deploy,\n };\n};\n\nexport { resolveDeploySettings };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/libraries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/libraries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAQ3C,KAAK,iBAAiB,GAAG;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClD,CAAC;AAUF,QAAA,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,iBASxD,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { resolveLibraries as expandLibraries, readGeneratedLibraries,
|
|
2
|
-
import { resolveFuture } from "@gtkx/config/internal";
|
|
1
|
+
import { resolveLibraries as expandLibraries, readGeneratedLibraries, resolveStore, } from "@gtkx/codegen";
|
|
3
2
|
const generatedLibraries = (root) => {
|
|
4
3
|
try {
|
|
5
4
|
return readGeneratedLibraries(resolveStore(root).gi.storeDir);
|
|
@@ -8,25 +7,9 @@ const generatedLibraries = (root) => {
|
|
|
8
7
|
return null;
|
|
9
8
|
}
|
|
10
9
|
};
|
|
11
|
-
const discoveredLibraries = (config, isAdwaitaDefault) => {
|
|
12
|
-
try {
|
|
13
|
-
return expandLibraries(config.libraries, resolveGirPath(config.girPath), isAdwaitaDefault);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const configLibraries = (config) => {
|
|
20
|
-
const { isAdwaitaDefault } = resolveFuture(config.future);
|
|
21
|
-
const libraries = config.libraries;
|
|
22
|
-
if (Array.isArray(libraries)) {
|
|
23
|
-
return expandLibraries(libraries, [], isAdwaitaDefault);
|
|
24
|
-
}
|
|
25
|
-
return discoveredLibraries(config, isAdwaitaDefault) ?? expandLibraries(undefined, [], isAdwaitaDefault);
|
|
26
|
-
};
|
|
27
10
|
const resolveLibraries = (root, config) => {
|
|
28
11
|
const generated = generatedLibraries(root);
|
|
29
|
-
const libraries = generated?.libraries ??
|
|
12
|
+
const libraries = generated?.libraries ?? expandLibraries(config.libraries);
|
|
30
13
|
const deploy = config.deploy ?? {};
|
|
31
14
|
return {
|
|
32
15
|
libraries,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../../../src/deploy/settings/libraries.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,IAAI,eAAe,EAEnC,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../../../src/deploy/settings/libraries.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,IAAI,eAAe,EAEnC,sBAAsB,EACtB,YAAY,GACf,MAAM,eAAe,CAAC;AAOvB,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAA6B,EAAE;IACnE,IAAI,CAAC;QACD,OAAO,sBAAsB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,MAAc,EAAqB,EAAE;IACzE,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,SAAS,EAAE,SAAS,IAAI,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAEnC,OAAO;QACH,SAAS;QACT,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,IAAI,EAAE;KAC9D,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport {\n resolveLibraries as expandLibraries,\n type GeneratedLibraries,\n readGeneratedLibraries,\n resolveStore,\n} from \"@gtkx/codegen\";\n\ntype ResolvedLibraries = {\n libraries: string[];\n minimumLibraryVersions: Record<string, string>;\n};\n\nconst generatedLibraries = (root: string): GeneratedLibraries | null => {\n try {\n return readGeneratedLibraries(resolveStore(root).gi.storeDir);\n } catch {\n return null;\n }\n};\n\nconst resolveLibraries = (root: string, config: Config): ResolvedLibraries => {\n const generated = generatedLibraries(root);\n const libraries = generated?.libraries ?? expandLibraries(config.libraries);\n const deploy = config.deploy ?? {};\n\n return {\n libraries,\n minimumLibraryVersions: deploy.minimumLibraryVersions ?? {},\n };\n};\n\nexport { resolveLibraries };\n"]}
|
|
@@ -7,7 +7,7 @@ type PathsRequest = {
|
|
|
7
7
|
applicationId: Config["applicationId"];
|
|
8
8
|
outDirOverride: string | undefined;
|
|
9
9
|
};
|
|
10
|
-
declare const
|
|
10
|
+
declare const prepareDeployOutDir: (root: string, outDir: string) => void;
|
|
11
11
|
declare const resolvePaths: (request: PathsRequest) => DeployPaths;
|
|
12
|
-
export {
|
|
12
|
+
export { prepareDeployOutDir, resolvePaths };
|
|
13
13
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI7D,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAoEF,QAAA,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,IAW3D,CAAC;AAmBF,QAAA,MAAM,YAAY,GAAI,SAAS,YAAY,KAAG,WAkB7C,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,29 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { isPathInside } from "@gtkx/utils";
|
|
54
|
+
import { lstatSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
55
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
3
56
|
import { resolveApplicationIcon } from "../../internal/icon-path.js";
|
|
57
|
+
import { prepareOutputDirectory, readRegularFile } from "../../internal/output-directory.js";
|
|
4
58
|
const DEFAULT_OUT_DIR = "build";
|
|
5
59
|
const DIST_DIR = "dist";
|
|
60
|
+
const DEPLOY_MARKER_FILENAME = ".gtkx-deploy.json";
|
|
61
|
+
const DEPLOY_MARKER = `${JSON.stringify({ generator: "gtkx-deploy", formatVersion: 1 })}\n`;
|
|
6
62
|
const LICENSE_CANDIDATES = ["LICENSE", "LICENSE.md", "LICENSE.txt", "COPYING", "COPYING.md"];
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
63
|
+
const hasSymlinkComponent = (root, target) => {
|
|
64
|
+
let current = root;
|
|
65
|
+
for (const segment of relative(root, target).split(sep)) {
|
|
66
|
+
current = join(current, segment);
|
|
67
|
+
if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink() === true) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
73
|
+
const isDeployMarker = (path) => {
|
|
74
|
+
return readRegularFile(path) === DEPLOY_MARKER;
|
|
75
|
+
};
|
|
76
|
+
const isReusableDeployDirectory = (path) => {
|
|
77
|
+
const entry = lstatSync(path, { throwIfNoEntry: false });
|
|
78
|
+
if (entry === undefined) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return entry.isDirectory() &&
|
|
82
|
+
(readdirSync(path).length === 0 || isDeployMarker(join(path, DEPLOY_MARKER_FILENAME)));
|
|
83
|
+
};
|
|
84
|
+
const deployOutputError = (root, configured) => new Error(`Cannot use "${configured}" as the deploy output directory: choose an empty directory or an ` +
|
|
85
|
+
`earlier GTKX deploy directory below ${root}`);
|
|
86
|
+
const assertSafeDeployOutDir = (root, outDir, configured) => {
|
|
87
|
+
const dist = join(root, DIST_DIR);
|
|
88
|
+
if (outDir === dist ||
|
|
89
|
+
!isPathInside(root, outDir) ||
|
|
90
|
+
isPathInside(dist, outDir) ||
|
|
91
|
+
hasSymlinkComponent(root, outDir)) {
|
|
92
|
+
throw deployOutputError(root, configured);
|
|
93
|
+
}
|
|
10
94
|
};
|
|
11
95
|
const resolveOutDir = ({ root, deploy, outDirOverride }) => {
|
|
12
96
|
const configured = outDirOverride ?? deploy.outDir ?? DEFAULT_OUT_DIR;
|
|
13
97
|
const outDir = resolve(root, configured);
|
|
14
|
-
|
|
15
|
-
|
|
98
|
+
assertSafeDeployOutDir(root, outDir, configured);
|
|
99
|
+
if (!isReusableDeployDirectory(outDir)) {
|
|
100
|
+
throw deployOutputError(root, configured);
|
|
16
101
|
}
|
|
17
102
|
return outDir;
|
|
18
103
|
};
|
|
19
|
-
const
|
|
104
|
+
const prepareDeployOutDir = (root, outDir) => {
|
|
105
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
20
106
|
try {
|
|
21
|
-
|
|
107
|
+
assertSafeDeployOutDir(root, outDir, outDir);
|
|
108
|
+
const prepared = prepareOutputDirectory(root, outDir, isReusableDeployDirectory);
|
|
109
|
+
if (prepared.status === "unsafe") {
|
|
110
|
+
throw deployOutputError(root, outDir);
|
|
111
|
+
}
|
|
112
|
+
const transaction = __addDisposableResource(env_1, prepared.transaction, false);
|
|
113
|
+
transaction.commit();
|
|
114
|
+
writeFileSync(join(outDir, DEPLOY_MARKER_FILENAME), DEPLOY_MARKER, { flag: "wx" });
|
|
115
|
+
}
|
|
116
|
+
catch (e_1) {
|
|
117
|
+
env_1.error = e_1;
|
|
118
|
+
env_1.hasError = true;
|
|
22
119
|
}
|
|
23
|
-
|
|
24
|
-
|
|
120
|
+
finally {
|
|
121
|
+
__disposeResources(env_1);
|
|
25
122
|
}
|
|
26
123
|
};
|
|
124
|
+
const existingFile = (path) => statSync(path, { throwIfNoEntry: false })?.isFile() === true ? path : null;
|
|
27
125
|
const resolveLicenseFile = (root, configured) => {
|
|
28
126
|
if (configured !== undefined) {
|
|
29
127
|
const path = resolve(root, configured);
|
|
@@ -52,5 +150,5 @@ const resolvePaths = (request) => {
|
|
|
52
150
|
schemaFiles: [],
|
|
53
151
|
};
|
|
54
152
|
};
|
|
55
|
-
export {
|
|
153
|
+
export { prepareDeployOutDir, resolvePaths };
|
|
56
154
|
//# sourceMappingURL=paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/deploy/settings/paths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/deploy/settings/paths.ts"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ACN,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport { isPathInside } from \"@gtkx/utils\";\nimport { lstatSync, readdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport type { DeployConfig, DeployPaths } from \"../types.js\";\nimport { resolveApplicationIcon } from \"../../internal/icon-path.js\";\nimport { prepareOutputDirectory, readRegularFile } from \"../../internal/output-directory.js\";\n\ntype PathsRequest = {\n root: string;\n deploy: DeployConfig;\n applicationIcon: Config[\"applicationIcon\"];\n applicationId: Config[\"applicationId\"];\n outDirOverride: string | undefined;\n};\n\nconst DEFAULT_OUT_DIR = \"build\";\nconst DIST_DIR = \"dist\";\nconst DEPLOY_MARKER_FILENAME = \".gtkx-deploy.json\";\nconst DEPLOY_MARKER = `${JSON.stringify({ generator: \"gtkx-deploy\", formatVersion: 1 })}\\n`;\nconst LICENSE_CANDIDATES = [\"LICENSE\", \"LICENSE.md\", \"LICENSE.txt\", \"COPYING\", \"COPYING.md\"];\n\nconst hasSymlinkComponent = (root: string, target: string): boolean => {\n let current = root;\n\n for (const segment of relative(root, target).split(sep)) {\n current = join(current, segment);\n\n if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink() === true) {\n return true;\n }\n }\n\n return false;\n};\n\nconst isDeployMarker = (path: string): boolean => {\n return readRegularFile(path) === DEPLOY_MARKER;\n};\n\nconst isReusableDeployDirectory = (path: string): boolean => {\n const entry = lstatSync(path, { throwIfNoEntry: false });\n\n if (entry === undefined) {\n return true;\n }\n\n return entry.isDirectory() &&\n (readdirSync(path).length === 0 || isDeployMarker(join(path, DEPLOY_MARKER_FILENAME)));\n};\n\nconst deployOutputError = (root: string, configured: string): Error =>\n new Error(\n `Cannot use \"${configured}\" as the deploy output directory: choose an empty directory or an ` +\n `earlier GTKX deploy directory below ${root}`,\n );\n\nconst assertSafeDeployOutDir = (root: string, outDir: string, configured: string): void => {\n const dist = join(root, DIST_DIR);\n\n if (\n outDir === dist ||\n !isPathInside(root, outDir) ||\n isPathInside(dist, outDir) ||\n hasSymlinkComponent(root, outDir)\n ) {\n throw deployOutputError(root, configured);\n }\n};\n\nconst resolveOutDir = ({ root, deploy, outDirOverride }: PathsRequest): string => {\n const configured = outDirOverride ?? deploy.outDir ?? DEFAULT_OUT_DIR;\n const outDir = resolve(root, configured);\n assertSafeDeployOutDir(root, outDir, configured);\n\n if (!isReusableDeployDirectory(outDir)) {\n throw deployOutputError(root, configured);\n }\n\n return outDir;\n};\n\nconst prepareDeployOutDir = (root: string, outDir: string): void => {\n assertSafeDeployOutDir(root, outDir, outDir);\n const prepared = prepareOutputDirectory(root, outDir, isReusableDeployDirectory);\n\n if (prepared.status === \"unsafe\") {\n throw deployOutputError(root, outDir);\n }\n\n using transaction = prepared.transaction;\n transaction.commit();\n writeFileSync(join(outDir, DEPLOY_MARKER_FILENAME), DEPLOY_MARKER, { flag: \"wx\" });\n};\n\nconst existingFile = (path: string): string | null =>\n statSync(path, { throwIfNoEntry: false })?.isFile() === true ? path : null;\n\nconst resolveLicenseFile = (root: string, configured: string | undefined): string | null => {\n if (configured !== undefined) {\n const path = resolve(root, configured);\n\n if (existingFile(path) === null) {\n throw new Error(`Cannot read the license file \"${configured}\": no such file under ${root}`);\n }\n\n return path;\n }\n\n return LICENSE_CANDIDATES.map((name) => existingFile(join(root, name))).find((path) => path !== null) ?? null;\n};\n\nconst resolvePaths = (request: PathsRequest): DeployPaths => {\n const { root, deploy } = request;\n const outDir = resolveOutDir(request);\n\n return {\n root,\n dist: join(root, DIST_DIR),\n outDir,\n metadata: join(outDir, \"metadata\"),\n runtime: join(outDir, \"runtime\"),\n stage: join(outDir, \"stage\"),\n overlay: join(outDir, \"overlay\"),\n targets: join(outDir, \"targets\"),\n output: join(outDir, \"out\"),\n applicationIcon: resolveApplicationIcon(root, request.applicationId, request.applicationIcon),\n licenseFile: resolveLicenseFile(root, deploy.licenseFile),\n schemaFiles: [],\n };\n};\n\nexport { prepareDeployOutDir, resolvePaths };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/screenshots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../src/deploy/settings/screenshots.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,KAAK,iBAAiB,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;CACxB,CAAC;AA8DF,QAAA,MAAM,kBAAkB,GAAI,SAAS,iBAAiB,KAAG,gBAAgB,EAexE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|