### Install Dependencies and Start Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/svelte/README.md Install project dependencies using npm and start the development server to see your app running locally. Changes are reflected on hot reload. ```bash cd svelte-app npm install ``` ```bash npm run dev ``` -------------------------------- ### Initial Project Setup Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/remix/README.md Execute this command for the initial setup of the project after cloning or creating it. ```bash npm run setup ``` -------------------------------- ### Start emulator with a startup command Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-start.md Start the emulator and automatically run a specified command to launch the development server. This combines serving static content with starting the dev server in one step. ```bash swa start http://localhost:3000 --run "npm start" ``` ```bash swa start http://localhost:5000 --run "dotnet watch run" ``` ```bash swa start http://localhost:4000 --run "jekyll serve" ``` ```bash swa start http://localhost:4200 --run "./startup.sh" ``` -------------------------------- ### Install Dependencies and Run Sapper Project Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/sapper/README.md After creating the project, install its dependencies and start the development server. ```bash cd my-app npm install # or yarn npm run dev ``` -------------------------------- ### Start Svelte Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/svelte-kit/README.md After installing dependencies, run npm run dev to start the development server. Use the -- --open flag to automatically open the app in a new browser tab. ```bash npm run dev # or start the server and open the app in a new browser tab npm run dev -- --open ``` -------------------------------- ### Install and Start Metalsmith Project Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/metalsmith/README.md Run these commands to install dependencies and start the Metalsmith build process. ```bash npm install npm start ``` -------------------------------- ### Example Static Sites Client Configuration Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/contribute/99-troubleshooting.md An example of a completed Static Sites Client configuration file. ```json { "metadata": { "version": "stable", "buildId": "1.0.020761", ... }, "binary":"/home/USER/.swa/deploy/1.0.020761/StaticSitesClient", "checksum": "360b76959c68cc0865b1aea144c8eb2aa413f4856e55c781a83bd7e1ad352362" } ``` -------------------------------- ### Start Local Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/docusaurus/README.md Starts a local development server for live preview. Changes are reflected without a server restart. ```bash $ yarn start ``` -------------------------------- ### Create and Run a Marko App Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/marko/README.md Use this command to scaffold a new Marko application with the basic template. After creation, navigate into the project directory, install dependencies, and start the development server. ```bash npx @marko/create marko-app --template basic cd marko-app npm install npm run dev ``` -------------------------------- ### Configure Installation Path and Bundle Directory Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/flutter/windows/CMakeLists.txt Sets up installation paths, ensuring support files are placed next to the executable for in-place execution. It also makes the 'install' step default for Visual Studio builds. ```cmake # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Clone and Install GA Preview SWA CLI Source: https://github.com/azure/static-web-apps-cli/wiki/Try-out-the-preview-version Clone the repository for the GA preview version, navigate into the directory, install npm packages, and link the CLI locally. ```bash git clone -b ga http://github.com/Azure/static-web-apps-cli.git ``` ```bash cd static-web-apps-cli ``` ```bash npm install ``` ```bash npm link ``` -------------------------------- ### SWA Login Configuration Example Source: https://github.com/azure/static-web-apps-cli/wiki/GA-Test-Plan Example of the `.env` file created after a successful login, containing Azure subscription and tenant IDs. Also, ensure the `.gitignore` file is updated to include `.env` if in a git project. ```text AZURE_SUBSCRIPTION_ID=00000000-0000-0000-0000-000000000000 AZURE_TENANT_ID=00000000-0000-0000-0000-000000000000 ``` -------------------------------- ### Install Brunch Globally Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/brunch/README.md Install the Brunch build tool globally on your system. ```bash npm install -g brunch ``` -------------------------------- ### Start SWA Emulator with Context Source: https://github.com/azure/static-web-apps-cli/wiki/FAQ Use this command to start the emulator and serve static content from a specified folder or proxy requests to a dev server. The context determines how the emulator serves content. ```bash swa start ``` ```bash swa start ./ ``` -------------------------------- ### Install Polymer CLI Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/polymer/README.md Installs the Polymer CLI globally. Ensure you have Node.js and npm installed. ```bash npm install -g polymer-cli@next ``` -------------------------------- ### Start emulator with static content and manual API dev server Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-start.md Serve static content from a specified folder and connect to a manually started API development server using its URI. ```bash swa start ./my-dist --api-devserver-url http://localhost:7071 ``` -------------------------------- ### Examples of Launching Dev Servers Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/2-emulator.md Demonstrates how to use the `--run` option with common development server launch commands for various frameworks. ```bash # npm start script (React) swa start http://localhost:3000 --run "npm start" ``` ```bash # dotnet watch (Blazor) swa start http://localhost:5000 --run "dotnet watch run" ``` ```bash # Jekyll swa start http://localhost:4000 --run "jekyll serve" ``` ```bash # custom script swa start http://localhost:4200 --run "./startup.sh" ``` -------------------------------- ### Start Brunch Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/brunch/README.md Starts the project in watch mode with continuous rebuilding and launches an HTTP server with pushState support. ```bash npm start ``` -------------------------------- ### Install Node.js Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/brunch/README.md Install Node.js using Homebrew on macOS. ```bash brew install node ``` -------------------------------- ### Start SWA CLI with Default Config Location (Static Files) Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/5-config.md Starts the SWA CLI, searching the specified static file output folder for `staticwebapp.config.json`. ```bash swa start ./my-dist ``` -------------------------------- ### Start Docusaurus Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/README.md Navigate to the docs/www directory and run this command to start the development server. It includes hot reloading and serves the site locally. ```bash cd docs/www npm start ``` -------------------------------- ### Example Output of `--print-config` Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-config.md This output shows the default configuration options for a new project before any specific configuration file is applied. ```text Options: - port: 4280 - host: localhost - apiPort: 7071 - appLocation: . - apiLocation: - outputLocation: . - swaConfigLocation: - ssl: false - sslCert: - sslKey: - appBuildCommand: - apiBuildCommand: - run: - verbose: log - serverTimeout: 60 - open: false - githubActionWorkflowLocation: - env: preview - appName: - dryRun: false - subscriptionId: - resourceGroup: - tenantId: - clientId: - clientSecret: - useKeychain: true - clearCredentials: false - config: swa-cli.config.json - printConfig: true ``` -------------------------------- ### Start Emulator from Current Folder Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/2-emulator.md Serves static content from the current working directory by default. No additional configuration is needed. ```bash swa start ``` -------------------------------- ### Start SWA CLI with Default Config Location (Dev Server) Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/5-config.md Starts the SWA CLI, searching the current working directory for `staticwebapp.config.json` when using a front-end dev server. ```bash swa start http://localhost:3000 ``` -------------------------------- ### Static and Devserver Configurations Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-config.md This example demonstrates defining separate configurations for static output and a development server, each with its own output location and source configuration. ```json { "configurations": { "static": { "outputLocation": "./my-dist", "swaConfigLocation": "./my-app-source" }, "devserver": { "outputLocation": "http://localhost:3000", "swaConfigLocation": "./my-app-source" } } } ``` -------------------------------- ### Example swa-cli.config.json Configuration Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-init.md This is an example of a `swa-cli.config.json` file that can be generated by `swa init`. It defines settings for a specific application configuration named 'myApp'. ```json { "$schema": "https://aka.ms/azure/static-web-apps-cli/schema", "configurations": { "myApp": { "appLocation": ".", "apiLocation": "api", "outputLocation": "dist", "appBuildCommand": "npm run build", "apiBuildCommand": "npm run build --if-present", "run": "npm run dev", "appDevserverUrl": "http://localhost:8080" } } } ``` -------------------------------- ### Install NPM Dependencies Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/DEVELOPER.md Install all project dependencies defined in the package.json file. ```bash npm install ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/docusaurus/README.md Run this command to install project dependencies using Yarn. ```bash $ yarn ``` -------------------------------- ### Install Latest GA Source Code Source: https://github.com/azure/static-web-apps-cli/wiki/GA-Test-Plan Clone the latest source code from the GA branch and install dependencies. ```bash git clone -b ga http://github.com/Azure/static-web-apps-cli.git ``` ```bash cd static-web-apps-cli ``` ```bash npm install ``` ```bash npm run build ``` ```bash npm test ``` ```bash npm run e2e:static ``` ```bash npm link ``` -------------------------------- ### Initialize Open-wc Project Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/lit/README.md Use this command to start a new project with Open-wc. Requires Node.js 10 and npm 6 or higher. ```sh npm init @open-wc # requires node 10 & npm 6 or higher ``` -------------------------------- ### Start SWA Emulator with npx Source: https://github.com/azure/static-web-apps-cli/blob/main/readme.md Start the SWA emulator using npx. The emulator runs locally and can be accessed at http://localhost:4280. ```bash npx @azure/static-web-apps-cli start ``` -------------------------------- ### Run Hexo Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/hexo/source/_posts/hello-world.md Starts a local development server to preview your Hexo blog. Changes are often reflected live as you save them. ```bash hexo server ``` -------------------------------- ### Run Capacitor App with Serve Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/capacitor/README.md Use the 'serve' package to run the minimal Capacitor app. Ensure you have Node.js and npm installed. ```bash npx serve ``` -------------------------------- ### Initialize a New Stencil App Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/stencil/readme.md Use this command to clone the Stencil repository and start a new project in a specified directory. ```bash npm init stencil app ``` -------------------------------- ### Install Dependencies for Front-End App Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-build.md Install dependencies specifically for your front-end application located in the './client' directory. This is useful when your app requires a build step. ```bash swa build --app-location ./client ``` -------------------------------- ### Start Postgres Database with Docker Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/remix/README.md Run this npm script to start the Postgres database in a Docker container. Ensure Docker is running and the container has finished setting up before proceeding. ```bash npm run docker ``` -------------------------------- ### Install Application Target and Runtime Files Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/flutter/windows/CMakeLists.txt Installs the main application executable, ICU data file, Flutter library, and any bundled plugin libraries to the specified runtime destinations. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### SWA CLI Configuration File Example Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-deploy.md An example of a 'swa-cli.config.json' file defining a single application configuration. This file specifies locations for the application, API, and build output, and can be used to simplify deployment commands. ```json { "configurations": { "my-app": { "appLocation": "./", "apiLocation": "api", "outputLocation": "frontend", "start": { "outputLocation": "frontend" }, "deploy": { "outputLocation": "frontend" } } } } ``` -------------------------------- ### Install Brunch New Project Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/brunch/README.md Use this command to create a new Brunch project with an ES6 skeleton. ```bash brunch new dir -s es6 ``` -------------------------------- ### C# Hello World Program Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/wintersmith/contents/articles/another-test/index.md A simple 'Hello, world!' example in C# demonstrating the basic structure of a console application. ```cs class ExampleClass { static void Main() { System.Console.WriteLine("Hello, world!"); } } ``` -------------------------------- ### Install SWA CLI Globally Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/1-install.md Installs the Static Web Apps CLI globally on your system using npm. This makes the `swa` command available in your terminal. ```bash npm install -g @azure/static-web-apps-cli ``` -------------------------------- ### Install CLI from Main Branch (npm) Source: https://github.com/azure/static-web-apps-cli/wiki/Installing-from-a-Git-branch Install the Azure Static Web Apps CLI from the 'main' branch using npm. This command fetches the latest development version. ```bash npm install https://github.com/Azure/static-web-apps-cli.git#main ``` -------------------------------- ### Serve Polymer Element Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/polymer/README.md Starts the Polymer development server and automatically opens the preview in your default browser. Execute this command from the top-level project folder. ```bash polymer serve --open ``` -------------------------------- ### Start Site on French Locale Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/docusaurus/docs/tutorial-extras/translate-your-site.md Run the development server with the '--locale fr' flag to preview your site in French during development. ```bash npm run start -- --locale fr ``` -------------------------------- ### Use a custom command to run framework development server Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-start.md Execute a custom shell command or script to start your framework's development server. ```bash swa start http://localhost:3000 --run "npm start" ``` -------------------------------- ### Running Specific Configurations Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-config.md After defining multiple configurations in `swa-cli.config.json`, you can run them by specifying the configuration name with the `swa start` command. ```bash swa start static ``` ```bash swa start devserver ``` -------------------------------- ### Navigate to SWA Project Directory Source: https://github.com/azure/static-web-apps-cli/wiki/Installing-from-a-Git-branch Change your current directory to your Static Web Apps project folder before installing the CLI. ```bash cd my-swa-app/ ``` -------------------------------- ### Deploy to Surge Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/svelte/README.md Install the Surge CLI globally, build your Svelte app for production, and then deploy the public directory using Surge. ```bash npm install -g surge ``` ```bash npm run build surge public my-project.surge.sh ``` -------------------------------- ### Run Next.js Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/nextjs/README.md Use these commands to start the development server for your Next.js application. Open http://localhost:3000 in your browser to view the result. ```bash npm run dev # or yarn dev ``` -------------------------------- ### Marko Project Commands Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/marko/README.md These commands are used to manage the Marko project. `npm run dev` starts the development server, `npm run build` creates a production-ready Node.js server, and `npm start` runs the production server. ```bash npm run dev ``` ```bash npm run build ``` ```bash npm start ``` -------------------------------- ### Watch Mode Compilation Output Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/contribute/2-developer.md Example console output when starting compilation in watch mode. The terminal will update automatically as file changes are detected and saved. ```bash Starting compilation in watch mode... Found 0 errors. Watching for file changes. ``` -------------------------------- ### Check SWA CLI Version in Docker Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/docker.md After starting the SWA CLI Docker container, use this command to verify the installed version of the CLI within the container's bash prompt. ```bash swa --version ``` -------------------------------- ### Validate SWA CLI Installation Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/1-install.md Checks the installed version of the Static Web Apps CLI to confirm a successful installation. Run this command after installing the CLI. ```bash swa --version # Should print out the version number ``` -------------------------------- ### Start Emulator and Launch Dev Server Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/2-emulator.md Simplifies the workflow by having the SWA CLI launch the development server. Pass the launch command for the dev server to the `--run` option. ```bash swa start --run ``` -------------------------------- ### Run Hugo Local Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/hugo/themes/ananke/README.md Start Hugo's built-in local development server to preview your site. Access the site by navigating to `localhost:1313` in your browser. ```bash $ hugo server ``` -------------------------------- ### Create and Develop Gridsome Project Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/gridsome/README.md Create a new Gridsome project, navigate into its directory, and start the local development server. The server will be available at http://localhost:8080. ```bash gridsome create my-gridsome-site ``` ```bash cd my-gridsome-site ``` ```bash gridsome develop ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/solid/README.md Installs project dependencies using npm, pnpm, or yarn. Ensure you have the chosen package manager installed. ```bash $ npm install # or pnpm install or yarn install ``` -------------------------------- ### Start Emulator Proxying to Dev Server Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/2-emulator.md Proxies requests to a running front-end development server. Ensure the dev server is running and note its URL. ```bash swa start ``` -------------------------------- ### Run App in Development Mode Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/solid/README.md Starts the Solid application in development mode, typically accessible at http://localhost:3000. The app will automatically reload on code changes. ```bash npm dev ``` ```bash npm start ``` -------------------------------- ### Default Configuration File Example Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-config.md This JSON defines a single configuration named 'app' with specified development server URL, API location, build command, and source location. ```json { "configurations": { "app": { "appDevserverUrl": "http://localhost:3000", "apiLocation": "api", "run": "npm run start", "swaConfigLocation": "./my-app-source" } } } ``` -------------------------------- ### Start emulator with dev server and API Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-start.md Bind the emulator to a local development server URI and integrate with an API backend. This allows for simultaneous development of the front-end and API. ```bash swa start http://localhost:3000 --api-location ./api ``` -------------------------------- ### Start emulator with static content and API Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-start.md Serve static content from a specified folder and integrate with an API backend located in another folder. The CLI will automatically manage the Azure Functions Core Tools. ```bash swa start ./my-dist --api-location ./api ``` -------------------------------- ### Install Gridsome CLI Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/gridsome/README.md Install the Gridsome CLI globally using npm. This command is required before you can create new Gridsome projects. ```bash npm install --global @gridsome/cli ``` -------------------------------- ### Initialize Astro Project with Frameworks Template Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/astro-multiple/README.md Use this command to create a new Astro project pre-configured for multiple frameworks. ```bash npm init astro -- --template framework-multiple ``` -------------------------------- ### Initialize Configuration File Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-config.md Use the `swa init` command to create a new configuration file. You can specify a custom path using the `--config` option. ```bash swa --config ``` -------------------------------- ### JSX Code Block Example Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/docusaurus/docs/tutorial-basics/markdown-features.mdx Code blocks with syntax highlighting are supported. This example shows a simple React component definition. ```jsx function HelloDocusaurus() { return

