mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix Docker builds for pnpm v11 (#1532)
This commit is contained in:
parent
bd910737e1
commit
9fa3a19920
30
.github/workflows/qemu-emulator-build.yaml
vendored
30
.github/workflows/qemu-emulator-build.yaml
vendored
@ -64,17 +64,14 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
|
||||
# Node/pnpm are needed on both arches: arm64 also runs
|
||||
# generate-env-development.mjs inside build-image.sh. amd64 additionally
|
||||
# builds and runs the CLI for the verification steps below.
|
||||
# Node is needed on both arches for generate-env-development.mjs.
|
||||
# pnpm is needed for build-image.sh (runs pnpm install inside Docker
|
||||
# context via the lockfile).
|
||||
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
|
||||
with:
|
||||
version: 10.23.0
|
||||
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
@ -145,17 +142,6 @@ jobs:
|
||||
# image to verify it works end-to-end before publishing. arm64 runs
|
||||
# under cross-arch TCG on an amd64 host, which can't reliably boot
|
||||
# Next.js within any sane window — skipped.
|
||||
- name: Build stack-cli (for emulator CLI)
|
||||
if: matrix.arch == 'amd64'
|
||||
run: |
|
||||
# Turbo's task graph for stack-cli#build includes
|
||||
# @hexclave/dashboard#build:rde-standalone, which transitively
|
||||
# depends on @hexclave/next#build (via dashboard → stack).
|
||||
# The pnpm filter must cover the dashboard dep tree too so that
|
||||
# devDependencies like tailwindcss are installed for the build.
|
||||
pnpm install --frozen-lockfile --filter '@hexclave/cli...' --filter '@hexclave/dashboard...'
|
||||
pnpm exec turbo run build --filter='@hexclave/cli...'
|
||||
|
||||
- name: Start emulator and verify
|
||||
if: matrix.arch == 'amd64'
|
||||
env:
|
||||
@ -163,7 +149,9 @@ jobs:
|
||||
EMULATOR_READY_TIMEOUT: 3200
|
||||
EMULATOR_IMAGE_DIR: ${{ env.EMULATOR_IMAGE_DIR }}
|
||||
EMULATOR_RUN_DIR: ${{ env.EMULATOR_RUN_DIR }}
|
||||
run: node packages/stack-cli/dist/index.js emulator start
|
||||
run: |
|
||||
chmod +x docker/local-emulator/qemu/run-emulator.sh
|
||||
docker/local-emulator/qemu/run-emulator.sh start
|
||||
|
||||
- name: Verify services are healthy
|
||||
if: matrix.arch == 'amd64'
|
||||
@ -171,7 +159,7 @@ jobs:
|
||||
EMULATOR_ARCH: ${{ matrix.arch }}
|
||||
EMULATOR_IMAGE_DIR: ${{ env.EMULATOR_IMAGE_DIR }}
|
||||
EMULATOR_RUN_DIR: ${{ env.EMULATOR_RUN_DIR }}
|
||||
run: node packages/stack-cli/dist/index.js emulator status
|
||||
run: docker/local-emulator/qemu/run-emulator.sh status
|
||||
|
||||
- name: Stop emulator
|
||||
if: always() && matrix.arch == 'amd64'
|
||||
@ -179,7 +167,7 @@ jobs:
|
||||
EMULATOR_ARCH: ${{ matrix.arch }}
|
||||
EMULATOR_IMAGE_DIR: ${{ env.EMULATOR_IMAGE_DIR }}
|
||||
EMULATOR_RUN_DIR: ${{ env.EMULATOR_RUN_DIR }}
|
||||
run: node packages/stack-cli/dist/index.js emulator stop
|
||||
run: docker/local-emulator/qemu/run-emulator.sh stop
|
||||
|
||||
- name: Package image
|
||||
run: |
|
||||
@ -259,8 +247,6 @@ jobs:
|
||||
fi
|
||||
|
||||
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
|
||||
with:
|
||||
version: 10.23.0
|
||||
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
|
||||
@ -131,7 +131,7 @@ function DashboardDetailContent({
|
||||
const [pendingCode, setPendingCode] = useState<string | null>(null);
|
||||
const [iframeReady, setIframeReady] = useState(hasSource);
|
||||
const [codePhase, setCodePhase] = useState<"typing" | "loading" | "done">("done");
|
||||
const codePhaseTimerRef = useRef<ReturnType<typeof setTimeout>>(null);
|
||||
const codePhaseTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const hasUnsavedChanges = currentTsxSource !== savedTsxSource;
|
||||
const { setNeedConfirm } = useRouterConfirm();
|
||||
const { toast } = useToast();
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import type { JSX } from 'react';
|
||||
|
||||
type IconProps = { iconSize: number };
|
||||
|
||||
export function Card({ iconSize }: IconProps) {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { JSX } from "react";
|
||||
import { Link } from "@/components/link";
|
||||
import { ChartLineIcon, ChatCircleDotsIcon, ClipboardTextIcon, CodeIcon, CreditCardIcon, EnvelopeSimpleIcon, FingerprintSimpleIcon, KeyIcon, MailboxIcon, MonitorPlayIcon, RocketIcon, ShieldCheckIcon, SparkleIcon, TelevisionSimpleIcon, TriangleIcon, UserGearIcon, UsersIcon, VaultIcon, WebhooksLogoIcon } from "@phosphor-icons/react";
|
||||
import { StackAdminApp } from "@hexclave/next";
|
||||
|
||||
@ -16,10 +16,10 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PNPM_HOME=/pnpm
|
||||
ENV PATH=$PNPM_HOME:$PATH
|
||||
ENV PATH=$PNPM_HOME:$PNPM_HOME/bin:$PATH
|
||||
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@10.23.0 --activate
|
||||
RUN corepack prepare pnpm@11.5.0 --activate
|
||||
RUN pnpm add -g turbo
|
||||
RUN pnpm add -g tsx
|
||||
|
||||
@ -38,6 +38,9 @@ RUN turbo prune --scope=@hexclave/backend --docker
|
||||
# Build stage
|
||||
FROM base AS builder
|
||||
|
||||
# Skip generate-sdks.ts in preinstall hook (file not available in pruned output)
|
||||
ENV STACK_SKIP_TEMPLATE_GENERATION=true
|
||||
|
||||
COPY --from=pruner /app/out/json/ .
|
||||
COPY --from=pruner /app/out/pnpm-lock.yaml .
|
||||
COPY .gitignore .
|
||||
@ -45,7 +48,7 @@ COPY pnpm-workspace.yaml .
|
||||
COPY turbo.json .
|
||||
COPY configs ./configs
|
||||
COPY --from=pruner /app/scripts/postinstall-patch-next-async-debug-info.mjs ./scripts/
|
||||
RUN STACK_SKIP_TEMPLATE_GENERATION=true pnpm install --frozen-lockfile
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
COPY --from=pruner /app/out/full/ .
|
||||
|
||||
@ -55,7 +58,7 @@ COPY docs ./docs
|
||||
ENV NEXT_CONFIG_OUTPUT=standalone
|
||||
|
||||
# Build backend only
|
||||
RUN pnpm turbo run docker-build --filter=@hexclave/backend...
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm turbo run docker-build --filter=@hexclave/backend...
|
||||
|
||||
|
||||
# Final image
|
||||
|
||||
@ -15,10 +15,10 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists
|
||||
|
||||
ENV PNPM_HOME=/pnpm
|
||||
ENV PATH=$PNPM_HOME:$PATH
|
||||
ENV PATH=$PNPM_HOME:$PNPM_HOME/bin:$PATH
|
||||
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@10.23.0 --activate
|
||||
RUN corepack prepare pnpm@11.5.0 --activate
|
||||
RUN pnpm add -g turbo
|
||||
RUN pnpm add -g tsx
|
||||
|
||||
@ -35,6 +35,9 @@ RUN turbo prune --scope=@hexclave/backend --scope=@hexclave/dashboard --docker
|
||||
|
||||
FROM node-base AS builder
|
||||
|
||||
# Skip generate-sdks.ts in preinstall hook (file not available in pruned output)
|
||||
ENV STACK_SKIP_TEMPLATE_GENERATION=true
|
||||
|
||||
# copy over package.json files and install dependencies
|
||||
COPY --from=pruner /app/out/json/ .
|
||||
COPY --from=pruner /app/out/pnpm-lock.yaml .
|
||||
@ -43,7 +46,7 @@ COPY pnpm-workspace.yaml .
|
||||
COPY turbo.json .
|
||||
COPY configs ./configs
|
||||
COPY --from=pruner /app/scripts/postinstall-patch-next-async-debug-info.mjs ./scripts/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store STACK_SKIP_TEMPLATE_GENERATION=true pnpm install --frozen-lockfile
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
# copy over the rest of the code for the build
|
||||
COPY --from=pruner /app/out/full/ .
|
||||
@ -56,7 +59,7 @@ ENV NEXT_CONFIG_OUTPUT=standalone
|
||||
ENV NEXT_PUBLIC_STACK_STRIPE_PUBLISHABLE_KEY=pk_test_mock_publishable_key_for_local_emulator
|
||||
|
||||
# Build the backend NextJS app
|
||||
RUN pnpm turbo run docker-build --filter=@hexclave/backend... --filter=@hexclave/dashboard...
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm turbo run docker-build --filter=@hexclave/backend... --filter=@hexclave/dashboard...
|
||||
|
||||
# Build the self-host seed script.
|
||||
# tsdown -> rolldown is multi-threaded Rust; under qemu-user (cross-arch
|
||||
@ -135,7 +138,7 @@ RUN npm install
|
||||
FROM node-base AS mock-oauth-builder
|
||||
WORKDIR /mock-oauth
|
||||
COPY apps/mock-oauth-server/package.json .
|
||||
RUN pnpm install && pnpm add esbuild --save-dev
|
||||
RUN printf 'allowBuilds:\n esbuild: true\n' > pnpm-workspace.yaml && pnpm install && pnpm add esbuild --save-dev
|
||||
COPY apps/mock-oauth-server/src ./src
|
||||
RUN npx esbuild src/index.ts --bundle --platform=node --target=node22 --outfile=dist/index.cjs
|
||||
|
||||
|
||||
@ -10,10 +10,10 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists
|
||||
|
||||
ENV PNPM_HOME=/pnpm
|
||||
ENV PATH=$PNPM_HOME:$PATH
|
||||
ENV PATH=$PNPM_HOME:$PNPM_HOME/bin:$PATH
|
||||
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@10.23.0 --activate
|
||||
RUN corepack prepare pnpm@11.5.0 --activate
|
||||
RUN pnpm add -g turbo
|
||||
RUN pnpm add -g tsx
|
||||
|
||||
@ -33,6 +33,9 @@ RUN turbo prune --scope=@hexclave/backend --scope=@hexclave/dashboard --docker
|
||||
# Build stage
|
||||
FROM base AS builder
|
||||
|
||||
# Skip generate-sdks.ts in preinstall hook (file not available in pruned output)
|
||||
ENV STACK_SKIP_TEMPLATE_GENERATION=true
|
||||
|
||||
# copy over package.json files and install dependencies
|
||||
COPY --from=pruner /app/out/json/ .
|
||||
COPY --from=pruner /app/out/pnpm-lock.yaml .
|
||||
@ -41,7 +44,7 @@ COPY pnpm-workspace.yaml .
|
||||
COPY turbo.json .
|
||||
COPY configs ./configs
|
||||
COPY --from=pruner /app/scripts/postinstall-patch-next-async-debug-info.mjs ./scripts/
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store STACK_SKIP_TEMPLATE_GENERATION=true pnpm install --frozen-lockfile
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
# copy over the rest of the code for the build
|
||||
COPY --from=pruner /app/out/full/ .
|
||||
@ -53,10 +56,10 @@ COPY docs ./docs
|
||||
ENV NEXT_CONFIG_OUTPUT=standalone
|
||||
|
||||
# Build the backend NextJS app
|
||||
RUN pnpm turbo run docker-build --filter=@hexclave/backend... --filter=@hexclave/dashboard...
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm turbo run docker-build --filter=@hexclave/backend... --filter=@hexclave/dashboard...
|
||||
|
||||
# Build the self-host seed script
|
||||
RUN cd apps/backend && pnpm build-self-host-migration-script
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store cd apps/backend && pnpm build-self-host-migration-script
|
||||
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.17.6",
|
||||
"@types/react": "link:@types/react@18.3.12",
|
||||
"@types/react": "18.3.12",
|
||||
"@types/react-dom": "^18",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-next": "14.2.3",
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
"react-icons": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "link:@types/react@18.3.12",
|
||||
"@types/react": "18.3.12",
|
||||
"@types/react-dom": "^18",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"postcss": "^8.4.35",
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.17.6",
|
||||
"@types/react": "link:@types/react@18.3.12",
|
||||
"@types/react": "18.3.12",
|
||||
"@types/react-dom": "^18",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-next": "14.2.5",
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.17.6",
|
||||
"@types/react": "link:@types/react@18.3.12",
|
||||
"@types/react": "18.3.12",
|
||||
"@types/react-dom": "^18",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-next": "14.2.3",
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "20.17.6",
|
||||
"@types/react": "link:@types/react@18.3.12",
|
||||
"@types/react": "18.3.12",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
|
||||
@ -90,30 +90,18 @@ import.meta.vitest?.test("getNodeText", ({ expect }) => {
|
||||
// Test with mixed array
|
||||
expect(getNodeText(["hello", 42, null])).toBe("hello42");
|
||||
|
||||
// Test with React element (mocked)
|
||||
const mockElement = {
|
||||
props: {
|
||||
children: "child text"
|
||||
}
|
||||
} as React.ReactElement;
|
||||
// Test with React element
|
||||
const mockElement = React.createElement("span", null, "child text");
|
||||
expect(getNodeText(mockElement)).toBe("child text");
|
||||
|
||||
// Test with nested React elements
|
||||
const nestedElement = {
|
||||
props: {
|
||||
children: {
|
||||
props: {
|
||||
children: "nested text"
|
||||
}
|
||||
} as React.ReactElement
|
||||
}
|
||||
} as React.ReactElement;
|
||||
const nestedElement = React.createElement("div", null, React.createElement("span", null, "nested text"));
|
||||
expect(getNodeText(nestedElement)).toBe("nested text");
|
||||
|
||||
// Test with array of React elements
|
||||
const arrayOfElements = [
|
||||
{ props: { children: "first" } } as React.ReactElement,
|
||||
{ props: { children: "second" } } as React.ReactElement
|
||||
React.createElement("span", null, "first"),
|
||||
React.createElement("span", null, "second"),
|
||||
];
|
||||
expect(getNodeText(arrayOfElements)).toBe("firstsecond");
|
||||
});
|
||||
|
||||
2023
pnpm-lock.yaml
2023
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -12,8 +12,8 @@ minimumReleaseAge: 10080
|
||||
blockExoticSubdeps: true
|
||||
|
||||
overrides:
|
||||
'@types/react': ^18.2.0
|
||||
'@types/react-dom': ^18.2.0
|
||||
'@types/react': 19.2.7
|
||||
'@types/react-dom': 19.2.3
|
||||
sharp: ^0.34.5
|
||||
|
||||
packageExtensions:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user