UNPKG

@dappnode/dappnodesdk

Version:

dappnodesdk is a tool to make the creation of new dappnode packages as simple as possible. It helps to initialize and publish in ethereum blockchain

54 lines 1.93 kB
import path from "path"; import Listr from "listr/index.js"; import { buildWithBuildx } from "./buildWithBuildx.js"; import { buildWithCompose } from "./buildWithCompose.js"; import { defaultArch } from "@dappnode/types"; import { getImageFileName } from "../../utils/getImageFileName.js"; import { getOsArchitecture } from "../../utils/getArchitecture.js"; /** * The naming scheme for multiarch exported images must be * compatible with DAppNodes that expect a single ".tar.xz" file * which must be amd64, x86_64 * * const imageEntry = files.find(file => /\.tar\.xz$/.test(file)); */ export function getBuildTasks({ packagesToBuildProps, buildTimeout, skipSave, rootDir }) { const buildTasks = packagesToBuildProps.flatMap((pkgProps) => { return pkgProps.architectures.map(architecture => createBuildTask({ pkgProps, architecture, buildTimeout, skipSave, rootDir })); }); return buildTasks; } function createBuildTask({ pkgProps, architecture, buildTimeout, skipSave, rootDir }) { const { manifest, releaseDir, images, compose } = pkgProps; const { name, version } = manifest; const buildFn = architecture === getOsArchitecture() ? buildWithCompose : buildWithBuildx; const destPath = getImagePath({ releaseDir, name, version, architecture }); return { title: `Build ${name} (version ${version}) for arch ${architecture}`, task: () => new Listr(buildFn({ architecture, images, compose, manifest, buildTimeout, skipSave, destPath, rootDir })) }; } function getImagePath({ releaseDir, name, version, architecture = defaultArch }) { return path.join(releaseDir, getImageFileName(name, version, architecture)); } //# sourceMappingURL=getBuildTasks.js.map