зеркало из
1
0
Форкнуть 0
Azure Static Web Apps CLI
Перейти к файлу
Timothy Wang b298821949
Merge pull request #883 from codingoutloud/main
Fix swa.md typo
2024-08-19 09:51:59 -04:00
.devcontainer fix: update node to 18 in dockerfile (#755) 2023-11-02 13:45:53 +08:00
.github fix: codeowners 2024-07-22 07:43:01 -07:00
.vscode (#684) Fixes for cli-config tests 2024-07-09 19:58:57 -07:00
cypress fix: move the runtime config file under appLocation (#471) 2022-05-18 13:27:07 +02:00
docs Fix swa.md typo 2024-08-18 14:50:27 -04:00
e2e (#684) fix: hugo detection failure 2024-07-11 07:29:33 -07:00
schema Add node:20 to the allowed api runtimes configuration. Fixes issue #864 2024-07-24 13:44:00 -04:00
scripts (#864) Convert to type=module in package.json 2024-07-02 16:13:12 -07:00
src Address PR comments. Change AAD variable to ENTRA_ID. Change route matching to use supported auth constant list. 2024-08-08 10:10:36 -04:00
swa-db-connections (#684) Added mockRestore for repeatable tests 2024-07-10 08:11:05 -07:00
tests/_mocks (#684) fixes to mock-fs and node-fetch mocks 2024-07-08 17:00:35 -07: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 (#864) Conversion to ESM - part 1 2024-07-02 14:00:02 -07: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
package-lock.json 2.0.1 2024-07-24 15:24:30 -04:00
package.json Update package.json node and npm engines 2024-07-24 15:34:02 -04:00
readme.md docs: Make the recommended install the main one 2023-01-18 16:20:03 +01:00
tsconfig.json fix: ci-deploy import attributes 2024-07-11 12:08:57 -07:00
vitest.config.unit.ts (#684) corrections / updates / e2e tests not working 2024-07-10 15:37:48 -07:00
vitest.workspace.ts (#684) corrections / updates / e2e tests not working 2024-07-10 15:37:48 -07: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 in your project, use:

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

    You can also install the SWA CLI globally using npm install -g @azure/static-web-apps-cli.

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.