@codemation/cli 0.0.5 → 0.0.7
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 +20 -26
- package/dist/{CliBin-C3ar49fj.js → CliBin-Bx1lFBi5.js} +1041 -365
- package/dist/bin.js +1 -1
- package/dist/index.d.ts +644 -207
- package/dist/index.js +1 -1
- package/package.json +9 -6
- package/src/CliProgramFactory.ts +23 -8
- package/src/Program.ts +7 -3
- package/src/bootstrap/CodemationCliApplicationSession.ts +17 -19
- package/src/commands/DevCommand.ts +202 -171
- package/src/commands/ServeWebCommand.ts +26 -1
- package/src/commands/ServeWorkerCommand.ts +46 -30
- package/src/commands/devCommandLifecycle.types.ts +7 -11
- package/src/database/ConsumerDatabaseConnectionResolver.ts +55 -9
- package/src/database/DatabaseMigrationsApplyService.ts +2 -2
- package/src/dev/Builder.ts +1 -14
- package/src/dev/CliDevProxyServer.ts +447 -0
- package/src/dev/CliDevProxyServerFactory.ts +7 -0
- package/src/dev/DevApiRuntimeFactory.ts +44 -0
- package/src/dev/DevApiRuntimeHost.ts +130 -0
- package/src/dev/DevApiRuntimeServer.ts +107 -0
- package/src/dev/DevApiRuntimeTypes.ts +24 -0
- package/src/dev/DevAuthSettingsLoader.ts +9 -3
- package/src/dev/DevBootstrapSummaryFetcher.ts +1 -1
- package/src/dev/DevHttpProbe.ts +2 -2
- package/src/dev/DevNextHostEnvironmentBuilder.ts +35 -5
- package/src/dev/DevRebuildQueue.ts +54 -0
- package/src/dev/DevRebuildQueueFactory.ts +7 -0
- package/src/dev/DevSessionPortsResolver.ts +2 -2
- package/src/dev/DevSessionServices.ts +0 -4
- package/src/dev/DevSourceChangeClassifier.ts +33 -13
- package/src/dev/WatchRootsResolver.ts +6 -4
- package/src/runtime/NextHostConsumerServerCommandFactory.ts +11 -2
- package/src/runtime/TypeScriptRuntimeConfigurator.ts +7 -0
- package/src/user/CliDatabaseUrlDescriptor.ts +2 -2
- package/src/user/UserAdminCliBootstrap.ts +9 -21
- package/codemation-cli-0.0.3.tgz +0 -0
- package/src/dev/DevSourceRestartCoordinator.ts +0 -48
- package/src/dev/DevelopmentGatewayNotifier.ts +0 -35
- package/src/dev/RuntimeToolEntrypointResolver.ts +0 -47
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ApiPaths } from "@codemation/host";
|
|
2
|
-
import type { Logger } from "@codemation/host/next/server";
|
|
3
|
-
|
|
4
|
-
export class DevelopmentGatewayNotifier {
|
|
5
|
-
constructor(private readonly cliLogger: Logger) {}
|
|
6
|
-
|
|
7
|
-
async notify(
|
|
8
|
-
args: Readonly<{
|
|
9
|
-
gatewayBaseUrl: string;
|
|
10
|
-
developmentServerToken: string;
|
|
11
|
-
payload: Readonly<{
|
|
12
|
-
kind: "buildStarted" | "buildCompleted" | "buildFailed";
|
|
13
|
-
buildVersion?: string;
|
|
14
|
-
message?: string;
|
|
15
|
-
}>;
|
|
16
|
-
}>,
|
|
17
|
-
): Promise<void> {
|
|
18
|
-
const targetUrl = `${args.gatewayBaseUrl.replace(/\/$/, "")}${ApiPaths.devGatewayNotify()}`;
|
|
19
|
-
try {
|
|
20
|
-
const response = await fetch(targetUrl, {
|
|
21
|
-
method: "POST",
|
|
22
|
-
headers: {
|
|
23
|
-
"content-type": "application/json",
|
|
24
|
-
"x-codemation-dev-token": args.developmentServerToken,
|
|
25
|
-
},
|
|
26
|
-
body: JSON.stringify(args.payload),
|
|
27
|
-
});
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
this.cliLogger.warn(`failed to notify dev gateway status=${response.status}`);
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
this.cliLogger.warn(`failed to notify dev gateway: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { access } from "node:fs/promises";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
|
|
6
|
-
export type ResolvedRuntimeToolEntrypoint = Readonly<{
|
|
7
|
-
args: ReadonlyArray<string>;
|
|
8
|
-
command: string;
|
|
9
|
-
env: Readonly<Record<string, string>>;
|
|
10
|
-
}>;
|
|
11
|
-
|
|
12
|
-
export class RuntimeToolEntrypointResolver {
|
|
13
|
-
private readonly require = createRequire(import.meta.url);
|
|
14
|
-
|
|
15
|
-
async resolve(
|
|
16
|
-
args: Readonly<{
|
|
17
|
-
packageName: string;
|
|
18
|
-
repoRoot: string;
|
|
19
|
-
sourceEntrypoint: string;
|
|
20
|
-
}>,
|
|
21
|
-
): Promise<ResolvedRuntimeToolEntrypoint> {
|
|
22
|
-
const sourceEntrypointPath = path.resolve(args.repoRoot, args.sourceEntrypoint);
|
|
23
|
-
if (await this.exists(sourceEntrypointPath)) {
|
|
24
|
-
return {
|
|
25
|
-
command: process.execPath,
|
|
26
|
-
args: ["--import", "tsx", sourceEntrypointPath],
|
|
27
|
-
env: {
|
|
28
|
-
TSX_TSCONFIG_PATH: path.resolve(args.repoRoot, "tsconfig.codemation-tsx.json"),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
command: process.execPath,
|
|
34
|
-
args: [this.require.resolve(args.packageName)],
|
|
35
|
-
env: {},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private async exists(filePath: string): Promise<boolean> {
|
|
40
|
-
try {
|
|
41
|
-
await access(filePath);
|
|
42
|
-
return true;
|
|
43
|
-
} catch {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|