зеркало из
1
0
Форкнуть 0
Azure Static Web Apps CLI
Перейти к файлу
Jikun 34864d0a78
fix: load staticwebapp.config.json schema locally when timeout (#808)
2024-03-05 04:30:47 +08:00
.devcontainer fix: update node to 18 in dockerfile (#755) 2023-11-02 13:45:53 +08:00
.github ci: use node 18 for ci, test and docs deployment (#772) 2023-11-03 11:10:15 +08:00
.vscode chore: add html-preview-vscode to devcontainer 2022-03-07 14:43:16 +01:00
cypress fix: move the runtime config file under appLocation (#471) 2022-05-18 13:27:07 +02:00
docs Light / Dark theme applied by default based on OS / Browser preference (#753) 2023-11-02 13:56:22 +08:00
e2e feat: support '--data-api-location' in 'swa init' (#735) 2023-07-27 16:28:23 +08:00
schema fix: load staticwebapp.config.json schema locally when timeout (#808) 2024-03-05 04:30:47 +08:00
scripts chore: fix docker pipeline 2022-06-03 11:46:42 +02:00
src fix: load staticwebapp.config.json schema locally when timeout (#808) 2024-03-05 04:30:47 +08:00
.all-contributorsrc docs: add cjk7989 as a contributor for code (#730) 2023-07-18 11:03:49 +08:00
.editorconfig chore: add config files 2020-07-01 10:09:10 +02:00
.gitignore test: integrate e2e samples (#483) 2022-05-18 13:38:43 +02:00
.npmignore ci: fix all tests on windows 2022-05-05 20:52:52 +02:00
.nvmrc build(packaging): Update nodejs and npm versions 2022-05-06 08:43:23 +02:00
.prettierrc feat: support for self-generating ssl certificates (#441) 2022-04-12 15:54:54 +02:00
CODE_OF_CONDUCT.md chore: enforce formatting 2022-04-08 11:40:58 +02:00
CONTRIBUTING.md feat: Add new flags for Function runtime and Function version (#562) 2023-03-29 00:11:26 +05:30
LICENSE chore: update repo config after migration to azure (#48) 2021-01-29 16:00:39 +01:00
SECURITY.md chore: enforce formatting 2022-04-08 11:40:58 +02:00
cypress.json fix: allow users to set custom error pages (#179) 2021-04-09 16:09:26 +02:00
jest.config.js fix: downgrade deps to avoid breaking changes 2022-04-28 17:42:05 +02:00
package-lock.json chore: bump to 1.1.7-alpha after release (#780) 2023-11-09 00:54:00 +08:00
package.json chore: bump to 1.1.7-alpha after release (#780) 2023-11-09 00:54:00 +08:00
readme.md docs: add badges (#491) 2022-05-19 09:56:02 +02:00
tsconfig.json chore: add jest-extended 2021-03-05 14:42:12 +01:00

readme.md

Azure Static Web Apps CLI

NPM version Node version CI status Contributions welcome

logo

The Static Web Apps CLI, also known as SWA CLI, serves as a local development tool for Azure Static Web Apps. It can:

  • Serve static app assets, or proxy to your app dev server
  • Serve API requests, or proxy to APIs running in Azure Functions Core Tools
  • Emulate authentication and authorization
  • Emulate Static Web Apps configuration, including routing and ACL roles
  • Deploy your app to Azure Static Web Apps

Important Notes

If you have suggestions or you encounter issues, please report them or help us fix them. Your contributions are very much appreciated. 🙏

The CLI emulates commonly used capabilities of the Azure Static Web Apps cloud service. Some differences are expected. Always deploy and test your apps in Azure to confirm behavior.

Quickstart

Installing the CLI with npm, yarn or pnpm:

  • To install the CLI globally, use:

    npm install -g @azure/static-web-apps-cli
    

    You can also install the SWA CLI inside a project (instead of globally) as a development dependency using npm install -D @azure/static-web-apps-cli. This is highly recommended.

Basic usage

  • Open a SWA app folder at the root (outside any /api or /app folders):

    cd my-awesome-swa-app
    
  • The best way to get started is to run the swa command alone and follow the interactive prompts:

    swa
    

It will generate a configuration for you, then build your project and ask if you want to deploy it to Azure.

See swa for more details.

Extended usage

Here are the currently supported swa commands. Use swa <command> --help to learn about options and usage for that particular command.

  • login: login into Azure
  • init: initialize a new static web app project
  • start: start the emulator from a directory or bind to a dev server
  • deploy: deploy the current project to Azure Static Web Apps
  • build: build your project

Using npx:

  • Open a SWA app folder at the root (outside any /api or /app folders):
cd my-awesome-swa-app
  • Create a configuration for your project:
npx @azure/static-web-apps-cli init
  • Start the emulator:
npx @azure/static-web-apps-cli start
  • Access your SWA app from http://localhost:4280

See all available commands and options.

Want to help?

Want to file a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the list: community-help.