fixes for abandoned carts
This commit is contained in:
parent
cc107ddd88
commit
3adcc63c45
3 changed files with 32 additions and 23 deletions
23
changes.sh
23
changes.sh
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
CURR_PWD="$(pwd)"
|
CURR_PWD="$(pwd)"
|
||||||
REDIS_APL_PATH="$CURR_PWD/changes/snippets/redis_apl.ts"
|
REDIS_APL_PATH="$CURR_PWD/changes/snippets/redis_apl.ts"
|
||||||
DOCKERFILE_PATH="$CURR_PWD/Dockerfile"
|
OLD_REDIS_APL_PATH="$CURR_PWD/changes/snippets/redis_apl_old_sdk.ts"
|
||||||
|
APPS_DOCKERFILE_PATH="$CURR_PWD/apps.Dockerfile"
|
||||||
|
OTHER_DOCKERFILE_PATH="$CURR_PWD/other.Dockerfile"
|
||||||
|
|
||||||
app_paths=(
|
app_paths=(
|
||||||
"apps/apps/cms-v2"
|
"apps/apps/cms-v2"
|
||||||
|
@ -42,8 +44,11 @@ redis_apl_target_paths=(
|
||||||
"saleor-app-payment-stripe/src"
|
"saleor-app-payment-stripe/src"
|
||||||
)
|
)
|
||||||
echo "copying Dockerfiles..."
|
echo "copying Dockerfiles..."
|
||||||
cp -f ./apps.Dockerfile ./all_apps/apps/
|
cp -f ./apps.Dockerfile ./all_apps/apps/Dockerfile
|
||||||
cp -f ./abandoned-cart.Dockerfile ./all_apps/apps/
|
cp -f ./other.Dockerfile ./all_apps/saleor-app-payment-stripe/Dockerfile
|
||||||
|
cp -f ./other.Dockerfile ./all_apps/saleor-app-payment-klarna/Dockerfile
|
||||||
|
cp -f ./other.Dockerfile ./all_apps/saleor-app-payment-authorize.net/Dockerfile
|
||||||
|
cp -f ./other.Dockerfile ./all_apps/saleor-app-abandoned-checkouts/Dockerfile
|
||||||
|
|
||||||
echo "copying redis_apls..."
|
echo "copying redis_apls..."
|
||||||
for i in ${redis_apl_target_paths[*]}; do
|
for i in ${redis_apl_target_paths[*]}; do
|
||||||
|
@ -51,10 +56,14 @@ for i in ${redis_apl_target_paths[*]}; do
|
||||||
cp -f "$REDIS_APL_PATH" "./all_apps/$i"
|
cp -f "$REDIS_APL_PATH" "./all_apps/$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# abandoned-checkouts Uses old sdk
|
||||||
|
cp -f "$OLD_REDIS_APL_PATH" "./all_apps/saleor-app-abandoned-checkouts/redis_apl.ts"
|
||||||
|
|
||||||
|
# mass patch apps to use redis_apl and build in standalone
|
||||||
find ./all_apps/apps -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
|
find ./all_apps/apps -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
|
||||||
echo "pached all_apps/apps/**/saleor-app.ts"
|
echo "pached all_apps/apps/**/saleor-app.ts"
|
||||||
|
|
||||||
find ./all_apps/apps -name "next.config.js" -exec cargo run --package modify-saleor-app -- {} \;
|
find ./all_apps/apps -name "next.config.js" -exec cargo run --package modify-next-config -- {} \;
|
||||||
echo "pached all_apps/apps/**/saleor-app.ts"
|
echo "pached all_apps/apps/**/saleor-app.ts"
|
||||||
|
|
||||||
find ./all_apps/saleor-app-abandoned-checkouts -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
|
find ./all_apps/saleor-app-abandoned-checkouts -name "saleor-app.ts" -exec cargo run --package modify-saleor-app -- {} \;
|
||||||
|
@ -72,14 +81,14 @@ for i in "saleor-app-payment-klarna" "saleor-app-payment-stripe" "saleor-app-pay
|
||||||
echo "patched $i"
|
echo "patched $i"
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
cd "saleor-app-abandoned-checkouts"
|
||||||
|
git apply "$CURR_PWD/patches/saleor-app-abandoned-checkouts/next.config.js.patch"
|
||||||
cd "$CURR_PWD"
|
cd "$CURR_PWD"
|
||||||
|
|
||||||
for i in ${app_paths[*]}; do
|
for i in ${app_paths[*]}; do
|
||||||
cd "./all_apps/$i"
|
cd "./all_apps/$i"
|
||||||
echo $(pwd)
|
echo $(pwd)
|
||||||
pnpm i
|
# pnpm i
|
||||||
pnpm i ioredis
|
pnpm i ioredis
|
||||||
cp -f "$DOCKERFILE_PATH" .
|
|
||||||
cd "$CURR_PWD"
|
cd "$CURR_PWD"
|
||||||
done
|
done
|
||||||
|
|
|
@ -8,35 +8,25 @@ WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Install dependencies based on the preferred package manager
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||||
RUN \
|
RUN corepack enable pnpm && pnpm i --frozen-lockfile
|
||||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
|
||||||
else echo "Lockfile not found." && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# Rebuild the source code only when needed
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
|
||||||
# Next.js collects completely anonymous telemetry data about general usage.
|
# Next.js collects completely anonymous telemetry data about general usage.
|
||||||
# Learn more here: https://nextjs.org/telemetry
|
# Learn more here: https://nextjs.org/telemetry
|
||||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
# Uncomment the following line in case you want to disable telemetry during the build.
|
||||||
# ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN \
|
RUN corepack enable pnpm && pnpm build
|
||||||
if [ -f yarn.lock ]; then yarn run build; \
|
|
||||||
elif [ -f package-lock.json ]; then npm run build; \
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
|
||||||
else echo "Lockfile not found." && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ARG PUBLIC_PATH
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||||
|
@ -45,7 +35,7 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder $PUBLIC_PATH ./public
|
||||||
|
|
||||||
# Set the correct permission for prerender cache
|
# Set the correct permission for prerender cache
|
||||||
RUN mkdir .next
|
RUN mkdir .next
|
||||||
|
|
10
patches/saleor-app-abandoned-checkouts/next.config.js.patch
Normal file
10
patches/saleor-app-abandoned-checkouts/next.config.js.patch
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
diff --git a/next.config.js b/next.config.js
|
||||||
|
index 3dd7ef1..fd2a201 100644
|
||||||
|
--- a/next.config.js
|
||||||
|
+++ b/next.config.js
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
/** @type {import('next').NextConfig} */
|
||||||
|
module.exports = {
|
||||||
|
+ output: "standalone",
|
||||||
|
reactStrictMode: true,
|
||||||
|
};
|
Loading…
Reference in a new issue