@gtkx/cli 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.d.ts +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.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +9 -1
- package/dist/cli.js.map +1 -1
- package/dist/codegen/reference.d.ts.map +1 -1
- package/dist/codegen/reference.js +1 -0
- package/dist/codegen/reference.js.map +1 -1
- package/dist/codegen/run-codegen.d.ts +4 -2
- package/dist/codegen/run-codegen.d.ts.map +1 -1
- package/dist/codegen/run-codegen.js +15 -16
- package/dist/codegen/run-codegen.js.map +1 -1
- package/dist/codegen/store-resolver.d.ts +2 -1
- package/dist/codegen/store-resolver.d.ts.map +1 -1
- package/dist/codegen/store-resolver.js +4 -3
- 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 +9 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +29 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +1 -0
- package/dist/commands/docs.js.map +1 -1
- package/dist/deploy/freedesktop/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/validate.d.ts.map +1 -1
- package/dist/deploy/freedesktop/validate.js +10 -4
- package/dist/deploy/freedesktop/validate.js.map +1 -1
- package/dist/deploy/nfpm/config.d.ts +3 -2
- package/dist/deploy/nfpm/config.d.ts.map +1 -1
- package/dist/deploy/nfpm/config.js +7 -4
- 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 +75 -5
- package/dist/deploy/node-runtime/index.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/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.js +1 -1
- 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 +15 -4
- 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/paths.d.ts +2 -1
- package/dist/deploy/settings/paths.d.ts.map +1 -1
- package/dist/deploy/settings/paths.js +113 -5
- package/dist/deploy/settings/paths.js.map +1 -1
- package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
- package/dist/deploy/targets/flatpak-source.js +11 -2
- package/dist/deploy/targets/flatpak-source.js.map +1 -1
- package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
- package/dist/deploy/targets/nfpm-target.js +12 -7
- package/dist/deploy/targets/nfpm-target.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/entry-env.d.ts +2 -1
- package/dist/dev/entry-env.d.ts.map +1 -1
- package/dist/dev/entry-env.js +2 -1
- package/dist/dev/entry-env.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.d.ts +1 -1
- package/dist/dev/runner-deps.d.ts.map +1 -1
- package/dist/dev/runner-deps.js +3 -3
- 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 +8 -3
- package/dist/dev/runner-main.js.map +1 -1
- package/dist/dev/supervisor.d.ts +1 -0
- package/dist/dev/supervisor.d.ts.map +1 -1
- package/dist/dev/supervisor.js +4 -3
- package/dist/dev/supervisor.js.map +1 -1
- package/dist/i18n/catalogs.d.ts.map +1 -1
- package/dist/i18n/catalogs.js +1 -0
- package/dist/i18n/catalogs.js.map +1 -1
- package/dist/i18n/source-messages.d.ts.map +1 -1
- package/dist/i18n/source-messages.js +960 -8
- package/dist/i18n/source-messages.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 +79 -0
- package/dist/internal/build-output.js.map +1 -0
- package/dist/internal/docs-elements.d.ts +1 -0
- package/dist/internal/docs-elements.d.ts.map +1 -1
- package/dist/internal/docs-elements.js +5 -4
- 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/errors.d.ts +2 -1
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -1
- package/dist/internal/errors.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/parent-process.d.ts +12 -0
- package/dist/internal/parent-process.d.ts.map +1 -0
- package/dist/internal/parent-process.js +74 -0
- package/dist/internal/parent-process.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.js +1 -1
- 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/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/ensure-store.d.ts +1 -1
- package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
- package/dist/vite-plugins/ensure-store.js +2 -2
- package/dist/vite-plugins/ensure-store.js.map +1 -1
- package/dist/vite-plugins/i18n.d.ts.map +1 -1
- package/dist/vite-plugins/i18n.js +58 -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 +6 -2
- package/dist/vite-plugins/index.js.map +1 -1
- package/dist/vite-plugins/native.d.ts.map +1 -1
- package/dist/vite-plugins/native.js +0 -4
- package/dist/vite-plugins/native.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 +1 -1
- package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
- package/dist/vite-plugins/settings-worker-env.js +2 -2
- package/dist/vite-plugins/settings-worker-env.js.map +1 -1
- package/dist/vitest-plugin.d.ts +2 -1
- package/dist/vitest-plugin.d.ts.map +1 -1
- package/dist/vitest-plugin.js +6 -6
- package/dist/vitest-plugin.js.map +1 -1
- package/package.json +10 -9
- package/src/builder.ts +18 -5
- package/src/cli.ts +9 -1
- package/src/codegen/reference.ts +1 -0
- package/src/codegen/run-codegen.ts +17 -19
- package/src/codegen/store-resolver.ts +5 -3
- 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 +38 -4
- package/src/commands/docs.ts +1 -0
- package/src/deploy/freedesktop/metainfo.ts +73 -21
- package/src/deploy/freedesktop/validate.ts +12 -4
- package/src/deploy/nfpm/config.ts +13 -4
- package/src/deploy/nfpm/contents.ts +8 -0
- package/src/deploy/node-runtime/elf.ts +43 -5
- package/src/deploy/node-runtime/index.ts +107 -6
- package/src/deploy/notices/node-runtime.ts +2 -2
- package/src/deploy/payload/launcher.ts +20 -1
- package/src/deploy/payload/stage.ts +1 -1
- package/src/deploy/run-deploy.ts +56 -16
- package/src/deploy/settings/build-manifest.ts +28 -3
- package/src/deploy/settings/extra-files.ts +26 -2
- package/src/deploy/settings/index.ts +3 -1
- package/src/deploy/settings/paths.ts +70 -5
- package/src/deploy/targets/flatpak-source.ts +13 -2
- package/src/deploy/targets/nfpm-target.ts +13 -6
- package/src/deploy/types.ts +1 -0
- package/src/dev/entry-env.ts +2 -1
- package/src/dev/headless.ts +40 -0
- package/src/dev/runner-deps.ts +3 -3
- package/src/dev/runner-main.ts +10 -3
- package/src/dev/supervisor.ts +6 -3
- package/src/i18n/catalogs.ts +1 -0
- package/src/i18n/source-messages.ts +1429 -28
- package/src/internal/build-manifest.ts +25 -1
- package/src/internal/build-output.ts +113 -0
- package/src/internal/docs-elements.ts +10 -4
- package/src/internal/entry-arg.ts +8 -1
- package/src/internal/errors.ts +1 -1
- package/src/internal/output-directory.ts +699 -0
- package/src/internal/parent-process.ts +110 -0
- package/src/internal/prepare-project.ts +5 -5
- package/src/internal/source-imports.ts +1 -1
- package/src/mcp/client.ts +2 -2
- package/src/vite-plugins/build-manifest.ts +7 -1
- package/src/vite-plugins/ensure-store.ts +2 -2
- package/src/vite-plugins/i18n.ts +83 -5
- package/src/vite-plugins/index.ts +14 -7
- package/src/vite-plugins/native.ts +0 -5
- package/src/vite-plugins/self-contained.ts +184 -185
- package/src/vite-plugins/settings-worker-env.ts +2 -2
- package/src/vitest-plugin.ts +6 -6
package/src/deploy/run-deploy.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadConfig } from "@gtkx/config";
|
|
1
|
+
import { type Config, loadConfig } from "@gtkx/config";
|
|
2
2
|
import { info, warn } from "@gtkx/utils";
|
|
3
3
|
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative } from "node:path";
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
synchronizeCatalogs,
|
|
23
23
|
} from "../i18n/catalogs.js";
|
|
24
24
|
import { extractSourceCatalogTo } from "../i18n/source-messages.js";
|
|
25
|
+
import { prepareBuildOutDir, resolveBuildOutDir } from "../internal/build-output.js";
|
|
25
26
|
import { discoverSourceFiles } from "../internal/source-imports.js";
|
|
26
27
|
import { renderDesktopEntry } from "./freedesktop/desktop-entry.js";
|
|
27
28
|
import { extractMetadataMessages, localizeMetadata } from "./freedesktop/localize.js";
|
|
@@ -35,6 +36,7 @@ import { DEFAULT_TARGETS, parseTargetList, targetsFor } from "./registry.js";
|
|
|
35
36
|
import { readBuildManifest } from "./settings/build-manifest.js";
|
|
36
37
|
import { resolveDeploySettings } from "./settings/index.js";
|
|
37
38
|
import { readPackageManifest } from "./settings/package-manifest.js";
|
|
39
|
+
import { prepareDeployOutDir } from "./settings/paths.js";
|
|
38
40
|
import { missingDeployError } from "./settings/starter.js";
|
|
39
41
|
import { finishArgsFor, hasDisplaySocket, runtimeLabelFor } from "./targets/flatpak-manifest.js";
|
|
40
42
|
import { detectPackageManager } from "./targets/flatpak-sources.js";
|
|
@@ -58,6 +60,7 @@ import {
|
|
|
58
60
|
type DeployOptions = {
|
|
59
61
|
entry: string;
|
|
60
62
|
cwd: string;
|
|
63
|
+
configFile?: string | undefined;
|
|
61
64
|
targets?: string | undefined;
|
|
62
65
|
outDir?: string | undefined;
|
|
63
66
|
shouldPrintManifests: boolean;
|
|
@@ -72,6 +75,20 @@ type PreflightRequest = {
|
|
|
72
75
|
shouldSkipBuild: boolean;
|
|
73
76
|
};
|
|
74
77
|
|
|
78
|
+
type LoadedDeploySettings = {
|
|
79
|
+
config: Config;
|
|
80
|
+
configFile: string;
|
|
81
|
+
settings: DeploySettings;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type BuildPayloadRequest = {
|
|
85
|
+
options: DeployOptions;
|
|
86
|
+
loaded: LoadedDeploySettings;
|
|
87
|
+
targets: DeployTarget[];
|
|
88
|
+
project: CatalogProject | null;
|
|
89
|
+
buildOutDir: string | null;
|
|
90
|
+
};
|
|
91
|
+
|
|
75
92
|
const BUILD_MODE = "production";
|
|
76
93
|
const BYTES_PER_MIB = 1024 * 1024;
|
|
77
94
|
const WEBKIT_LIBRARY = "WebKit-6.0";
|
|
@@ -282,14 +299,26 @@ const resolveTargetNames = (options: DeployOptions, settings: DeploySettings): s
|
|
|
282
299
|
return settings.deploy.targets ?? DEFAULT_TARGETS;
|
|
283
300
|
};
|
|
284
301
|
|
|
285
|
-
const loadSettings = async (options: DeployOptions): Promise<
|
|
286
|
-
const { config, root } = await loadConfig(options.cwd, {
|
|
302
|
+
const loadSettings = async (options: DeployOptions): Promise<LoadedDeploySettings> => {
|
|
303
|
+
const { config, configFile, root } = await loadConfig(options.cwd, {
|
|
304
|
+
mode: BUILD_MODE,
|
|
305
|
+
configFile: options.configFile,
|
|
306
|
+
});
|
|
287
307
|
|
|
288
308
|
if (config.deploy === undefined) {
|
|
289
309
|
throw missingDeployError(config.applicationId, readPackageManifest(root));
|
|
290
310
|
}
|
|
291
311
|
|
|
292
|
-
return
|
|
312
|
+
return {
|
|
313
|
+
config,
|
|
314
|
+
configFile,
|
|
315
|
+
settings: resolveDeploySettings({
|
|
316
|
+
root,
|
|
317
|
+
config,
|
|
318
|
+
configFile,
|
|
319
|
+
outDirOverride: options.outDir,
|
|
320
|
+
}),
|
|
321
|
+
};
|
|
293
322
|
};
|
|
294
323
|
|
|
295
324
|
const synchronizeMetadataCatalogs = async (
|
|
@@ -318,22 +347,27 @@ const synchronizeMetadataCatalogs = async (
|
|
|
318
347
|
}
|
|
319
348
|
};
|
|
320
349
|
|
|
321
|
-
const buildPayload = async (
|
|
322
|
-
options
|
|
323
|
-
|
|
324
|
-
targets
|
|
325
|
-
project
|
|
326
|
-
|
|
350
|
+
const buildPayload = async ({
|
|
351
|
+
options,
|
|
352
|
+
loaded,
|
|
353
|
+
targets,
|
|
354
|
+
project,
|
|
355
|
+
buildOutDir,
|
|
356
|
+
}: BuildPayloadRequest): Promise<DeployPayload> => {
|
|
357
|
+
const settings = loaded.settings;
|
|
327
358
|
const templates = renderMetadata(settings);
|
|
328
359
|
|
|
329
|
-
if (
|
|
360
|
+
if (buildOutDir !== null) {
|
|
330
361
|
info(`Building ${options.entry}`);
|
|
362
|
+
using preparedOutput = prepareBuildOutDir(settings.paths.root, buildOutDir);
|
|
331
363
|
|
|
332
364
|
await buildApp({
|
|
333
365
|
entry: options.entry,
|
|
334
|
-
|
|
366
|
+
configFile: options.configFile,
|
|
367
|
+
vite: { root: options.cwd, build: { outDir: preparedOutput.path, emptyOutDir: false } },
|
|
335
368
|
});
|
|
336
369
|
|
|
370
|
+
preparedOutput.commit();
|
|
337
371
|
await synchronizeMetadataCatalogs(settings, templates, project);
|
|
338
372
|
} else if (project !== null) {
|
|
339
373
|
compileCatalogs(project, join(settings.paths.dist, LOCALE_DIRNAME));
|
|
@@ -341,7 +375,7 @@ const buildPayload = async (
|
|
|
341
375
|
|
|
342
376
|
const metadata = localizeMetadata(templates, project);
|
|
343
377
|
validateMetadata(settings, metadata, isFlathubSubmission(settings, targets));
|
|
344
|
-
const buildManifest = readBuildManifest(settings);
|
|
378
|
+
const buildManifest = readBuildManifest(settings, loaded);
|
|
345
379
|
|
|
346
380
|
const builtSettings: DeploySettings = {
|
|
347
381
|
...settings,
|
|
@@ -411,9 +445,11 @@ const announce = (settings: DeploySettings, targets: DeployTarget[]): void => {
|
|
|
411
445
|
};
|
|
412
446
|
|
|
413
447
|
const runDeploy = async (options: DeployOptions): Promise<void> => {
|
|
414
|
-
let
|
|
448
|
+
let loaded = await loadSettings(options);
|
|
449
|
+
let settings = loaded.settings;
|
|
415
450
|
let project = resolveCatalogProject(settings.paths.root, settings.applicationId);
|
|
416
451
|
let targets = targetsFor(resolveTargetNames(options, settings));
|
|
452
|
+
let buildOutDir = options.shouldSkipBuild ? null : resolveBuildOutDir(settings.paths.root, settings.paths.dist);
|
|
417
453
|
announce(settings, targets);
|
|
418
454
|
|
|
419
455
|
preflight({
|
|
@@ -428,14 +464,18 @@ const runDeploy = async (options: DeployOptions): Promise<void> => {
|
|
|
428
464
|
await ensureGenerated(options.cwd, {
|
|
429
465
|
shouldAnnounce: true,
|
|
430
466
|
mode: BUILD_MODE,
|
|
467
|
+
configFile: options.configFile,
|
|
431
468
|
});
|
|
432
469
|
|
|
433
|
-
|
|
470
|
+
loaded = await loadSettings(options);
|
|
471
|
+
settings = loaded.settings;
|
|
434
472
|
project = resolveCatalogProject(settings.paths.root, settings.applicationId);
|
|
435
473
|
targets = targetsFor(resolveTargetNames(options, settings));
|
|
474
|
+
buildOutDir = resolveBuildOutDir(settings.paths.root, settings.paths.dist);
|
|
436
475
|
}
|
|
437
476
|
|
|
438
|
-
|
|
477
|
+
prepareDeployOutDir(settings.paths.root, settings.paths.outDir);
|
|
478
|
+
const payload = await buildPayload({ options, loaded, targets, project, buildOutDir });
|
|
439
479
|
const rendered = renderTargetManifests(targets, payload);
|
|
440
480
|
|
|
441
481
|
if (options.shouldPrintManifests) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Config } from "@gtkx/config";
|
|
2
|
+
import { isPathInside, isRecord, sortStrings, toPosixPath } from "@gtkx/utils";
|
|
2
3
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
5
|
import type { DeploySettings } from "../types.js";
|
|
5
6
|
import {
|
|
6
7
|
BUILD_MANIFEST_FILENAME,
|
|
7
8
|
BUILD_MANIFEST_FORMAT_VERSION,
|
|
8
9
|
BUILD_MANIFEST_GENERATOR,
|
|
9
10
|
type BuildManifest,
|
|
11
|
+
configDigest,
|
|
10
12
|
type RecordedPackage,
|
|
11
13
|
} from "../../internal/build-manifest.js";
|
|
12
14
|
import {
|
|
@@ -20,6 +22,11 @@ type ResolvedBuildManifest = {
|
|
|
20
22
|
schemaFiles: string[];
|
|
21
23
|
};
|
|
22
24
|
|
|
25
|
+
type ExpectedBuildConfig = {
|
|
26
|
+
config: Config;
|
|
27
|
+
configFile: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
const invalidManifest = (path: string): Error =>
|
|
24
31
|
new Error(`Cannot deploy: ${path} is not a valid GTKX build manifest. Run \`gtkx build\` again.`);
|
|
25
32
|
|
|
@@ -51,6 +58,8 @@ const parseBuildManifest = (value: unknown, path: string): BuildManifest => {
|
|
|
51
58
|
!isRecord(value) ||
|
|
52
59
|
value.generator !== BUILD_MANIFEST_GENERATOR ||
|
|
53
60
|
value.formatVersion !== BUILD_MANIFEST_FORMAT_VERSION ||
|
|
61
|
+
typeof value.configFile !== "string" ||
|
|
62
|
+
typeof value.configDigest !== "string" ||
|
|
54
63
|
!Array.isArray(value.schemas) ||
|
|
55
64
|
!Array.isArray(value.packages)
|
|
56
65
|
) {
|
|
@@ -62,6 +71,8 @@ const parseBuildManifest = (value: unknown, path: string): BuildManifest => {
|
|
|
62
71
|
return {
|
|
63
72
|
generator: BUILD_MANIFEST_GENERATOR,
|
|
64
73
|
formatVersion: BUILD_MANIFEST_FORMAT_VERSION,
|
|
74
|
+
configFile: value.configFile,
|
|
75
|
+
configDigest: value.configDigest,
|
|
65
76
|
schemas: recordedSchemas(value.schemas, path),
|
|
66
77
|
packages: packages.map((entry) => recordedPackage(entry, path)),
|
|
67
78
|
};
|
|
@@ -91,7 +102,20 @@ const resolveRecordedSchema = (root: string, manifestPath: string, entry: string
|
|
|
91
102
|
return filePath;
|
|
92
103
|
};
|
|
93
104
|
|
|
94
|
-
const
|
|
105
|
+
const assertBuildConfig = (
|
|
106
|
+
settings: DeploySettings,
|
|
107
|
+
manifestPath: string,
|
|
108
|
+
manifest: BuildManifest,
|
|
109
|
+
expected: ExpectedBuildConfig,
|
|
110
|
+
): void => {
|
|
111
|
+
const expectedFile = toPosixPath(relative(settings.paths.root, expected.configFile));
|
|
112
|
+
|
|
113
|
+
if (manifest.configFile !== expectedFile || manifest.configDigest !== configDigest(expected.config)) {
|
|
114
|
+
throw new Error(`Cannot deploy: ${manifestPath} was built from a different GTKX configuration.`);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const readBuildManifest = (settings: DeploySettings, expected: ExpectedBuildConfig): ResolvedBuildManifest => {
|
|
95
119
|
const manifestPath = join(settings.paths.dist, BUILD_MANIFEST_FILENAME);
|
|
96
120
|
|
|
97
121
|
if (!existsSync(manifestPath)) {
|
|
@@ -100,6 +124,7 @@ const readBuildManifest = (settings: DeploySettings): ResolvedBuildManifest => {
|
|
|
100
124
|
|
|
101
125
|
const parsed: unknown = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
102
126
|
const manifest = parseBuildManifest(parsed, manifestPath);
|
|
127
|
+
assertBuildConfig(settings, manifestPath, manifest, expected);
|
|
103
128
|
const files = manifest.schemas.map((entry) => resolveRecordedSchema(settings.paths.root, manifestPath, entry));
|
|
104
129
|
const unique = sortStrings(new Set(files));
|
|
105
130
|
assertUniqueSchemaBasenames(unique);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { statSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
1
3
|
import type { DeployConfig, DeployExtraFile } from "../types.js";
|
|
2
4
|
|
|
3
5
|
type ExtraFiles = NonNullable<DeployConfig["extraFiles"]>;
|
|
@@ -5,6 +7,20 @@ type ExtraFileEntry = NonNullable<ExtraFiles[string]>;
|
|
|
5
7
|
|
|
6
8
|
const OCTAL_RADIX = 8;
|
|
7
9
|
|
|
10
|
+
const assertSourceFile = (root: string, file: DeployExtraFile): void => {
|
|
11
|
+
const source = resolve(root, file.source);
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
if (statSync(source).isFile()) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
throw new Error(`Cannot install "${file.destination}": its source file "${file.source}" does not exist`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
throw new Error(`Cannot install "${file.destination}": its source "${file.source}" is not a file`);
|
|
22
|
+
};
|
|
23
|
+
|
|
8
24
|
const resolveExtraFile = (destination: string, entry: ExtraFileEntry): DeployExtraFile => {
|
|
9
25
|
if (typeof entry === "string") {
|
|
10
26
|
return { destination, source: entry, mode: null };
|
|
@@ -15,7 +31,15 @@ const resolveExtraFile = (destination: string, entry: ExtraFileEntry): DeployExt
|
|
|
15
31
|
return { destination, source: entry.source, mode };
|
|
16
32
|
};
|
|
17
33
|
|
|
18
|
-
const resolveExtraFiles = (deploy: DeployConfig): DeployExtraFile[] =>
|
|
19
|
-
Object.entries(deploy.extraFiles ?? {})
|
|
34
|
+
const resolveExtraFiles = (root: string, deploy: DeployConfig): DeployExtraFile[] => {
|
|
35
|
+
const files = Object.entries(deploy.extraFiles ?? {})
|
|
36
|
+
.map(([destination, entry]) => resolveExtraFile(destination, entry));
|
|
37
|
+
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
assertSourceFile(root, file);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return files;
|
|
43
|
+
};
|
|
20
44
|
|
|
21
45
|
export { resolveExtraFiles };
|
|
@@ -31,6 +31,7 @@ import { resolveVersions } from "./version.js";
|
|
|
31
31
|
type SettingsRequest = {
|
|
32
32
|
root: string;
|
|
33
33
|
config: Config;
|
|
34
|
+
configFile: string;
|
|
34
35
|
outDirOverride?: string | undefined;
|
|
35
36
|
now?: Date | undefined;
|
|
36
37
|
};
|
|
@@ -174,10 +175,11 @@ const resolveDeploySettings = (request: SettingsRequest): DeploySettings => {
|
|
|
174
175
|
const deploy = core.identity.deploy;
|
|
175
176
|
|
|
176
177
|
return {
|
|
178
|
+
configFile: request.configFile,
|
|
177
179
|
...identitySlice(core),
|
|
178
180
|
...metadataSlice(request.root, core),
|
|
179
181
|
...desktopSlice(deploy),
|
|
180
|
-
extraFiles: resolveExtraFiles(deploy),
|
|
182
|
+
extraFiles: resolveExtraFiles(request.root, deploy),
|
|
181
183
|
versions: core.versions,
|
|
182
184
|
arch: resolveArch(),
|
|
183
185
|
paths: resolvePaths({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Config } from "@gtkx/config";
|
|
2
2
|
import { isPathInside } from "@gtkx/utils";
|
|
3
|
-
import { statSync } from "node:fs";
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
3
|
+
import { lstatSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import type { DeployConfig, DeployPaths } from "../types.js";
|
|
6
6
|
import { resolveApplicationIcon } from "../../internal/icon-path.js";
|
|
7
|
+
import { prepareOutputDirectory, readRegularFile } from "../../internal/output-directory.js";
|
|
7
8
|
|
|
8
9
|
type PathsRequest = {
|
|
9
10
|
root: string;
|
|
@@ -15,19 +16,83 @@ type PathsRequest = {
|
|
|
15
16
|
|
|
16
17
|
const DEFAULT_OUT_DIR = "build";
|
|
17
18
|
const DIST_DIR = "dist";
|
|
19
|
+
const DEPLOY_MARKER_FILENAME = ".gtkx-deploy.json";
|
|
20
|
+
const DEPLOY_MARKER = `${JSON.stringify({ generator: "gtkx-deploy", formatVersion: 1 })}\n`;
|
|
18
21
|
const LICENSE_CANDIDATES = ["LICENSE", "LICENSE.md", "LICENSE.txt", "COPYING", "COPYING.md"];
|
|
19
22
|
|
|
23
|
+
const hasSymlinkComponent = (root: string, target: string): boolean => {
|
|
24
|
+
let current = root;
|
|
25
|
+
|
|
26
|
+
for (const segment of relative(root, target).split(sep)) {
|
|
27
|
+
current = join(current, segment);
|
|
28
|
+
|
|
29
|
+
if (lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink() === true) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const isDeployMarker = (path: string): boolean => {
|
|
38
|
+
return readRegularFile(path) === DEPLOY_MARKER;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isReusableDeployDirectory = (path: string): boolean => {
|
|
42
|
+
const entry = lstatSync(path, { throwIfNoEntry: false });
|
|
43
|
+
|
|
44
|
+
if (entry === undefined) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return entry.isDirectory() &&
|
|
49
|
+
(readdirSync(path).length === 0 || isDeployMarker(join(path, DEPLOY_MARKER_FILENAME)));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const deployOutputError = (root: string, configured: string): Error =>
|
|
53
|
+
new Error(
|
|
54
|
+
`Cannot use "${configured}" as the deploy output directory: choose an empty directory or an ` +
|
|
55
|
+
`earlier GTKX deploy directory below ${root}`,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const assertSafeDeployOutDir = (root: string, outDir: string, configured: string): void => {
|
|
59
|
+
const dist = join(root, DIST_DIR);
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
outDir === dist ||
|
|
63
|
+
!isPathInside(root, outDir) ||
|
|
64
|
+
isPathInside(dist, outDir) ||
|
|
65
|
+
hasSymlinkComponent(root, outDir)
|
|
66
|
+
) {
|
|
67
|
+
throw deployOutputError(root, configured);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
20
71
|
const resolveOutDir = ({ root, deploy, outDirOverride }: PathsRequest): string => {
|
|
21
72
|
const configured = outDirOverride ?? deploy.outDir ?? DEFAULT_OUT_DIR;
|
|
22
73
|
const outDir = resolve(root, configured);
|
|
74
|
+
assertSafeDeployOutDir(root, outDir, configured);
|
|
23
75
|
|
|
24
|
-
if (!
|
|
25
|
-
throw
|
|
76
|
+
if (!isReusableDeployDirectory(outDir)) {
|
|
77
|
+
throw deployOutputError(root, configured);
|
|
26
78
|
}
|
|
27
79
|
|
|
28
80
|
return outDir;
|
|
29
81
|
};
|
|
30
82
|
|
|
83
|
+
const prepareDeployOutDir = (root: string, outDir: string): void => {
|
|
84
|
+
assertSafeDeployOutDir(root, outDir, outDir);
|
|
85
|
+
const prepared = prepareOutputDirectory(root, outDir, isReusableDeployDirectory);
|
|
86
|
+
|
|
87
|
+
if (prepared.status === "unsafe") {
|
|
88
|
+
throw deployOutputError(root, outDir);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
using transaction = prepared.transaction;
|
|
92
|
+
transaction.commit();
|
|
93
|
+
writeFileSync(join(outDir, DEPLOY_MARKER_FILENAME), DEPLOY_MARKER, { flag: "wx" });
|
|
94
|
+
};
|
|
95
|
+
|
|
31
96
|
const existingFile = (path: string): string | null =>
|
|
32
97
|
statSync(path, { throwIfNoEntry: false })?.isFile() === true ? path : null;
|
|
33
98
|
|
|
@@ -65,4 +130,4 @@ const resolvePaths = (request: PathsRequest): DeployPaths => {
|
|
|
65
130
|
};
|
|
66
131
|
};
|
|
67
132
|
|
|
68
|
-
export { resolvePaths };
|
|
133
|
+
export { prepareDeployOutDir, resolvePaths };
|
|
@@ -244,6 +244,17 @@ const appendPathFor = (settings: DeploySettings, pin: PnpmPin | null, nodeExtens
|
|
|
244
244
|
? `${nodeExtensionPath}/bin`
|
|
245
245
|
: `${pnpmPathFor(moduleDirFor(settings))}:${nodeExtensionPath}/bin`;
|
|
246
246
|
|
|
247
|
+
const sourceBuildCommand = (settings: DeploySettings): string => {
|
|
248
|
+
const configFile = projectRelative(settings, settings.configFile);
|
|
249
|
+
assertInsideProject(settings, {
|
|
250
|
+
destination: "the Flatpak build configuration",
|
|
251
|
+
source: configFile,
|
|
252
|
+
resolved: settings.configFile,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
return `npx gtkx build --config ${pathArgument(configFile)}`;
|
|
256
|
+
};
|
|
257
|
+
|
|
247
258
|
const flatpakSourceModule = (payload: DeployPayload): FlatpakModule => {
|
|
248
259
|
const settings = payload.settings;
|
|
249
260
|
const manager = detectPackageManager(settings);
|
|
@@ -271,14 +282,14 @@ const flatpakSourceModule = (payload: DeployPayload): FlatpakModule => {
|
|
|
271
282
|
],
|
|
272
283
|
"build-commands": [
|
|
273
284
|
installCommandFor(settings, manager),
|
|
274
|
-
|
|
285
|
+
sourceBuildCommand(settings),
|
|
275
286
|
...runtimeInstallCommands(settings, nodeExtensionPath),
|
|
287
|
+
...extraFileInstallCommands(settings),
|
|
276
288
|
...metadataInstallCommands(settings),
|
|
277
289
|
...schemaInstallCommands(settings),
|
|
278
290
|
...iconInstallCommands(settings),
|
|
279
291
|
...licenseInstallCommands(settings),
|
|
280
292
|
...noticesInstallCommands(settings),
|
|
281
|
-
...extraFileInstallCommands(settings),
|
|
282
293
|
...(settings.deploy.flatpak?.buildCommands ?? []),
|
|
283
294
|
...validationCommands(settings),
|
|
284
295
|
],
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { info } from "@gtkx/utils";
|
|
1
2
|
import { join } from "node:path";
|
|
2
3
|
import { stringify } from "yaml";
|
|
3
4
|
import type { DeployArtifact, DeployManifest, DeployPayload, DeployTarget } from "../types.js";
|
|
4
|
-
import { type NfpmPackager, renderNfpmConfig } from "../nfpm/config.js";
|
|
5
|
+
import { glibcMinimumForPackage, type NfpmPackager, renderNfpmConfig } from "../nfpm/config.js";
|
|
5
6
|
import { packWithNfpm } from "../nfpm/pack.js";
|
|
6
7
|
import { TAR } from "../tools.js";
|
|
7
8
|
|
|
@@ -11,12 +12,18 @@ const PREFIX = "/usr";
|
|
|
11
12
|
const manifestPathFor = (payload: DeployPayload, packager: NfpmPackager): string =>
|
|
12
13
|
join(payload.settings.paths.targets, packager, MANIFEST_FILENAME);
|
|
13
14
|
|
|
14
|
-
const renderManifests = (payload: DeployPayload, packager: NfpmPackager): DeployManifest[] =>
|
|
15
|
-
|
|
15
|
+
const renderManifests = (payload: DeployPayload, packager: NfpmPackager): DeployManifest[] => {
|
|
16
|
+
const glibcMinimum = glibcMinimumForPackage(payload, packager);
|
|
17
|
+
|
|
18
|
+
if (glibcMinimum !== null) {
|
|
19
|
+
info(`${packager} package requires glibc >= ${glibcMinimum}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return [{
|
|
16
23
|
path: manifestPathFor(payload, packager),
|
|
17
|
-
contents: stringify(renderNfpmConfig(payload, packager), { lineWidth: 0 }),
|
|
18
|
-
}
|
|
19
|
-
|
|
24
|
+
contents: stringify(renderNfpmConfig(payload, packager, glibcMinimum), { lineWidth: 0 }),
|
|
25
|
+
}];
|
|
26
|
+
};
|
|
20
27
|
|
|
21
28
|
const packPackage = async (payload: DeployPayload, packager: NfpmPackager): Promise<DeployArtifact[]> => [
|
|
22
29
|
await packWithNfpm(payload, packager, manifestPathFor(payload, packager)),
|
package/src/deploy/types.ts
CHANGED
package/src/dev/entry-env.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MCP_SOCKET_PATH_ENV, resolveMcpSocketPath } from "@gtkx/mcp/internal";
|
|
2
|
+
import { resolveHeadlessOptions, startHeadlessDisplay } from "@gtkx/vitest/headless";
|
|
3
|
+
|
|
4
|
+
const restoreEnvironment = (name: string, value: string | undefined): void => {
|
|
5
|
+
if (value === undefined) {
|
|
6
|
+
Reflect.deleteProperty(process.env, name);
|
|
7
|
+
} else {
|
|
8
|
+
process.env[name] = value;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const startHeadlessDevDisplay = async (size?: string): Promise<() => void> => {
|
|
13
|
+
const previousSocketPath = process.env[MCP_SOCKET_PATH_ENV];
|
|
14
|
+
process.env[MCP_SOCKET_PATH_ENV] = resolveMcpSocketPath();
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const stopDisplay = await startHeadlessDisplay(resolveHeadlessOptions({ ...(size !== undefined && { size }) }));
|
|
18
|
+
let isStopped = false;
|
|
19
|
+
|
|
20
|
+
const stop = (): void => {
|
|
21
|
+
if (isStopped) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isStopped = true;
|
|
26
|
+
process.removeListener("exit", stop);
|
|
27
|
+
stopDisplay();
|
|
28
|
+
restoreEnvironment(MCP_SOCKET_PATH_ENV, previousSocketPath);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
process.once("exit", stop);
|
|
32
|
+
|
|
33
|
+
return stop;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
restoreEnvironment(MCP_SOCKET_PATH_ENV, previousSocketPath);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { startHeadlessDevDisplay };
|
package/src/dev/runner-deps.ts
CHANGED
|
@@ -43,11 +43,11 @@ const waitForApplicationId = async (timeoutMs: number, shouldKeepWaiting: () =>
|
|
|
43
43
|
|
|
44
44
|
const readFileRevision = (path: string): Promise<string> => readFile(path, "utf8");
|
|
45
45
|
|
|
46
|
-
const defaultDevRunnerDeps = (): DevRunnerDeps => ({
|
|
46
|
+
const defaultDevRunnerDeps = (configFile: string): DevRunnerDeps => ({
|
|
47
47
|
createServer,
|
|
48
48
|
waitForApplicationId,
|
|
49
49
|
getConfiguredApplicationId: async (root: string) => {
|
|
50
|
-
const loaded = await loadConfig(root, { mode: DEV_MODE });
|
|
50
|
+
const loaded = await loadConfig(root, { mode: DEV_MODE, configFile });
|
|
51
51
|
|
|
52
52
|
return loaded.config.applicationId;
|
|
53
53
|
},
|
|
@@ -87,7 +87,7 @@ const defaultDevRunnerDeps = (): DevRunnerDeps => ({
|
|
|
87
87
|
staleExportName,
|
|
88
88
|
readFileRevision,
|
|
89
89
|
plugins: (entryPath) => [
|
|
90
|
-
...gtkxVitePlugins(DEV_MODE, entryPath),
|
|
90
|
+
...gtkxVitePlugins({ mode: DEV_MODE, entryPath, configFile }),
|
|
91
91
|
...gtkxFastRefresh(),
|
|
92
92
|
gtkxReactDomPrebundle(),
|
|
93
93
|
],
|
package/src/dev/runner-main.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { loadConfig } from "@gtkx/config";
|
|
2
2
|
import { error } from "@gtkx/utils";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import { DEV_ENTRY_ENV } from "./entry-env.js";
|
|
4
|
+
import { DEV_CONFIG_ENV, DEV_ENTRY_ENV } from "./entry-env.js";
|
|
5
5
|
import { prepareDevIconDir } from "./icon-dir.js";
|
|
6
6
|
import { prepareDevLocaleDir } from "./locale-dir.js";
|
|
7
7
|
import { createDevRunner } from "./runner.js";
|
|
@@ -22,13 +22,20 @@ const main = async (): Promise<void> => {
|
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const configFile = process.env[DEV_CONFIG_ENV];
|
|
26
|
+
|
|
27
|
+
if (!configFile) {
|
|
28
|
+
error(`Missing ${DEV_CONFIG_ENV}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const { config, root } = await loadConfig(cwd, { mode: "development", configFile });
|
|
26
33
|
prepareDevLocaleDir(root, config.applicationId);
|
|
27
34
|
prepareDevSchemaDir(root);
|
|
28
35
|
prepareDevIconDir(root, config.applicationId, config.applicationIcon);
|
|
29
36
|
const entryPath = resolve(cwd, entryArg);
|
|
30
37
|
const { defaultDevRunnerDeps } = await import("./runner-deps.js");
|
|
31
|
-
const runner = createDevRunner(defaultDevRunnerDeps());
|
|
38
|
+
const runner = createDevRunner(defaultDevRunnerDeps(configFile));
|
|
32
39
|
await runner.run(entryPath);
|
|
33
40
|
};
|
|
34
41
|
|
package/src/dev/supervisor.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { fork as nodeFork } from "node:child_process";
|
|
|
3
3
|
import { type FSWatcher, watch as watchFs } from "node:fs";
|
|
4
4
|
import { basename, dirname } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { DEV_ENTRY_ENV } from "./entry-env.js";
|
|
6
|
+
import { DEV_CONFIG_ENV, DEV_ENTRY_ENV } from "./entry-env.js";
|
|
7
7
|
|
|
8
8
|
type SupervisedChild = {
|
|
9
9
|
killed: boolean;
|
|
@@ -24,6 +24,7 @@ type DevWatch = {
|
|
|
24
24
|
type SupervisorState = {
|
|
25
25
|
runnerPath: string;
|
|
26
26
|
entryPath: string;
|
|
27
|
+
configFile: string;
|
|
27
28
|
cwd: string;
|
|
28
29
|
args: string[];
|
|
29
30
|
watch: DevWatch | undefined;
|
|
@@ -37,6 +38,7 @@ type SupervisorState = {
|
|
|
37
38
|
|
|
38
39
|
type DevSupervisorOptions = {
|
|
39
40
|
entryPath: string;
|
|
41
|
+
configFile: string;
|
|
40
42
|
cwd: string;
|
|
41
43
|
args?: string[] | undefined;
|
|
42
44
|
watch?: DevWatch | undefined;
|
|
@@ -128,7 +130,7 @@ const launch = (state: SupervisorState): void => {
|
|
|
128
130
|
const child = state.fork(
|
|
129
131
|
state.runnerPath,
|
|
130
132
|
state.args,
|
|
131
|
-
{ ...process.env, [DEV_ENTRY_ENV]: state.entryPath },
|
|
133
|
+
{ ...process.env, [DEV_CONFIG_ENV]: state.configFile, [DEV_ENTRY_ENV]: state.entryPath },
|
|
132
134
|
state.cwd,
|
|
133
135
|
);
|
|
134
136
|
|
|
@@ -286,11 +288,12 @@ const installShutdown = (state: SupervisorState): void => {
|
|
|
286
288
|
};
|
|
287
289
|
|
|
288
290
|
const runDevSupervisor = async (options: DevSupervisorOptions): Promise<never> => {
|
|
289
|
-
const { entryPath, cwd, args = [], watch, fork = defaultForkRunner } = options;
|
|
291
|
+
const { entryPath, configFile, cwd, args = [], watch, fork = defaultForkRunner } = options;
|
|
290
292
|
|
|
291
293
|
const state: SupervisorState = {
|
|
292
294
|
runnerPath: fileURLToPath(DEV_RUNNER_URL),
|
|
293
295
|
entryPath,
|
|
296
|
+
configFile,
|
|
294
297
|
cwd,
|
|
295
298
|
args,
|
|
296
299
|
watch,
|
package/src/i18n/catalogs.ts
CHANGED