unfold / heroku-buildpack-pnpm

Run PNPM install on Heroku
MIT License
38 stars 39 forks source link

Prune dev dependencies step also runs prepare script #48

Closed spatial-andrewc closed 1 year ago

spatial-andrewc commented 1 year ago

Describe the bug

I'm using the buildpack to install dependencies. My application has a prepare script which generates css classes and graphql codegen using the nx tool. The nx tool is a dev dependency. When building the app in Heroku the following steps take place:

  1. pnpm install
  2. prepare script runs
  3. prod build script runs
  4. dev dependencies are pruned
  5. prepare script runs again

The build fails when step 5 attempts to run the prepare script as it requires dev dependencies.

To Reproduce Steps to reproduce the behavior:

  1. Deploy a next js app to heroku that has a dev dependency that is used in the prepare script
  2. Create a manual deploy in Heroku
  3. Notice that the prepare script attempts to run during the Pruning devDependencies step

Versions (please complete the following information):

Additional context

Log file for the Pruning devDependencies step in Heroku build

-----> Pruning devDependencies

       devDependencies:
       - ... 
       - nx 16.5.0
       - ...

       > my-app@0.0.0 prepare /tmp/build_6499ea3f
       > nx generate-css && nx generate-gql

       sh: 1: nx: not found
        ELIFECYCLE  Command failed.
-----> Build failed
spatial-andrewc commented 1 year ago

Closing as this is a known issue for npm and pnpm.