Is there a way to specify looking in a different f...
# sst
t
Is there a way to specify looking in a different folder instead of
lib
with sst.json
j
Not yet but a couple of folks have requested it so far https://github.com/serverless-stack/serverless-stack/discussions/180
g
@Jay I’m happy to take this one on.
j
@geekmidas Thank you! Let me pull @Frank in here. He might have something for you 😉
f
Should we let ppl specify the path in
sst.json
?
Copy code
{
  "name": "playground",
  "stage": "dev",
  "region": "us-east-1",
  "path_to_stack_definition": "lib"
}
If so, what should we we call this field?
Just talked to Jay, let’s name the field
main"
, and it points to the
index.js
file. So
sst.json
would look like this:
Copy code
{
  "name": "playground",
  "stage": "dev",
  "region": "us-east-1",
  "main": "infra/index.js"
}
@geekmidas I opened an issue here if you want to take a crack at it https://github.com/serverless-stack/serverless-stack/issues/553
g
I started working on this and I can see that the
lib/
is being created in the
.build
when running the tests. I am struggling to find where this is being done, anyone free to help? @Frank @Jay
@Jay correct me if i’m wrong
j
That is the file where we first read from the
lib
dir. Is that what you were looking for @geekmidas?
g
Not really @Jay, it seems to me you are currently building the
lib/
and having the result of that moved to
.build/
I'm not sure where that is happening I made the change to look for the
main
inside
sst.json
, the issue I'm having now is the fact that my
infra/index.js
is using
ES6
imports and they can't be resolved in that context. Meaning I am missing some build step.
j
g
@Jay Thanks, I will add the feature before end of day.
@Jay @Frank The PR is out, but it failed the label check. Should we not add that to the contribution guide? About how to create a PR into the project?
f
Awesome! Thanks @geekmidas! I will take a look at the PR today or tmr.
Good point on the contribution guide. I created an issue to update the contribution guide, and assigned it to @Jay - https://github.com/serverless-stack/serverless-stack/projects/1#card-65230812
@thdxr this is now possible in v0.35.0 by specifying the path to the app file in `sst.json`:
Copy code
{
  "name": "my-sst-app",
  "stage": "dev",
  "region": "us-east-1",
  "main": "infra/index.js"
}
t
Amazing thank you