Hello, Docusaurus!

; } ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/flutter/windows/CMakeLists.txt Installs the Flutter assets directory. It first removes the existing directory to ensure a clean copy from the build output. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Babel Stage 0 Preset Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/brunch/README.md Install the Babel preset for stage 0 features, which includes proposed JavaScript features not yet in ES6. ```bash npm install --save-dev babel-preset-stage-0 ``` -------------------------------- ### Install AOT Library for Release/Profile Builds Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/flutter/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library, but only for Profile and Release build configurations. This optimizes performance for non-debug builds. ```cmake # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Initialize SWA Project with npx Source: https://github.com/azure/static-web-apps-cli/blob/main/readme.md Use npx to create a configuration for your SWA project. This command initializes the necessary files and settings for your static web app. ```bash npx @azure/static-web-apps-cli init ``` -------------------------------- ### Install Ananke Theme as Git Submodule Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/hugo/themes/ananke/README.md Installs the Ananke theme by adding it as a Git submodule to your Hugo project. This command should be run from your project's root directory. ```bash git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke ``` -------------------------------- ### Initialize Astro Project with Solid.js Template Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/astro-solid/README.md Use this command to create a new Astro project pre-configured with Solid.js support. This sets up the necessary dependencies and project structure for using Solid components within Astro. ```bash npm init astro -- --template framework-solid ``` -------------------------------- ### Initialize Astro Project with Lit Template Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/astro-lit/README.md Use this command to create a new Astro project pre-configured with the Lit framework template. This sets up the basic structure for using Lit components within Astro. ```bash npm init astro -- --template framework-lit ``` -------------------------------- ### Install External Svelte Component as devDependency Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/sapper/README.md Install an external Svelte component as a devDependency to ensure it is bundled and compiled with your Sapper app. This is necessary for server-side rendering and client-side optimization. ```bash npm install -D @sveltejs/svelte-virtual-list ``` -------------------------------- ### Install SWA CLI as a Development Dependency Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/1-install.md Installs the Static Web Apps CLI as a development dependency within your project using npm. This is useful for project-specific CLI usage. ```bash npm install -D @azure/static-web-apps-cli ``` -------------------------------- ### Clone Tutorial Repository Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/polymer/README.md Clones the Polymer 3 first element tutorial repository from GitHub. ```bash git clone https://github.com/PolymerLabs/polymer-3-first-element.git ``` -------------------------------- ### Markdown Code Block Example with Indentation Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/wintersmith/contents/articles/markdown-syntax/index.md Shows an example of an indented code block in Markdown and its corresponding HTML output, highlighting that one level of indentation is removed from each line. ```markdown Here is an example of AppleScript: tell application "Foo" beep end tell ``` ```html

