зеркало из
1
0
Форкнуть 0
Azure Static Web Apps CLI
Перейти к файлу
Adrian Hall ede048c903 (#684) fixes to mock-fs and node-fetch mocks 2024-07-08 17:00:35 -07:00
.devcontainer fix: update node to 18 in dockerfile (#755) 2023-11-02 13:45:53 +08:00
.github (#864) Conversion to ESM - part 1 2024-07-02 14:00:02 -07:00
.vscode (#684) revert to typescript 4 latest 2024-07-03 10:28:23 -07: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 feat: support dotnet-isolated 8.0 for managed APIs (#809) 2024-03-06 15:07:29 +08:00
scripts (#864) Convert to type=module in package.json 2024-07-02 16:13:12 -07:00
src (#684) fixes to mock-fs and node-fetch mocks 2024-07-08 17:00:35 -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 (#684) switch to vitest part 1 - WIP 2024-07-08 13:55:06 -07:00
package.json (#684) switch to vitest part 1 - WIP 2024-07-08 13:55:06 -07:00
readme.md docs: Make the recommended install the main one 2023-01-18 16:20:03 +01:00
tsconfig.json (#684) switch to vitest part 1 - WIP 2024-07-08 13:55:06 -07:00
vitest.config.ts Add mocking file for memfs vitest mocking setup. All tests passing in file.spec.ts 2024-07-08 17:40:58 -04: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.