#mikeyo_code

1 messages ¡ Page 1 of 1 (latest)

vagrant torrentBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1339870888153186357

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

austere flare
#

Hi! Have you tried to run this command: run yarn/npm install with a version that produces lockfiles?

dark edge
#

hey thanks for the reply! we have a lockfile but its in the monorepo root rather than the colocated with the app

#

Just to add a bit of context - using npm as our package manager it is not possible to generate a lock file for a workspace repo (eg with npm install --package-lock-only ) so the work around atm is just to copy the root level package-lock.json into the workspace directory, run stripe apps upload and remove the lockfile. Not sure the implications of this as this will include dependencies for everything in the monorepo

vagrant torrentBOT
dark edge
#

This works by first copying package-lock.json from the project root into the workspace directory, uploading to stripe and cleaning up.

#!/bin/bash

# Exit on any error
set -e

# Store original directory
ORIGINAL_DIR=$(pwd)

# Change to apps/stripe directory
cd apps/stripe

# Remove existing lock file if it exists
rm -f package-lock.json

# Copy package-lock.json from project root to apps/stripe directory
cp ../../package-lock.json ./

# Run stripe apps upload
stripe apps upload

# Remove the lock file after upload
rm -f package-lock.json

# Return to original directory
cd "$ORIGINAL_DIR"

# Exit successfully
exit 0
plush wadi
#

To clarify, your package.json is located somewhere outside of the directory where your Stripe App lives?
Is this package.json also responsible for dependencies for other parts of your code, non-Stripe App-related?

dark edge
#

yes exactly - its a turborepo with conventional structure of apps/ and packages/ which contain many related projects configured as npm workspaces

#

so the package-lock.json lives in the project root which is how npm wants to handle it (and pretty sure this is true for all package managers)

#

Im going to continue copying from the root with an adjusted version of the above script which I have edited to not pollute this thread

plush wadi
#

Since Stripe Apps is a standalone application, why wouldn't you have a dedicated package.json for it?
It feels off to have a single package.json for the whole monorepo.

dark edge
#

we dont have a single package.json for the whole monorepo - its a single package-lock.json

dark edge
plush wadi
dark edge
#

thats not how npm workspaces function (or any other package manager) - they intentionally keep a single top level lock file to dedupe dependencies across the project and for other magical reasons

plush wadi
#

I understand. I don't think Stripe Apps CLI supports that right now, sadly, and will expect everything to be in the same directory. I think it's worth submitting feedback to Stripe Support: https://support.stripe.com/?contact=true