Here is an example of AppleScript:

tell application "Foo"
    beep
end tell
``` -------------------------------- ### Get Language Direction in Hugo Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/hugo/themes/ananke/layouts/partials/func/GetLanguageDirection.html This snippet retrieves the language direction. It checks if the Hugo version is at least 0.67.1 and then attempts to get the LanguageDirection from the site's language configuration. ```html {{ $dir := "" }} {{ if ge hugo.Version "0.67.1" }} {{ with site.Language.LanguageDirection }} {{ $dir = . }} {{ end }} {{ end }} {{ return $dir }} ``` -------------------------------- ### Build App Using Configuration File Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-build.md Build your application using a specific configuration named 'myApp' defined in your `swa-cli.config.json` file. This allows for complex build setups. ```bash swa build myApp ``` -------------------------------- ### Install CLI from Specific Branch (npm) Source: https://github.com/azure/static-web-apps-cli/wiki/Installing-from-a-Git-branch Install the Azure Static Web Apps CLI from a specific Git branch using npm. Replace 'BRANCH' with the actual branch name. ```bash npm install https://github.com/Azure/static-web-apps-cli.git#BRANCH ``` -------------------------------- ### Start Docusaurus Development Server Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/docusaurus/docs/intro.md Navigate to your Docusaurus project directory and run this command to build and serve your site locally. Changes are reflected on automatic reload. ```bash cd my-website npm run start ``` -------------------------------- ### Markdown Lazy Numbering for Ordered Lists Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/wintersmith/contents/articles/markdown-syntax/index.md Shows that Markdown produces the same HTML output even if list numbers are inconsistent or start from an arbitrary number, though starting with '1' is recommended. ```markdown 1. Bird 1. McHale 1. Parish ``` ```markdown 3. Bird 1. McHale 8. Parish ``` -------------------------------- ### Start Azure Functions Core Tools Manually Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/use/3-api-server.md Start the API server manually using Azure Functions Core Tools. Note the URL for the local API server once it is running. ```bash func host start ``` -------------------------------- ### Initialize Astro Project with Svelte Template Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/astro-svelte/README.md Use this command to create a new Astro project pre-configured with the Svelte framework. ```bash npm init astro -- --template framework-svelte ``` -------------------------------- ### Initialize Astro Project with React Template Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/astro-react/README.md Use this command to create a new Astro project pre-configured with React. This sets up the necessary dependencies and structure for using React components within Astro. ```bash npm init astro -- --template framework-react ``` -------------------------------- ### Initialize Git Repository Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/ssr/remix/README.md Initialize a new Git repository for your project. ```sh git init ``` -------------------------------- ### Get a Specific Kitten Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/slate/source/index.html.md Retrieves details for a specific kitten using its ID. ```APIDOC ## Get a Specific Kitten ### Description This endpoint retrieves a specific kitten by its unique identifier. ### Method GET ### Endpoint http://example.com/kittens/ ### Path Parameters - **ID** (integer) - The ID of the kitten to retrieve. ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the kitten. - **name** (string) - The name of the kitten. - **breed** (string) - The breed of the kitten. - **fluffiness** (integer) - A measure of the kitten's fluffiness. - **cuteness** (integer) - A measure of the kitten's cuteness. ### Response Example ```json { "id": 2, "name": "Max", "breed": "unknown", "fluffiness": 5, "cuteness": 10 } ``` ``` -------------------------------- ### StaticSitesClient.json Configuration Example Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/contribute/99-troubleshooting.md This JSON file is used to configure the Static Sites Client binary path and metadata. Ensure the checksums match between the binary and its metadata. ```json { "metadata": { "version": "stable", "buildId": "1.0.020761", ... }, "binary":"/home/USER/.swa/deploy/1.0.020761/StaticSitesClient", "checksum": SH256 CHECKSUM OF THE BINARY SEE BELOW } ``` -------------------------------- ### Reference Links Example Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/wintersmith/contents/articles/markdown-syntax/index.md Demonstrates reference-style links with multiple definitions at the end of the document. ```markdown I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]. [1]: http://google.com/ "Google" [2]: http://search.yahoo.com/ "Yahoo Search" [3]: http://search.msn.com/ "MSN Search" ``` -------------------------------- ### Get All Kittens Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/slate/source/index.html.md Retrieves a list of all kittens. Supports filtering by availability and inclusion of cats. ```APIDOC ## Get All Kittens ### Description This endpoint retrieves all kittens. It supports query parameters to include cats in the response and to specify whether to include adopted kittens. ### Method GET ### Endpoint http://example.com/api/kittens ### Query Parameters - **include_cats** (boolean) - Default: false - If set to true, the result will also include cats. - **available** (boolean) - Default: true - If set to false, the result will include kittens that have already been adopted. ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the kitten. - **name** (string) - The name of the kitten. - **breed** (string) - The breed of the kitten. - **fluffiness** (integer) - A measure of the kitten's fluffiness. - **cuteness** (integer) - A measure of the kitten's cuteness. ### Response Example ```json [ { "id": 1, "name": "Fluffums", "breed": "calico", "fluffiness": 6, "cuteness": 7 }, { "id": 2, "name": "Max", "breed": "unknown", "fluffiness": 5, "cuteness": 10 } ] ``` ``` -------------------------------- ### Get All Kittens (Shell) Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/slate/source/index.html.md Use this shell command to retrieve all kittens, including the Authorization header. ```shell curl "http://example.com/api/kittens" \ -H "Authorization: meowmeowmeow" ``` -------------------------------- ### Test Linked SWA CLI Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/contribute/2-developer.md After linking, navigate to any project directory and run 'swa --help' to verify that the CLI reflects your local build. ```bash cd swa --h ``` -------------------------------- ### Get a Specific Kitten Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/slate/source/index.html.md Retrieve details for a specific kitten by providing its ID. The ID is a URL parameter. ```ruby require 'kittn' api = Kittn::APIClient.authorize!('meowmeowmeow') api.kittens.get(2) ``` ```python import kittn api = kittn.authorize('meowmeowmeow') api.kittens.get(2) ``` ```javascript const kittn = require("kittn"); let api = kittn.authorize("meowmeowmeow"); let max = api.kittens.get(2); ``` -------------------------------- ### Initialize swa CLI Configuration with Defaults Source: https://github.com/azure/static-web-apps-cli/blob/main/docs/www/docs/cli/swa-init.md Use this command to quickly initialize the Static Web Apps CLI configuration with default values for all options, skipping the interactive prompts. ```bash swa init --yes ``` -------------------------------- ### Get All Kittens Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/slate/source/index.html.md This endpoint retrieves all kittens. Query parameters can be used to include cats or kittens that have been adopted. ```ruby require 'kittn' api = Kittn::APIClient.authorize!('meowmeowmeow') api.kittens.get ``` ```python import kittn api = kittn.authorize('meowmeowmeow') api.kittens.get() ``` ```javascript const kittn = require("kittn"); let api = kittn.authorize("meowmeowmeow"); let kittens = api.kittens.get(); ``` -------------------------------- ### Run Ember App Tests Continuously Source: https://github.com/azure/static-web-apps-cli/blob/main/e2e/samples/app/ember/README.md Starts the development server and runs tests automatically when changes are detected. ```bash ember test --server ```