Looking into lerna now, how does SST know which st...
# seed
g
Looking into lerna now, how does SST know which stacks it needs to deploy and what changed? Not very clear to me.
f
Hey @Garret Harp it works on the service level. So each SST app (sst.json) and each SLS service (serverless.yml) is a service on SEED.
g
Ah ok so that means the lerna starter you guys have up on github would not do partial builds & deploys? (https://github.com/serverless-stack/lerna-yarn-starter). This only has the top level sst.json, I was under the impression this repo did partial builds/deploys which is why I was confused how it worked.
f
Yeah, if you just have 1 SST app in ur repo, SEED would always build & deploy it. But if you have 2 SST apps, and if both are yarn workspace packages, SEED can then use lerna to figure out who changed, and only build & deploy the changed one.
That said, SST has the capability to figure out if the CloudFormation template did not change and skip the deploy.
g
I believe our frontend always deploys I assume because the build slightly changes the file names or something like that not entirely sure not a frontend dev myself 😅 and the frontend is really what the issue is since it can be pretty slow.
As far as backend though yeah its great at skipping any stacks which have no changes.
But if I wanted to split this out using lerna how would I reference the backend stack to get the api url for the frontend?
f
The simplest way would be to export the url in the backend app:
Copy code
this.addOutputs({
      ApiUrl: { value: api.url, exportName: "MyBackendUrl" },
    });
and then importing it in the frontend app:
Copy code
Fn.importValue("MyBackendUrl")
And you’d make both SST apps yarn workspaces.
Btw, just curious, how long does the frontend take to build? Is it React or Next.js?