Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe apps CLI incompatible with monorepos #1305

Open
imikemiller opened this issue Feb 14, 2025 · 0 comments
Open

Stripe apps CLI incompatible with monorepos #1305

imikemiller opened this issue Feb 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@imikemiller
Copy link

Its not possible to deploy a stripe app using stripe apps upload from an npm workspace. A conventional structure for monorepos (for example using turborepo) would be to have multiple apps and packages in the same repository. In this setup using npm workspaces (i believe the same is true for all JS package managers) there is no compatible way to use the stripe apps CLI.

Issue

When running stripe apps upload in an npm workspace the CLI will error with

×  Failed to package files
failed to find any package manager lockfiles, run yarn/npm install with a version that produces lockfiles

This is because the lockfile is not co-located with the app in a monorepo setup.

If we run the command in the project root where the lockfile is located the CLI will error with

error reading stripe app manifest file. open stripe-app.json: no such file or directory

Both make sense but this means that its not possible to host a stripe app in a monorepo without janky workarounds.

Expected Behavior

I expect the CLI to find the package-lock.json in the root of the project. Or, failing that, allow me to point the CLI to the package-lock.json or point the CLI to the stripe manifest in another location.

Steps to reproduce

  • Setup a turbo repo with npx create-turbo@latest.
  • Create an app for stripe in the apps directory and setup
  • Attempt stripe apps upload in the workspace directory

Workaround

I am not sure this is reliable as the package-lock.json will contain references to workspaces that are relative to the project root but this gets around the error and allows the app to upload.

#!/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

@imikemiller imikemiller added the bug Something isn't working label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant