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

Add swa.json config file #20

Closed
manekinekko opened this issue Oct 18, 2020 · 6 comments · Fixed by #294
Closed

Add swa.json config file #20

manekinekko opened this issue Oct 18, 2020 · 6 comments · Fixed by #294
Labels
good first issue Good for newcomers priority: low (P2) Low priority scope: cli Issues happened a the ./src/cli level type: enhancement New feature or request

Comments

@manekinekko
Copy link
Member

manekinekko commented Oct 18, 2020

Describe the solution you'd like
As a user, I'd like to be able to start swa using a config file. All the CLI flags should be supported.

{
  "options": {
   // CLI flags
  }
}

File name options:

  • swa.json
  • swa.config.json
  • .swarc
  • swa property in package.json
@manekinekko manekinekko added good first issue Good for newcomers priority: medium (P1) Medium priority scope: cli Issues happened a the ./src/cli level type: enhancement New feature or request labels Oct 18, 2020
@manekinekko manekinekko self-assigned this Oct 18, 2020
@manekinekko manekinekko added priority: low (P2) Low priority and removed priority: medium (P1) Medium priority labels Oct 30, 2020
@manekinekko manekinekko added this to To do in Pre-GA Nov 5, 2020
@manekinekko manekinekko pinned this issue Mar 9, 2021
@itpropro
Copy link

  • swa property in package.json could lead to problems with monorepos
  • swa.json not really clear that it's a config file
  • swa.config.json, .swarc both fine for me

I would prefer .swarc, as I think the most important thing about the naming would be to avoid confusion with the staticwebapp.config.json file for the user.

@k-miyake
Copy link
Contributor

I assume that staticwebapp.config.json is already enabled as mentioned in this docs. Does this issue mean that the file name may be changed in the future?

I think staticwebapp.config.json is too long and I like swa.config.json.

@manekinekko
Copy link
Member Author

manekinekko commented Mar 11, 2021

@k-miyake sorry about the confusion:

  • staticwebapp.config.json is the config file for your project deployed on SWA
  • swa.config.json (name to be defined) would be the config file for the CLI.

Do you have other suggestions for the CLI config file?

@k-miyake
Copy link
Contributor

k-miyake commented Mar 11, 2021

@manekinekko I was mistaken, sorry.
In this issue, discussing a different file than staticwebapp.config.json.

It is preferable to use a file name that indicates it is for development.
For example, swa.development.json or local.development.json.

@anthonychu
Copy link
Member

For naming, thinking something like swa-cli.config.json so it's clear that it's for the CLI.

For contents, I think we can start with a single prop named configurations (not sure what else to name them, maybe environments? contexts?).

{
  "configurations": {
    "app1": {
      "context": "./static",
      "api": "./api"
    },
    "app2": {
      "context": "http://localhost:3000",
      "app-startup-command": "cd frontend && npm start", // proposed in #147
      "api": "./api"
    }
  }
}

If there's a single configuration, swa start can just use it.

If there's more than one, use swa start app1. If there's a folder of the same name, the CLI will prefer the config file.

If swa start is run without a context, perhaps use interactive prompts to create the file. (this is lower priority and can be a separate issue)

@manekinekko manekinekko removed this from To do in Pre-GA Apr 7, 2021
@manekinekko manekinekko removed their assignment Jun 2, 2021
@alexweininger
Copy link
Contributor

alexweininger commented Sep 3, 2021

I really like this feature. I'm exploring adding local debugging for SWAs into the VS Code extension and this would make the configuration much easier on users.

I think users would be much more comfortable editing a swa-cli.config.json versus launch/tasks.json files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers priority: low (P2) Low priority scope: cli Issues happened a the ./src/cli level type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants