@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,29 +1,20 @@
|
|
|
1
1
|
import { runCodegen as runCodegenCore } from "@gtkx/codegen";
|
|
2
|
-
import {
|
|
3
|
-
getShadowingStorePaths,
|
|
4
|
-
LIBRARIES_WILDCARD,
|
|
5
|
-
redundantLibraries,
|
|
6
|
-
sweepProjectStaging,
|
|
7
|
-
} from "@gtkx/codegen/internal";
|
|
2
|
+
import { getShadowingStorePaths, sweepProjectStaging } from "@gtkx/codegen/internal";
|
|
8
3
|
import { type Config, loadConfig } from "@gtkx/config";
|
|
9
4
|
import {
|
|
10
5
|
isAgentRulesEnabled,
|
|
11
|
-
type ResolvedFuture,
|
|
12
6
|
resolveElementComponents,
|
|
13
7
|
resolveElementProps,
|
|
14
|
-
resolveFuture,
|
|
15
8
|
resolveLazyElements,
|
|
16
9
|
resolveOmittedProps,
|
|
17
|
-
unknownFutureKeys,
|
|
18
10
|
} from "@gtkx/config/internal";
|
|
19
|
-
import { info
|
|
11
|
+
import { info } from "@gtkx/utils";
|
|
20
12
|
import { existsSync, rmSync } from "node:fs";
|
|
21
13
|
import { join, resolve } from "node:path";
|
|
22
14
|
import { resolveCatalogProject, synchronizeCatalogs } from "../i18n/catalogs.js";
|
|
23
15
|
import { extractSourceCatalog } from "../i18n/source-messages.js";
|
|
24
|
-
import { emitI18nTypes } from "../i18n/types.js";
|
|
16
|
+
import { clearI18nTypes, emitI18nTypes } from "../i18n/types.js";
|
|
25
17
|
import { upsertAgentRules } from "../internal/agent-rules.js";
|
|
26
|
-
import { resolveDataDir } from "../internal/data-dir.js";
|
|
27
18
|
import { discoverSourceFiles } from "../internal/source-imports.js";
|
|
28
19
|
import { emitSchemaEnv } from "../settings/schema.js";
|
|
29
20
|
import { type CodegenInputs, isCodegenStale, resolveCodegenInputs } from "./freshness.js";
|
|
@@ -33,6 +24,7 @@ import { type CodegenContext, type CodegenStore, resolveCodegenContext } from ".
|
|
|
33
24
|
type RunCodegenOptions = {
|
|
34
25
|
cwd?: string;
|
|
35
26
|
mode?: string | undefined;
|
|
27
|
+
configFile?: string | undefined;
|
|
36
28
|
isForced?: boolean;
|
|
37
29
|
inputs?: CodegenInputs;
|
|
38
30
|
resolved?: LoadedConfig;
|
|
@@ -48,12 +40,10 @@ type RunCodegenResult = {
|
|
|
48
40
|
isRegenerated: boolean;
|
|
49
41
|
namespaces: number;
|
|
50
42
|
intrinsicElements: number;
|
|
51
|
-
notices: string[];
|
|
52
43
|
duration: number;
|
|
53
|
-
girPath
|
|
54
|
-
configFile
|
|
55
|
-
libraries
|
|
56
|
-
future?: string[] | undefined;
|
|
44
|
+
girPath: string[];
|
|
45
|
+
configFile: string;
|
|
46
|
+
libraries: string[];
|
|
57
47
|
reference?: ReferenceResult | undefined;
|
|
58
48
|
};
|
|
59
49
|
|
|
@@ -62,7 +52,6 @@ type CodegenOptionsInput = {
|
|
|
62
52
|
libraries: string[];
|
|
63
53
|
girPath: string[];
|
|
64
54
|
elements: Config["elements"];
|
|
65
|
-
future: ResolvedFuture;
|
|
66
55
|
};
|
|
67
56
|
|
|
68
57
|
type PreparedCodegen = CodegenInputs & { isForced: boolean };
|
|
@@ -70,17 +59,10 @@ type PreparedCodegen = CodegenInputs & { isForced: boolean };
|
|
|
70
59
|
type EnsureGeneratedOptions = {
|
|
71
60
|
shouldAnnounce?: boolean;
|
|
72
61
|
mode?: string;
|
|
62
|
+
configFile?: string | undefined;
|
|
73
63
|
shouldPreserveI18nMetadata?: boolean | undefined;
|
|
74
64
|
};
|
|
75
65
|
|
|
76
|
-
type RunOptionsInput = {
|
|
77
|
-
root: string;
|
|
78
|
-
mode: string | undefined;
|
|
79
|
-
inputs: CodegenInputs | null;
|
|
80
|
-
resolved: LoadedConfig;
|
|
81
|
-
shouldPreserveI18nMetadata: boolean | undefined;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
66
|
const GIR_PATH_MISSING_MESSAGE =
|
|
85
67
|
"No GIR search paths available. Install gobject-introspection " +
|
|
86
68
|
"(Linux: `sudo dnf install gobject-introspection-devel` or `sudo apt install libgirepository1.0-dev`), " +
|
|
@@ -97,14 +79,9 @@ const removeShadowingStores = (cwd: string): void => {
|
|
|
97
79
|
removeStores(getShadowingStorePaths(cwd));
|
|
98
80
|
};
|
|
99
81
|
|
|
100
|
-
const codegenOptions = ({ store, libraries, girPath, elements
|
|
82
|
+
const codegenOptions = ({ store, libraries, girPath, elements }: CodegenOptionsInput) => ({
|
|
101
83
|
libraries,
|
|
102
84
|
girPath,
|
|
103
|
-
isByteArrayTyped: future.isByteArrayTyped,
|
|
104
|
-
isValueUnwrapped: future.isValueUnwrapped,
|
|
105
|
-
isFinishTrimmed: future.isFinishTrimmed,
|
|
106
|
-
isInoutInPlace: future.isInoutInPlace,
|
|
107
|
-
isTreeShaken: future.isTreeShaken,
|
|
108
85
|
gi: {
|
|
109
86
|
storeDir: store.giStoreDir,
|
|
110
87
|
linkDir: store.giLinkDir,
|
|
@@ -118,93 +95,30 @@ const codegenOptions = ({ store, libraries, girPath, elements, future }: Codegen
|
|
|
118
95
|
linkDir: store.jsxLinkDir,
|
|
119
96
|
version: store.react.version,
|
|
120
97
|
},
|
|
121
|
-
reactSubexports: store.react?.subexports ?? [],
|
|
122
98
|
userComponents: resolveElementComponents(elements),
|
|
123
99
|
userProps: resolveElementProps(elements),
|
|
124
100
|
userLazyElements: resolveLazyElements(elements),
|
|
125
101
|
userOmittedProps: resolveOmittedProps(elements),
|
|
126
102
|
});
|
|
127
103
|
|
|
128
|
-
const
|
|
129
|
-
const unknown: Set<string> = new Set(unknownFutureKeys(config.future));
|
|
130
|
-
|
|
131
|
-
return Object.entries(config.future ?? {})
|
|
132
|
-
.filter(([name, value]) => value === true && !unknown.has(name))
|
|
133
|
-
.map(([name]) => name);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const disabledCodegenResult = (configFile: string, notices: string[]): RunCodegenResult => ({
|
|
104
|
+
const disabledCodegenResult = (configFile: string): RunCodegenResult => ({
|
|
137
105
|
isRegenerated: false,
|
|
138
106
|
namespaces: 0,
|
|
139
107
|
intrinsicElements: 0,
|
|
140
|
-
notices,
|
|
141
108
|
duration: 0,
|
|
142
109
|
girPath: [],
|
|
143
110
|
configFile,
|
|
144
111
|
libraries: [],
|
|
145
112
|
});
|
|
146
113
|
|
|
147
|
-
const warnNotices = (notices: string[]): void => {
|
|
148
|
-
for (const notice of notices) {
|
|
149
|
-
warn(notice);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const unknownFutureNotice = (keys: string[]): string[] => {
|
|
154
|
-
if (keys.length === 0) {
|
|
155
|
-
return [];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return [
|
|
159
|
-
`gtkx.config.ts: \`future\` has no ${keys.join(", ")} flag, so the key is ignored. Check it against ` +
|
|
160
|
-
"the flags the configuration guide lists.",
|
|
161
|
-
];
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const redundantLibraryNotice = (entries: string[]): string[] => {
|
|
165
|
-
if (entries.length === 0) {
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return [
|
|
170
|
-
`gtkx.config.ts: \`future.v2DefaultLibraries\` binds ${entries.join(", ")} on its own, so naming them ` +
|
|
171
|
-
"in `libraries` changes nothing. Drop them; naming them becomes a configuration error in GTKX 2.0.",
|
|
172
|
-
];
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const wildcardLibrariesNotice = (libraries: Config["libraries"]): string[] => {
|
|
176
|
-
if (libraries !== LIBRARIES_WILDCARD) {
|
|
177
|
-
return [];
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return [
|
|
181
|
-
'gtkx.config.ts: `libraries: "*"` binds whatever the build host happens to have installed, so the ' +
|
|
182
|
-
"store changes with the machine. Instead, list the libraries the project needs; the wildcard is " +
|
|
183
|
-
"removed in GTKX 2.0.",
|
|
184
|
-
];
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const configNotices = (config: Config, future: ResolvedFuture): string[] => [
|
|
188
|
-
...unknownFutureNotice(unknownFutureKeys(config.future)),
|
|
189
|
-
...wildcardLibrariesNotice(config.libraries),
|
|
190
|
-
...redundantLibraryNotice(redundantLibraries(config.libraries, future.isAdwaitaDefault)),
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
const regeneratedStorePaths = (store: CodegenStore): string[] => {
|
|
194
|
-
if (store.react === null) {
|
|
195
|
-
return [store.giStoreDir, store.giLinkDir];
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return [store.giStoreDir, store.giLinkDir, store.jsxStoreDir, store.jsxLinkDir];
|
|
199
|
-
};
|
|
200
|
-
|
|
201
114
|
const clearGeneratedStores = (store: CodegenStore): void => {
|
|
202
|
-
removeStores(
|
|
115
|
+
removeStores(
|
|
116
|
+
store.react === null
|
|
117
|
+
? [store.giStoreDir, store.giLinkDir]
|
|
118
|
+
: [store.giStoreDir, store.giLinkDir, store.jsxStoreDir, store.jsxLinkDir],
|
|
119
|
+
);
|
|
203
120
|
};
|
|
204
121
|
|
|
205
|
-
const resolveLoadedConfig = async (options: RunCodegenOptions, cwd: string): Promise<LoadedConfig> =>
|
|
206
|
-
options.resolved ?? (await loadConfig(cwd, { mode: options.mode }));
|
|
207
|
-
|
|
208
122
|
const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config): PreparedCodegen => {
|
|
209
123
|
const { girPath, libraries, store } = options.inputs ?? resolveCodegenInputs(cwd, config);
|
|
210
124
|
|
|
@@ -219,17 +133,17 @@ const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config)
|
|
|
219
133
|
|
|
220
134
|
const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenResult> => {
|
|
221
135
|
const cwd = options.cwd ?? process.cwd();
|
|
222
|
-
const { config, configFile } = await
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
136
|
+
const { config, configFile } = options.resolved ?? (await loadConfig(cwd, {
|
|
137
|
+
mode: options.mode,
|
|
138
|
+
configFile: options.configFile,
|
|
139
|
+
}));
|
|
226
140
|
await syncI18n(cwd, config.applicationId, options.shouldPreserveI18nMetadata);
|
|
227
|
-
|
|
141
|
+
emitSchemaEnv(cwd);
|
|
228
142
|
|
|
229
143
|
if (config.codegen === false) {
|
|
230
144
|
removeShadowingStores(cwd);
|
|
231
145
|
|
|
232
|
-
return disabledCodegenResult(configFile
|
|
146
|
+
return disabledCodegenResult(configFile);
|
|
233
147
|
}
|
|
234
148
|
|
|
235
149
|
const { girPath, libraries, store, isForced } = prepareCodegen(options, cwd, config);
|
|
@@ -239,35 +153,28 @@ const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenRe
|
|
|
239
153
|
}
|
|
240
154
|
|
|
241
155
|
const result = await runCodegenCore({
|
|
242
|
-
...codegenOptions({ store, libraries, girPath, elements: config.elements
|
|
156
|
+
...codegenOptions({ store, libraries, girPath, elements: config.elements }),
|
|
243
157
|
isForced,
|
|
244
158
|
});
|
|
245
159
|
|
|
246
|
-
warnNotices(result.notices);
|
|
247
|
-
const notices = [...configured, ...result.notices];
|
|
248
160
|
const reference = await writeReference({ root: cwd, config, girPath, libraries, isForced });
|
|
249
|
-
|
|
161
|
+
|
|
162
|
+
if (isAgentRulesEnabled(config)) {
|
|
163
|
+
upsertAgentRules(cwd);
|
|
164
|
+
}
|
|
250
165
|
|
|
251
166
|
return {
|
|
252
167
|
isRegenerated: result.isRegenerated,
|
|
253
168
|
namespaces: result.namespaces,
|
|
254
169
|
intrinsicElements: result.intrinsicElements,
|
|
255
|
-
notices,
|
|
256
170
|
duration: result.duration,
|
|
257
171
|
girPath,
|
|
258
172
|
configFile,
|
|
259
173
|
libraries,
|
|
260
|
-
future: enabledFutureFlags(config),
|
|
261
174
|
reference,
|
|
262
175
|
};
|
|
263
176
|
};
|
|
264
177
|
|
|
265
|
-
const syncAgentRules = (root: string, config: Config): void => {
|
|
266
|
-
if (isAgentRulesEnabled(config)) {
|
|
267
|
-
upsertAgentRules(root);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
|
|
271
178
|
const syncI18n = async (
|
|
272
179
|
root: string,
|
|
273
180
|
applicationId: string,
|
|
@@ -276,21 +183,21 @@ const syncI18n = async (
|
|
|
276
183
|
const project = resolveCatalogProject(root, applicationId);
|
|
277
184
|
|
|
278
185
|
if (project === null) {
|
|
279
|
-
|
|
186
|
+
clearI18nTypes(root);
|
|
280
187
|
|
|
281
188
|
return;
|
|
282
189
|
}
|
|
283
190
|
|
|
284
191
|
const srcDir = join(root, "src");
|
|
285
192
|
const sourceFiles = discoverSourceFiles(existsSync(srcDir) ? srcDir : root);
|
|
286
|
-
|
|
193
|
+
await extractSourceCatalog(project, sourceFiles, shouldPreserveMetadataMessages);
|
|
287
194
|
synchronizeCatalogs(project);
|
|
288
|
-
emitI18nTypes(root
|
|
195
|
+
await emitI18nTypes(root);
|
|
289
196
|
};
|
|
290
197
|
|
|
291
|
-
const isCodegenDisabled = async (cwd: string, mode?: string): Promise<boolean> => {
|
|
198
|
+
const isCodegenDisabled = async (cwd: string, mode?: string, configFile?: string): Promise<boolean> => {
|
|
292
199
|
try {
|
|
293
|
-
const { config } = await loadConfig(cwd, { mode });
|
|
200
|
+
const { config } = await loadConfig(cwd, { mode, configFile });
|
|
294
201
|
|
|
295
202
|
return config.codegen === false;
|
|
296
203
|
} catch {
|
|
@@ -298,11 +205,6 @@ const isCodegenDisabled = async (cwd: string, mode?: string): Promise<boolean> =
|
|
|
298
205
|
}
|
|
299
206
|
};
|
|
300
207
|
|
|
301
|
-
const syncSchemaEnv = (cwd: string, isV2ResourceImports = false): void => {
|
|
302
|
-
const dataDir = isV2ResourceImports ? null : resolveDataDir(cwd);
|
|
303
|
-
emitSchemaEnv(cwd, dataDir, isV2ResourceImports);
|
|
304
|
-
};
|
|
305
|
-
|
|
306
208
|
const resolveInputsOrNull = (cwd: string, config: Config): CodegenInputs | null => {
|
|
307
209
|
try {
|
|
308
210
|
return resolveCodegenInputs(cwd, config);
|
|
@@ -321,20 +223,6 @@ const maybeAnnounceStale = (shouldAnnounce: boolean | undefined, inputs: Codegen
|
|
|
321
223
|
}
|
|
322
224
|
};
|
|
323
225
|
|
|
324
|
-
const getRunOptions = ({
|
|
325
|
-
root,
|
|
326
|
-
mode,
|
|
327
|
-
inputs,
|
|
328
|
-
resolved,
|
|
329
|
-
shouldPreserveI18nMetadata,
|
|
330
|
-
}: RunOptionsInput): RunCodegenOptions => {
|
|
331
|
-
if (inputs === null) {
|
|
332
|
-
return { cwd: root, mode, resolved, shouldPreserveI18nMetadata };
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return { cwd: root, mode, inputs, resolved, shouldPreserveI18nMetadata };
|
|
336
|
-
};
|
|
337
|
-
|
|
338
226
|
const isPreflightSkipped = (options: EnsureGeneratedOptions): boolean =>
|
|
339
227
|
options.shouldAnnounce === true && process.env.GTKX_DISABLE_PREFLIGHT === "1";
|
|
340
228
|
|
|
@@ -355,13 +243,13 @@ const generate = async (context: CodegenContext, options: EnsureGeneratedOptions
|
|
|
355
243
|
maybeAnnounceStale(options.shouldAnnounce, inputs);
|
|
356
244
|
const resolved = { config: context.config, configFile: context.configFile };
|
|
357
245
|
|
|
358
|
-
const result = await runCodegen(
|
|
359
|
-
|
|
246
|
+
const result = await runCodegen({
|
|
247
|
+
cwd: context.root,
|
|
360
248
|
mode: options.mode,
|
|
361
|
-
inputs,
|
|
362
249
|
resolved,
|
|
363
250
|
shouldPreserveI18nMetadata: options.shouldPreserveI18nMetadata,
|
|
364
|
-
|
|
251
|
+
...(inputs !== null && { inputs }),
|
|
252
|
+
});
|
|
365
253
|
|
|
366
254
|
return result.isRegenerated;
|
|
367
255
|
};
|
|
@@ -374,18 +262,21 @@ const ensureGeneratedIn = async (
|
|
|
374
262
|
|
|
375
263
|
/* eslint-disable-next-line unicorn/consistent-boolean-name -- the boolean reports whether codegen ran */
|
|
376
264
|
const ensureGenerated = async (cwd: string, options: EnsureGeneratedOptions = {}): Promise<boolean> =>
|
|
377
|
-
isPreflightSkipped(options)
|
|
265
|
+
isPreflightSkipped(options)
|
|
266
|
+
? false
|
|
267
|
+
: generate(await resolveCodegenContext(cwd, options.mode, options.configFile), options);
|
|
378
268
|
|
|
379
269
|
const resolveConfigWatch = async (
|
|
380
270
|
cwd: string,
|
|
381
271
|
mode?: string,
|
|
272
|
+
configFile?: string,
|
|
382
273
|
): Promise<{ paths: string[]; regenerate: () => Promise<void> }> => {
|
|
383
|
-
const
|
|
274
|
+
const loaded = await loadConfig(cwd, { mode, configFile });
|
|
384
275
|
|
|
385
276
|
return {
|
|
386
|
-
paths: [resolve(root, configFile)],
|
|
277
|
+
paths: [resolve(loaded.root, loaded.configFile)],
|
|
387
278
|
regenerate: async () => {
|
|
388
|
-
await runCodegen({ cwd: root, mode });
|
|
279
|
+
await runCodegen({ cwd: loaded.root, mode, configFile: loaded.configFile });
|
|
389
280
|
},
|
|
390
281
|
};
|
|
391
282
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveStore } from "@gtkx/codegen";
|
|
2
2
|
import { type Config, loadConfig } from "@gtkx/config";
|
|
3
|
-
import { existsSync
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
@@ -16,39 +16,23 @@ type CodegenStore = {
|
|
|
16
16
|
|
|
17
17
|
type CodegenReactPackage = {
|
|
18
18
|
version: string;
|
|
19
|
-
subexports: string[];
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
type ResolvedPackage = { dir: string; version: string };
|
|
23
|
-
|
|
24
21
|
type CodegenContext = {
|
|
25
22
|
root: string;
|
|
26
23
|
config: Config;
|
|
27
24
|
configFile: string;
|
|
28
25
|
};
|
|
29
26
|
|
|
30
|
-
const
|
|
31
|
-
const parsed = JSON.parse(readFileSync(packageJsonPath, "utf8")) as { version?: string };
|
|
32
|
-
|
|
33
|
-
return parsed.version ?? "0.0.0";
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const resolvePackage = (require: NodeJS.Require, dir: string, packageName: string): ResolvedPackage | null => {
|
|
27
|
+
const hasPackage = (require: NodeJS.Require, dir: string, packageName: string): boolean => {
|
|
37
28
|
try {
|
|
38
|
-
|
|
29
|
+
require.resolve(`${packageName}/package.json`);
|
|
39
30
|
|
|
40
|
-
return
|
|
31
|
+
return true;
|
|
41
32
|
} catch {
|
|
42
33
|
const unscoped = packageName.replace(/^@[^/]+\//, "");
|
|
43
|
-
const workspacePkg = join(dir, "packages", unscoped, "package.json");
|
|
44
|
-
|
|
45
|
-
if (!existsSync(workspacePkg)) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const real = realpathSync(workspacePkg);
|
|
50
34
|
|
|
51
|
-
return
|
|
35
|
+
return existsSync(join(dir, "packages", unscoped, "package.json"));
|
|
52
36
|
}
|
|
53
37
|
};
|
|
54
38
|
|
|
@@ -57,12 +41,12 @@ const siblingStore = (giDir: string): string => join(dirname(giDir), "jsx");
|
|
|
57
41
|
const resolveCodegenStore = (dir: string): CodegenStore => {
|
|
58
42
|
const require = createRequire(pathToFileURL(join(dir, "__gtkx_resolver__.js")).href);
|
|
59
43
|
|
|
60
|
-
if (
|
|
44
|
+
if (!hasPackage(require, dir, "@gtkx/native")) {
|
|
61
45
|
throw new Error("Cannot resolve @gtkx/native from the project; is it installed?");
|
|
62
46
|
}
|
|
63
47
|
|
|
64
48
|
const store = resolveStore(dir);
|
|
65
|
-
const hasReactRuntime =
|
|
49
|
+
const hasReactRuntime = hasPackage(require, dir, "react");
|
|
66
50
|
|
|
67
51
|
return {
|
|
68
52
|
giStoreDir: store.gi.storeDir,
|
|
@@ -72,13 +56,13 @@ const resolveCodegenStore = (dir: string): CodegenStore => {
|
|
|
72
56
|
runtimeVersion: store.gi.version,
|
|
73
57
|
react:
|
|
74
58
|
hasReactRuntime && store.jsx !== null
|
|
75
|
-
? { version: store.jsx.version
|
|
59
|
+
? { version: store.jsx.version }
|
|
76
60
|
: null,
|
|
77
61
|
};
|
|
78
62
|
};
|
|
79
63
|
|
|
80
|
-
const resolveCodegenContext = async (cwd: string, mode?: string): Promise<CodegenContext> => {
|
|
81
|
-
const { config, configFile } = await loadConfig(cwd, { mode });
|
|
64
|
+
const resolveCodegenContext = async (cwd: string, mode?: string, selectedConfig?: string): Promise<CodegenContext> => {
|
|
65
|
+
const { config, configFile } = await loadConfig(cwd, { mode, configFile: selectedConfig });
|
|
82
66
|
|
|
83
67
|
return { root: cwd, config, configFile };
|
|
84
68
|
};
|
package/src/commands/build.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { info } from "@gtkx/utils";
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
3
|
import { build as buildApp } from "../builder.js";
|
|
4
|
-
import {
|
|
4
|
+
import { prepareBuildOutDir, resolveBuildOutDir } from "../internal/build-output.js";
|
|
5
|
+
import { configArg, entryArg } from "../internal/entry-arg.js";
|
|
5
6
|
import { prepareProject } from "../internal/prepare-project.js";
|
|
6
7
|
|
|
7
8
|
const BUILD_MODE = "production";
|
|
@@ -13,18 +14,28 @@ const build = defineCommand({
|
|
|
13
14
|
},
|
|
14
15
|
args: {
|
|
15
16
|
...entryArg,
|
|
17
|
+
...configArg,
|
|
18
|
+
out: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Output directory below the project root (default: dist)",
|
|
21
|
+
},
|
|
16
22
|
},
|
|
17
23
|
async run({ args }) {
|
|
18
|
-
const { cwd, entry } = await prepareProject(args, BUILD_MODE);
|
|
24
|
+
const { cwd, entry, configFile } = await prepareProject(args, BUILD_MODE);
|
|
25
|
+
const outDir = resolveBuildOutDir(cwd, args.out);
|
|
26
|
+
using preparedOutput = prepareBuildOutDir(cwd, outDir);
|
|
19
27
|
info(`Building ${entry}`);
|
|
20
28
|
|
|
21
29
|
const bundlePath = await buildApp({
|
|
22
30
|
entry,
|
|
31
|
+
configFile,
|
|
23
32
|
vite: {
|
|
24
33
|
root: cwd,
|
|
34
|
+
build: { outDir: preparedOutput.path, emptyOutDir: false },
|
|
25
35
|
},
|
|
26
36
|
});
|
|
27
37
|
|
|
38
|
+
preparedOutput.commit();
|
|
28
39
|
info(`Build complete: ${bundlePath}`);
|
|
29
40
|
},
|
|
30
41
|
});
|
package/src/commands/codegen.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { info } from "@gtkx/utils";
|
|
|
2
2
|
import { defineCommand } from "citty";
|
|
3
3
|
import { formatCodegenResult } from "../codegen/report.js";
|
|
4
4
|
import { ensureGenerated, isCodegenDisabled, runCodegen } from "../codegen/run-codegen.js";
|
|
5
|
-
import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
|
|
5
|
+
import { configArg, cwdArg, resolveCwd } from "../internal/entry-arg.js";
|
|
6
6
|
|
|
7
7
|
const FORCED_WHILE_DISABLED_MESSAGE =
|
|
8
8
|
"codegen is disabled for this project, so --force has no store to regenerate here. " +
|
|
@@ -20,29 +20,30 @@ const codegen = defineCommand({
|
|
|
20
20
|
description: "Wipe the generated store and regenerate unconditionally (recover a corrupted store)",
|
|
21
21
|
default: false,
|
|
22
22
|
},
|
|
23
|
+
...configArg,
|
|
23
24
|
...cwdArg,
|
|
24
25
|
},
|
|
25
26
|
async run({ args }) {
|
|
26
27
|
const cwd = resolveCwd(args);
|
|
27
|
-
const isDisabled = await isCodegenDisabled(cwd);
|
|
28
|
+
const isDisabled = await isCodegenDisabled(cwd, undefined, args.config);
|
|
28
29
|
checkForce(isDisabled, args.force);
|
|
29
30
|
|
|
30
31
|
if (isDisabled) {
|
|
31
|
-
await runCodegen({ cwd });
|
|
32
|
+
await runCodegen({ cwd, configFile: args.config });
|
|
32
33
|
info("codegen: disabled for this project; reusing an installed binding store");
|
|
33
34
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
if (!args.force) {
|
|
38
|
-
const isRan = await ensureGenerated(cwd);
|
|
39
|
+
const isRan = await ensureGenerated(cwd, { configFile: args.config });
|
|
39
40
|
info(isRan ? "codegen: regenerated stale bindings" : "codegen: bindings up to date");
|
|
40
41
|
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const startedAt = Date.now();
|
|
45
|
-
const result = await runCodegen({ cwd, isForced: true });
|
|
46
|
+
const result = await runCodegen({ cwd, configFile: args.config, isForced: true });
|
|
46
47
|
const lines = formatCodegenResult(result, Date.now() - startedAt);
|
|
47
48
|
|
|
48
49
|
for (const line of lines) {
|
package/src/commands/deploy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import { KNOWN_NAMES } from "../deploy/registry.js";
|
|
3
3
|
import { runDeploy } from "../deploy/run-deploy.js";
|
|
4
|
-
import { entryArg } from "../internal/entry-arg.js";
|
|
4
|
+
import { configArg, entryArg } from "../internal/entry-arg.js";
|
|
5
5
|
import { resolveProject } from "../internal/prepare-project.js";
|
|
6
6
|
|
|
7
7
|
const DEPLOY_MODE = "production";
|
|
@@ -13,6 +13,7 @@ const deploy = defineCommand({
|
|
|
13
13
|
},
|
|
14
14
|
args: {
|
|
15
15
|
...entryArg,
|
|
16
|
+
...configArg,
|
|
16
17
|
target: {
|
|
17
18
|
type: "string",
|
|
18
19
|
description: `Comma-separated package formats to build (${KNOWN_NAMES})`,
|
|
@@ -31,11 +32,12 @@ const deploy = defineCommand({
|
|
|
31
32
|
},
|
|
32
33
|
},
|
|
33
34
|
async run({ args }) {
|
|
34
|
-
const { cwd, entry } = await resolveProject(args, DEPLOY_MODE);
|
|
35
|
+
const { cwd, entry, configFile } = await resolveProject(args, DEPLOY_MODE);
|
|
35
36
|
|
|
36
37
|
await runDeploy({
|
|
37
38
|
entry,
|
|
38
39
|
cwd,
|
|
40
|
+
configFile,
|
|
39
41
|
targets: args.target,
|
|
40
42
|
outDir: args.out,
|
|
41
43
|
shouldPrintManifests: args["print-manifests"] === true,
|
package/src/commands/dev.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import { resolveConfigWatch } from "../codegen/run-codegen.js";
|
|
3
|
+
import { startHeadlessDevDisplay } from "../dev/headless.js";
|
|
3
4
|
import { type DevWatch, runDevSupervisor } from "../dev/supervisor.js";
|
|
4
5
|
import { splitApplicationArgs } from "../internal/application-args.js";
|
|
5
6
|
import { entryArg } from "../internal/entry-arg.js";
|
|
@@ -14,12 +15,30 @@ const dev = defineCommand({
|
|
|
14
15
|
},
|
|
15
16
|
args: {
|
|
16
17
|
...entryArg,
|
|
18
|
+
headless: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Run on an isolated headless Wayland display",
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "Headless display size as WIDTHxHEIGHT",
|
|
25
|
+
},
|
|
17
26
|
},
|
|
18
27
|
async run({ args }) {
|
|
28
|
+
if (args.size !== undefined && !args.headless) {
|
|
29
|
+
throw new Error("--size requires --headless");
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
const { cwd, entry: entryPath } = await prepareProject(args, DEV_MODE);
|
|
20
33
|
const watch: DevWatch | undefined = await resolveConfigWatch(cwd, DEV_MODE);
|
|
21
34
|
const { applicationArgs } = splitApplicationArgs(process.argv.slice(2));
|
|
22
|
-
|
|
35
|
+
const stopHeadless = args.headless ? await startHeadlessDevDisplay(args.size) : undefined;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
await runDevSupervisor({ entryPath, cwd, args: applicationArgs, watch });
|
|
39
|
+
} finally {
|
|
40
|
+
stopHeadless?.();
|
|
41
|
+
}
|
|
23
42
|
},
|
|
24
43
|
});
|
|
25
44
|
|
package/src/commands/docs.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mergeOmittedProps, resolveGirPath, resolveLibraries } from "@gtkx/codegen";
|
|
2
2
|
import { writeDocs } from "@gtkx/codegen/internal";
|
|
3
3
|
import { loadConfig } from "@gtkx/config";
|
|
4
|
-
import {
|
|
5
|
-
import { info } from "@gtkx/utils";
|
|
4
|
+
import { resolveOmittedProps } from "@gtkx/config/internal";
|
|
5
|
+
import { info, isPathInside } from "@gtkx/utils";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
|
-
import {
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
8
|
import { resolveDocsElements } from "../internal/docs-elements.js";
|
|
9
9
|
import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
|
|
10
10
|
|
|
@@ -57,8 +57,7 @@ const docs = defineCommand({
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const
|
|
61
|
-
const libraries = resolveLibraries(config.libraries, girPath, future.isAdwaitaDefault);
|
|
60
|
+
const libraries = resolveLibraries(config.libraries);
|
|
62
61
|
const startedAt = Date.now();
|
|
63
62
|
const outDir = resolveOutDir(cwd, args.out);
|
|
64
63
|
const builtin = await resolveDocsElements(cwd);
|
|
@@ -71,11 +70,6 @@ const docs = defineCommand({
|
|
|
71
70
|
props: builtin.props,
|
|
72
71
|
omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
|
|
73
72
|
isForced: args.force,
|
|
74
|
-
isByteArrayTyped: future.isByteArrayTyped,
|
|
75
|
-
isValueUnwrapped: future.isValueUnwrapped,
|
|
76
|
-
isFinishTrimmed: future.isFinishTrimmed,
|
|
77
|
-
isInoutInPlace: future.isInoutInPlace,
|
|
78
|
-
isTreeShaken: future.isTreeShaken,
|
|
79
73
|
});
|
|
80
74
|
|
|
81
75
|
if (!isRegenerated) {
|
|
@@ -93,12 +87,6 @@ const docs = defineCommand({
|
|
|
93
87
|
},
|
|
94
88
|
});
|
|
95
89
|
|
|
96
|
-
const isBelow = (parent: string, child: string): boolean => {
|
|
97
|
-
const path = relative(parent, child);
|
|
98
|
-
|
|
99
|
-
return path !== "" && path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
90
|
const outDirReason = (cwd: string, out: string, outDir: string): string => {
|
|
103
91
|
if (out.trim() === "") {
|
|
104
92
|
return "it was empty, which names the project root itself";
|
|
@@ -114,7 +102,7 @@ const outDirReason = (cwd: string, out: string, outDir: string): string => {
|
|
|
114
102
|
const resolveOutDir = (cwd: string, out: string): string => {
|
|
115
103
|
const outDir = out.trim() === "" ? cwd : resolve(cwd, out);
|
|
116
104
|
|
|
117
|
-
if (
|
|
105
|
+
if (isPathInside(cwd, outDir)) {
|
|
118
106
|
return outDir;
|
|
119
107
|
}
|
|
120
108
|
|