@companyhelm/cli 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cli.js +12 -1
- package/dist/commands/dependencies.js +29 -14
- package/dist/commands/interactive.d.ts +1 -0
- package/dist/commands/interactive.js +4 -1
- package/dist/commands/logs.js +2 -2
- package/dist/commands/register-commands.js +4 -1
- package/dist/commands/reset.js +1 -1
- package/dist/commands/set-image-version.js +3 -3
- package/dist/commands/setup-github-app.d.ts +4 -1
- package/dist/commands/setup-github-app.js +30 -8
- package/dist/commands/startup-preferences.d.ts +3 -0
- package/dist/commands/startup-preferences.js +39 -0
- package/dist/core/bootstrap/DeploymentBootstrapper.d.ts +2 -1
- package/dist/core/bootstrap/DeploymentBootstrapper.js +23 -8
- package/dist/core/config/ApiEnvFileWriter.d.ts +5 -3
- package/dist/core/config/ApiEnvFileWriter.js +20 -13
- package/dist/core/config/GithubAppConfigStore.js +2 -10
- package/dist/core/docker/ComposeTemplateRenderer.js +0 -1
- package/dist/core/docker/DockerStackManager.js +1 -2
- package/dist/core/local/ApiLocalService.d.ts +1 -1
- package/dist/core/local/ApiLocalService.js +3 -3
- package/dist/core/logs/LogsService.d.ts +2 -1
- package/dist/core/logs/LogsService.js +5 -4
- package/dist/core/runner/RunnerSupervisor.d.ts +6 -0
- package/dist/core/runner/RunnerSupervisor.js +20 -3
- package/dist/core/runner/runner-bootstrap.d.ts +2 -0
- package/dist/core/runner/runner-bootstrap.js +48 -0
- package/dist/core/runtime/CliPackageMetadata.d.ts +3 -0
- package/dist/core/runtime/CliPackageMetadata.js +8 -0
- package/dist/core/runtime/CliRoot.d.ts +2 -0
- package/dist/core/runtime/CliRoot.js +23 -0
- package/dist/core/runtime/ImageCatalog.js +2 -2
- package/dist/core/runtime/LocalConfigStore.d.ts +4 -4
- package/dist/core/runtime/LocalConfigStore.js +18 -27
- package/dist/core/runtime/PublicImageTagRegistry.d.ts +1 -0
- package/dist/core/runtime/PublicImageTagRegistry.js +34 -14
- package/dist/core/runtime/RepoConfigStore.d.ts +16 -0
- package/dist/core/runtime/RepoConfigStore.js +63 -0
- package/dist/core/runtime/RuntimePaths.d.ts +2 -0
- package/dist/core/runtime/RuntimePaths.js +6 -0
- package/dist/core/services/ManagedServiceNames.d.ts +5 -0
- package/dist/core/services/ManagedServiceNames.js +12 -0
- package/dist/preflight/ApiPortPreflightCheck.d.ts +6 -0
- package/dist/preflight/ApiPortPreflightCheck.js +10 -0
- package/dist/preflight/DockerInstalledPreflightCheck.d.ts +7 -0
- package/dist/preflight/DockerInstalledPreflightCheck.js +15 -0
- package/dist/preflight/PortAvailabilityPreflightCheck.d.ts +7 -0
- package/dist/preflight/PortAvailabilityPreflightCheck.js +31 -0
- package/dist/preflight/PostgresPortPreflightCheck.d.ts +6 -0
- package/dist/preflight/PostgresPortPreflightCheck.js +10 -0
- package/dist/preflight/PreflightCheck.d.ts +3 -0
- package/dist/preflight/PreflightCheck.js +1 -0
- package/dist/preflight/WebPortPreflightCheck.d.ts +6 -0
- package/dist/preflight/WebPortPreflightCheck.js +10 -0
- package/dist/preflight/runStartupPreflightChecks.d.ts +18 -0
- package/dist/preflight/runStartupPreflightChecks.js +42 -0
- package/dist/templates/api.env.tpl +3 -0
- package/package.json +2 -2
- package/src/templates/api.env.tpl +3 -0
- package/dist/core/runtime/ProjectPaths.d.ts +0 -7
- package/dist/core/runtime/ProjectPaths.js +0 -16
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DockerInstalledPreflightCheck } from "./DockerInstalledPreflightCheck.js";
|
|
2
|
+
import { ApiPortPreflightCheck } from "./ApiPortPreflightCheck.js";
|
|
3
|
+
import { PostgresPortPreflightCheck } from "./PostgresPortPreflightCheck.js";
|
|
4
|
+
import { WebPortPreflightCheck } from "./WebPortPreflightCheck.js";
|
|
5
|
+
export async function runStartupPreflightChecks(options) {
|
|
6
|
+
await new DockerInstalledPreflightCheck(options.commandRunner).run();
|
|
7
|
+
const currentStatus = await options.readStatus();
|
|
8
|
+
if (shouldCheckApiPort(options, currentStatus)) {
|
|
9
|
+
await new ApiPortPreflightCheck(options.ports.apiHttp).run();
|
|
10
|
+
}
|
|
11
|
+
if (shouldCheckWebPort(options, currentStatus)) {
|
|
12
|
+
await new WebPortPreflightCheck(options.ports.ui).run();
|
|
13
|
+
}
|
|
14
|
+
if (shouldCheckPostgresPort(options, currentStatus)) {
|
|
15
|
+
await new PostgresPortPreflightCheck().run();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function shouldCheckApiPort(options, currentStatus) {
|
|
19
|
+
return shouldCheckServicePort("api", options.currentState, currentStatus.api, options.desiredSources.api.source);
|
|
20
|
+
}
|
|
21
|
+
function shouldCheckWebPort(options, currentStatus) {
|
|
22
|
+
return shouldCheckServicePort("frontend", options.currentState, currentStatus.frontend, options.desiredSources.frontend.source);
|
|
23
|
+
}
|
|
24
|
+
function shouldCheckPostgresPort(options, currentStatus) {
|
|
25
|
+
if (options.desiredSources.api.source !== "local") {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return currentStatus.postgres !== "running";
|
|
29
|
+
}
|
|
30
|
+
function shouldCheckServicePort(service, currentState, currentStatus, desiredSource) {
|
|
31
|
+
if (currentStatus !== "running") {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
const currentService = currentState?.services[service];
|
|
35
|
+
if (!currentService) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (currentService.source === "docker") {
|
|
39
|
+
return desiredSource !== "docker";
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companyhelm/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Bootstrap and manage a local CompanyHelm deployment.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@clack/prompts": "^1.1.0",
|
|
30
|
-
"@companyhelm/runner": "^0.
|
|
30
|
+
"@companyhelm/runner": "^0.2.0",
|
|
31
31
|
"chalk": "^5.6.2",
|
|
32
32
|
"commander": "^14.0.1",
|
|
33
33
|
"dockerode": "^4.0.9",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
export class ProjectPaths {
|
|
3
|
-
root;
|
|
4
|
-
constructor(root = process.cwd()) {
|
|
5
|
-
this.root = root;
|
|
6
|
-
}
|
|
7
|
-
companyhelmRootPath() {
|
|
8
|
-
return path.join(this.root, ".companyhelm");
|
|
9
|
-
}
|
|
10
|
-
apiDirectoryPath() {
|
|
11
|
-
return path.join(this.companyhelmRootPath(), "api");
|
|
12
|
-
}
|
|
13
|
-
apiEnvPath() {
|
|
14
|
-
return path.join(this.apiDirectoryPath(), ".env");
|
|
15
|
-
}
|
|
16
|
-
}
|