chore: format whole repository with new configs

This commit is contained in:
Krzysztof Durek
2024-07-15 01:08:18 +02:00
parent 7a5c71cda3
commit 906e8de13b
349 changed files with 3565 additions and 3549 deletions

View File

@@ -4,15 +4,15 @@ import {
mkdirSync,
writeFileSync,
} from "node:fs";
import type { InferResultType } from "@/server/types/with";
import { spawnAsync } from "../process/spawnAsync";
import { COMPOSE_PATH } from "@/server/constants";
import { dirname, join } from "node:path";
import { COMPOSE_PATH } from "@/server/constants";
import type { InferResultType } from "@/server/types/with";
import boxen from "boxen";
import {
generateFileMountsCompose,
prepareEnvironmentVariables,
} from "../docker/utils";
import boxen from "boxen";
import { spawnAsync } from "../process/spawnAsync";
export type ComposeNested = InferResultType<
"compose",

View File

@@ -1,40 +1,40 @@
import { docker } from "@/server/constants";
import type { WriteStream } from "node:fs";
import { docker } from "@/server/constants";
import * as tar from "tar-fs";
import type { ApplicationNested } from ".";
import { getBuildAppDirectory } from "../filesystem/directory";
export const buildCustomDocker = async (
application: ApplicationNested,
writeStream: WriteStream,
application: ApplicationNested,
writeStream: WriteStream,
) => {
const { appName } = application;
const dockerFilePath = getBuildAppDirectory(application);
try {
const image = `${appName}`;
const contextPath =
dockerFilePath.substring(0, dockerFilePath.lastIndexOf("/") + 1) || ".";
const tarStream = tar.pack(contextPath);
const { appName } = application;
const dockerFilePath = getBuildAppDirectory(application);
try {
const image = `${appName}`;
const contextPath =
dockerFilePath.substring(0, dockerFilePath.lastIndexOf("/") + 1) || ".";
const tarStream = tar.pack(contextPath);
const stream = await docker.buildImage(tarStream, {
t: image,
dockerfile: dockerFilePath.substring(dockerFilePath.lastIndexOf("/") + 1),
// TODO: maybe use or not forcerm
// forcerm: true,
});
const stream = await docker.buildImage(tarStream, {
t: image,
dockerfile: dockerFilePath.substring(dockerFilePath.lastIndexOf("/") + 1),
// TODO: maybe use or not forcerm
// forcerm: true,
});
await new Promise((resolve, reject) => {
docker.modem.followProgress(
stream,
(err, res) => (err ? reject(err) : resolve(res)),
(event) => {
if (event.stream) {
writeStream.write(event.stream);
}
},
);
});
} catch (error) {
throw error;
}
await new Promise((resolve, reject) => {
docker.modem.followProgress(
stream,
(err, res) => (err ? reject(err) : resolve(res)),
(event) => {
if (event.stream) {
writeStream.write(event.stream);
}
},
);
});
} catch (error) {
throw error;
}
};

View File

@@ -1,8 +1,8 @@
import type { WriteStream } from "node:fs";
import type { ApplicationNested } from ".";
import { prepareEnvironmentVariables } from "../docker/utils";
import { getBuildAppDirectory } from "../filesystem/directory";
import { spawnAsync } from "../process/spawnAsync";
import type { WriteStream } from "node:fs";
// TODO: integrate in the vps sudo chown -R $(whoami) ~/.docker
export const buildHeroku = async (

View File

@@ -2,6 +2,7 @@ import { createWriteStream } from "node:fs";
import { docker } from "@/server/constants";
import type { InferResultType } from "@/server/types/with";
import type { CreateServiceOptions } from "dockerode";
import { uploadImage } from "../cluster/upload";
import {
calculateResources,
generateBindMounts,
@@ -14,7 +15,6 @@ import { buildCustomDocker } from "./docker-file";
import { buildHeroku } from "./heroku";
import { buildNixpacks } from "./nixpacks";
import { buildPaketo } from "./paketo";
import { uploadImage } from "../cluster/upload";
// NIXPACKS codeDirectory = where is the path of the code directory
// HEROKU codeDirectory = where is the path of the code directory

View File

@@ -1,8 +1,8 @@
import type { WriteStream } from "node:fs";
import type { ApplicationNested } from ".";
import { prepareEnvironmentVariables } from "../docker/utils";
import { getBuildAppDirectory } from "../filesystem/directory";
import { spawnAsync } from "../process/spawnAsync";
import type { WriteStream } from "node:fs";
// TODO: integrate in the vps sudo chown -R $(whoami) ~/.docker
export const buildNixpacks = async (

View File

@@ -1,8 +1,8 @@
import type { WriteStream } from "node:fs";
import { spawnAsync } from "../process/spawnAsync";
import type { ApplicationNested } from ".";
import { getBuildAppDirectory } from "../filesystem/directory";
import { prepareEnvironmentVariables } from "../docker/utils";
import { getBuildAppDirectory } from "../filesystem/directory";
import { spawnAsync } from "../process/spawnAsync";
// TODO: integrate in the vps sudo chown -R $(whoami) ~/.docker
export const buildPaketo = async (