Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
samchungy committed Oct 19, 2024
1 parent af9ed3b commit 9867fbd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { PatchFunction, PatchReturnType } from '../..';
import { log } from '../../../../../../utils/logging';

const DOCKER_IMAGE_CONFIG_REGEX =
/^(RUN --mount=type=bind,source=package.json,target=package.json \\\n(\s+)corepack enable pnpm && corepack install(?:.|\n)+?)(RUN )(pnpm config set store-dir \/root\/.pnpm-store)/gm;
/^(RUN --mount=type=bind,source=package.json,target=package.json \\\n(\s+)corepack enable pnpm && corepack install(?:.|\n)+?RUN )(pnpm config set store-dir \/root\/.pnpm-store)/gm;
const DOCKER_IMAGE_FETCH_REGEX =
/^(RUN --mount=type=bind,source=.npmrc,target=.npmrc \\\n)((?:(?!--mount=type=bind,source=package\.json,target=package\.json)[\s\S])+?\n(\s+)pnpm (fetch|install))/gm;

Expand Down Expand Up @@ -64,8 +64,8 @@ const patchPnpmDockerImages: PatchFunction = async ({
const patchedContents = contents
.replace(
DOCKER_IMAGE_CONFIG_REGEX,
(_, earlyCommands, whitespace, runLine, pnpmSetConfigLine) =>
`${earlyCommands}${runLine}${PACKAGE_JSON_MOUNT}${whitespace}${pnpmSetConfigLine}`,
(_, earlyCommands, whitespace, pnpmSetConfigLine) =>
`${earlyCommands}${PACKAGE_JSON_MOUNT}${whitespace}${pnpmSetConfigLine}`,
)
.replace(
DOCKER_IMAGE_FETCH_REGEX,
Expand Down

0 comments on commit 9867fbd

Please sign in to comment.