Skip to content

Commit

Permalink
Move utils to types
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed Jan 26, 2024
1 parent e5db5bd commit 34ea18a
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/dockerCompose/src/setDappnodeComposeDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { mapValues, toPairs, sortBy, fromPairs, pick } from "lodash-es";
import {
getContainerName,
getPrivateNetworkAliases,
getIsCore,
parseEnvironment,
getImageTag,
getIsMonoService,
} from "@dappnode/utils";
import { params } from "@dappnode/params";
import { cleanCompose } from "./clean.js";
import { parseServiceNetworks } from "./networks.js";
import {
getContainerName,
getImageTag,
Compose,
ComposeNetworks,
ComposeService,
Expand Down
4 changes: 2 additions & 2 deletions packages/httpsPortal/src/domains.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContainerNames } from "@dappnode/types";
import { getShortUniqueDnp, getContainerDomain } from "@dappnode/utils";
import { ContainerNames, getContainerDomain } from "@dappnode/types";
import { getShortUniqueDnp } from "@dappnode/utils";

export function stripBadDomainChars(s: string): string {
// eslint-disable-next-line no-useless-escape
Expand Down
8 changes: 6 additions & 2 deletions packages/installer/src/installer/downloadImages.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import fs from "fs";
import { isAbsolute } from "path";
import { InstallPackageData, DistributedFile } from "@dappnode/types";
import {
InstallPackageData,
DistributedFile,
getImageTag,
} from "@dappnode/types";
import { Log, logs } from "@dappnode/logger";
import { shell, validatePath, getImageTag } from "@dappnode/utils";
import { shell, validatePath } from "@dappnode/utils";
import { getDockerImageManifest } from "@dappnode/dockerapi";
import { DappnodeInstaller } from "../dappnodeInstaller.js";

Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ export * from "./releaseFiles.js";
export * from "./errors.js";
export * from "./routes.js";
export * from "./subscriptions.js";

// utils
export * from "./utils/index.js";
3 changes: 3 additions & 0 deletions packages/types/src/utils/READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Utils

This package contains utility functions that are used between the dappmanager and the dappnode sdk. They must not use any external dependency.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { params } from "@dappnode/params";
import { getContainerDomain } from "./getContainerDomain.js";

/**
Expand All @@ -19,6 +18,6 @@ export const getContainerName = ({
}): string =>
// Note: _PREFIX variables already end with the character "-"
[
isCore ? params.CONTAINER_CORE_NAME_PREFIX : params.CONTAINER_NAME_PREFIX,
isCore ? "DAppNodeCore-" : "DAppNodePackage-",
getContainerDomain({ dnpName, serviceName }),
].join("");
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/types/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { getImageTag } from "./getImageTag.js";
export { getContainerName } from "./getContainerName.js";
export { getContainerDomain } from "./getContainerDomain.js";
3 changes: 0 additions & 3 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export { applyRecursivelyToStringValues } from "./applyRecursivelyToStringValues.js";
export { JsonFileDb } from "./jsonFileDb.js";
export { PlainTextFileDb } from "./plainTextFileDb.js";
export { getContainerName } from "./getContainerName.js";
export { getContainerDomain } from "./getContainerDomain.js";
export { validatePath } from "./validatePath.js";
export { isNotFoundError } from "./isNotFoundError.js";
export { yamlParse, yamlDump } from "./yaml.js";
Expand All @@ -28,7 +26,6 @@ export {
} from "./environment.js";
export { writeEnvFile, createGlobalEnvsEnvFile } from "./globalEnvs.js";
export { getManifestPath } from "./getManifestPath.js";
export { getImageTag } from "./getImageTag.js";
export { getImagePath } from "./getImagePath.js";
export { getIsMonoService } from "./getIsMonoService.js";
export { getEnvFilePath } from "./getEnvFilePath.js";
Expand Down

0 comments on commit 34ea18a

Please sign in to comment.