I am trying to run a PNPM command in `after_deploy...
# seed
r
I am trying to run a PNPM command in
after_deploy
and its coming back with command not found. We install PNPM in the
compile
section of the
seed.yaml
. Is there a way to use PNPM without having to reinstall it all over again just for the
after_deploy
section? I need to run some commands specifically on the graphql services that have changed in that deploy.
f
Hey @Rob N, what are you running inside
after_deploy
? Is that something you can run using the
Script
construct?https://docs.serverless-stack.com/constructs/Script#running-after-deploy
To add some context, SEED uses an optimized build environment for SST app (ie. deploying SST apps are free). Currently we don’t keep the build environment around during the CloudFormation update. So the
after_deploy
step is run in a new build environment.
^ It’s something we are looking to improve.
r
huh interesting that might be doable. Looking to register our graphql sub schema with apollo studio with apollo rover on the CLI
f
Yeah, the
Script
construct should work. You can hook into both
onCreate
and `onUpdate`:
Copy code
import { Stack, Script } from "@serverless-stack/resources";

export class AfterDeployStack extends Stack {
  constructor(scope, id) {
    super(scope, id);

    new Script(this, "RegisterSchema", {
      onCreate: "src/registerSchema.main",
      onUpdate: "src/registerSchema.main",
    });
  }
}
r
Thanks Frank I will take a look