Giter Club home page Giter Club logo

vscode-azurestaticwebapps's Introduction

Azure Static Web Apps for Visual Studio Code

Version Installs Build Status

Use this extension to quickly create and manage Azure Static Web Apps directly from VS Code.

Visit the wiki for additional information about the extension.

Sign up today for your free Azure account and receive 12 months of free popular services, $200 free credit and 25+ always free services 👉 Start Free.

Support for vscode.dev

The Azure Static Web Apps extension supports running on vscode.dev and github.dev. Open a GitHub repository to create and update Static Web Apps directly from your browser! Debugging is not supported on the web. Note that this does not require the Azure Account extension and uses VS Code's built-in authentication provider.

Run and debug your static web app

Debug static web app with a dynamic configuration

✨ Check out Guide: Debugging a Static Web App with VS Code for instructions and more information about debugging a static web app.

Create your first static web app

  1. Click the '+' button in the explorer to setup a new static web app

    Create Static Web App

  2. Select "Create Static Web App..."

    Create Static Web App

  3. Authorize access to your GitHub account so the extension can find your repositories

    Authorize Access to through GitHub

    Authorize Access to through GitHub

  4. Select a repository and branch that will be deployed to the static web app

    If your local project has a remote configured, the extension will default to that repository

  5. Provide the app folder name

    Location of your application code. For example, '/' represents the root of your app, while '/app' represents a directory called 'app'.

  6. Provide the api folder name (optional)

    Location of your Azure Functions code. For example, '/api' represents a folder called 'api'. If you don't have an Azure Functions project yet, don't worry! This is optional so just leave this blank.

  7. Provide the build artifact folder name

    The path of your build output relative to your apps location. For example, setting a value of 'build' when your app location is set to '/app' will cause the content at '/app/build' to be served.

See recommended settings for popular frameworks and libraries

Updating your static web app

Commit and push your changes to the GitHub repository that your static web app is configured to. It will then use GitHub Actions to update your app.

If you create a pull request through GitHub, GitHub Actions will create a staging environment with your new changes live. Your Production environment and staging environments are all listed within your Static Web App as well as application settings.

IMPORTANT: The application settings only apply to the backend API of an Azure Static Web App.

Static Web App Environments

Create a HTTP Function for your static web app

You can add a serverless API to your static web app by creating a HTTP Functions project.

  1. Open your static web app project in your Visual Studio Code workspace

  2. Select the button to create a new HTTP Function

    Create HTTP Function

  3. Provide a HTTP Function name that is unique to your API

  4. If this is your first HTTP Function, select a language for your API

Select Language

Contributing

There are a couple of ways you can contribute to this repo:

  • Ideas, feature requests and bugs: We are open to all ideas and we want to get rid of bugs! Use the Issues section to either report a new issue, provide your ideas or contribute to existing threads.
  • Documentation: Found a typo or strangely worded sentences? Submit a PR!
  • Code: Contribute bug fixes, features or design changes:
    • Clone the repository locally and open in VS Code.
    • Run "Extensions: Show Recommended Extensions" from the command palette and install all extensions listed under "Workspace Recommendations"
    • Open the terminal (press Ctrl + `) and run npm install.
    • To build, press F1 and type in Tasks: Run Build Task.
    • Debug: press F5 to start debugging the extension.

Legal

Before we can accept your pull request you will need to sign a Contribution License Agreement. All you need to do is to submit a pull request, then the PR will get appropriately labelled (e.g. cla-required, cla-norequired, cla-signed, cla-already-signed). If you already signed the agreement we will continue with reviewing the PR, otherwise system will tell you how you can sign the CLA. Once you sign the CLA all future PR's will be labeled as cla-signed.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

License

MIT

vscode-azurestaticwebapps's People

Contributors

alexweininger avatar bwateratmsft avatar dependabot[bot] avatar ejizba avatar github-actions[bot] avatar microfish91 avatar nturinski avatar taizod1024 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-azurestaticwebapps's Issues

Fix command palette for app setting commands

Repro Steps:

  1. Run a command like "Add setting" from the command palette

Two problems:

  1. At the environment quick pick, it has "undefined":
    Screen Shot 2020-05-15 at 10 21 34 AM
  2. At the next quick pick, it should automatically select "Application Settings", but it's not
    Screen Shot 2020-05-15 at 10 21 39 AM

Hide step count in wizard [Discussion]

Depending on a few things, like when you create a new repo or we detect your remote via your git settings, it makes the number of steps in the wizard wonky. Should we just hide this?

Show the production environment under Environments

Today I'm filtering the production environment out because I felt like it was the same as the app itself. There are some considerations though if we show production under Environments.

The decision to separate the two was because we were following the design pattern of Deployment Slots.

Here is the current UI:
image

  1. Where do we put the App Settings/Configurations Node? Right now I have it as one of the children under the SWA node itself, but it makes more sense to me to remove it from the SWA node and put it in the env node.
  2. Including the hostname makes less sense. We have "Browse Site" so I don't really think we need to display it to users anyway. I think we should display the GitHub org/repo in the SWA Node.

Some input from Mitch:

yup you can think of the SWA app as the representation of some application, but the production environment might be just one of many environments in the app

I think showing it would make sense because even if users don't understand the environment concept, I think they will still be confused about why they aren't shown here but if they right click and go to portal they see one

[Suggestion]Add the logs in "Azure Static Web App(Preview) " for "creating endpoint".

OS: Windows/Mac
Build Version: 20200514.4

Repro Steps:

  1. Create a JavaScript project with HttpTrigger function using Functions extension
  2. Open this project in VS Code
  3. Click the 'Create Endpoint…' button on the ribbon-->JavaScript
  4. Check the result

Actual:
There is no logs in "Azure Static Web App(Preview) " for "creating endpoint"
image

Suggestion:

  1. Add the logs in "Azure Static Web App(Preview) " for "creating endpoint"
  2. The prompt message that pops up changes to "Finished creating endpoint..." is better.

App Settings support

This needs to support the following from Functions

  • CRUD app settings in the explorer
  • Support multiple environments (similar to the slots experience)
  • Upload local.settings.json 💪

I really dislike the "Create an API endpoint" quickpick

It's just so ugly and unintuitive to me...
Screen Shot 2020-05-07 at 6 20 25 PM

Can we just always create one? I feel like we're already pretty opinionated (aka it has to be an http trigger), so why not pick a sensible default for this, too. I can't think of why I'd want an API without an endpoint

NOTE: This is all moot if we do #38

An error occurs when authorizing GitHub for VSCode

OS: Win10 & Mac
Build Version: 20200514.4

Repro Steps:

  1. Install the Static Web Apps Extension from VSIX.
  2. Click "Create Static Web App...".
  3. Pop up a prompt as the below. --> Click "Allow" -->Open the GitHub page in browser.
    image
  4. Authorize GitHub for VSCode -->Continue --> Confirm Password
  5. Check the result.

Expect:
Authorize successfully.

Actual:
An error occurs.
image

More Info:

  1. It's successful to authorize GitHub for VSCode at second time.
    image

  2. Back to VS Code, an error dialog pops up.
    image

[Discussion] Reduce number of prompts for basic create

We've discussed this offline, but I didn't see an issue for it. 8 feels like a lot of prompts for basic create. We discussed various ideas like using the GitHub remote from their local project or automatically defaulting some of the folders, but each of those could be problematic. Will need further thought

EDIT: Seems like the GitHub org is defaulted to local project, but we're still at 7 steps

Direct user to marketplace if functions extension is not installed

Does this occur consistently?
Repro steps:

  1. Try to create an api without the functions extension installed

Ideally it would follow the same pattern as App Service connections with Cosmos DB where it directs users to the marketplace if it's not installed

Action: staticWebApps.createNewApi
Error type: Error
Error Message: command 'azureFunctions.createNewProject' not found

Version: 0.1.0-alpha
OS: darwin
OS Release: 19.4.0
Product: Visual Studio Code
Product Version: 1.45.0
Language: en

Call Stack
e._tryExecuteCommand workbench.desktop.main.js:3681:135
file:/workbench.desktop.main.js:3681:16
processTicksAndRejections task_queues.js:85:5

The validation error is unclear when inputting a duplicate endpoint name

OS: Windows
Build Version: 20200514.4

Repro Steps:

  1. Open a function project in VS Code.
  2. Create an endpoint with name 'endpoint1'.
  3. Create an endpoint->type a duplicate name 'endpoint1'.
  4. Check the validation error.

Expect:
The validation error is clear-"The endpoint name is already exists", like the static web app.
image

Actual:
The validation error is unclear.
image

Add VS Code settings to remember api/app/build folders

I see this helping in two scenarios:

  1. I create multiple static web apps from the same project. We should only need to prompt the first time since the project structure probably doesn't change
  2. I clone a static web app project from somewhere else. If the VS Code settings are in the repo already, we wouldn't need to prompt. This could be especially helpful for sample projects to avoid user error around selecting the wrong folder

That being said, I'm not sure I want this until we support "Advanced" create so that it's obvious how to bypass the settings if I want to create a static web app for something other than the currently opened workspace.

Related to #19

Ignore git remote if it is an ssh url (for now)

Repro steps:

  1. Set the GitHub remote of your local project using an ssh url instead of an https url
  2. Create a new static web app

Expected: It ignores the GitHub remote (I don't think it's actually worth trying to use the ssh url)

Actual: It errors out:

Action: staticWebApps.createStaticWebApp
Error type: 404
Error Message: Not Found

Version: 0.1.0-alpha
OS: darwin
OS Release: 19.4.0
Product: Visual Studio Code
Product Version: 1.45.0
Language: en

Call Stack
new StatusCodeError request-promise-core/errors.js:32:15
Request.<anonymous> request-promise-core/plumbing.js:104:33
Request.RP$callback [as _callback] request-promise-core/plumbing.js:46:31
Request.callback request/request.js:185:22
Request.emit events.js:203:13
Request.<anonymous> request/request.js:1154:10
Request.emit events.js:203:13
IncomingMessage.<anonymous> request/request.js:1076:12
Object.onceWrapper events.js:291:20
IncomingMessage.emit events.js:208:15
endReadableNT _stream_readable.js:1168:12
processTicksAndRejections task_queues.js:77:11

New repo isn't connected when creating static web app

Repro Steps:

  1. Create a new static web app
  2. When prompted for repository, create a new one
  3. After it's done, right click -> "View Properties"

I see repositoryUrl and branch as null

"properties": {
        "defaultHostname": "calm-sea-079a40c1e.azurestaticapps.net",
        "repositoryUrl": null,
        "branch": null,
        "customDomains": [],
        "privateEndpointConnections": []
    },

Merge "Create API' and "Create Endpoint" into one action

The theory is that users care more about adding endpoints, not adding some sort of project to contain endpoints. Under the covers, we would have to detect if they have a project already and create one if they didn't. I've always thought about doing this for Functions, but I feel like it's too late to break existing patterns. Since static web apps is already simplifying the functions experience, this might be a good opportunity to simplify it even further.

Fix npm audit issues

found 17 low severity vulnerabilities in 23643 scanned packages
run npm audit fix to fix 1 of them.
1 vulnerability requires semver-major dependency updates.
15 vulnerabilities require manual review. See the full report for details.

There's one or two persistent ones that we still have in other repos, but most of these you should be able to fix if you follow microsoft/vscode-azureresourcegroups#8

Context menu action to "Show Actions"

After creating a web app, we have a button to "Show Actions" which takes them to their repo's GitHub Action page. We should have a context menu item for that as well.

Mark product as preview

For now, the product name needs to say "preview" so..

Azure App Service Static Apps (Preview) in the explorer.

Add more description for app/api/publish directories

It just says "Enter the app directory", etc. without saying what those are. I feel like it should have at least a few words describing each.

You actually have more info for one prompt, but only if I delete the default text:
Screen Shot 2020-05-06 at 6 26 17 PM

Context menu action to `git clone`

I think having a context menu action to git clone the repo that is connected to that web app and then open that project in VS Code.

I figure the flow could be similar to deploying, where you select a folder, but that's where we'd git clone the project to.

Add a log 'Uploaded settings to...' in output

OS: Windows
Build Version: 20200514.4

Repro Steps:

  1. Right click the Application Settings node for a environment->Upload Local Settings...
  2. Check the output log.

Expect:
There is a log 'Uploaded settings to...'.

Actual:
There isn't a log 'Uploaded settings to...'.
image

Can't select a .json file when uploading local settings

OS: Windows
Build Version: 20200514.4

Repro Steps:

  1. Right click the Application Settings node for a environment->Upload Local Settings...
  2. Check the prompt dialog.

Expect:
There is file type in the dialog and we select the .json file successfully.

Actual:
Can't select a .json file when uploading local settings, there is no file type.
image

Poll on deleting Static Web Apps

When we start a delete, it returns a 202. We should poll the endpoint to make sure it was successfully deleted by confirming it returns 204.

That's not a resource group...

Repro steps:

  1. Run a command like "Delete" from the command palette

The quick pick says resource group for a static web app:
Screen Shot 2020-05-15 at 10 19 31 AM

1

Fail to create new API for function project

OS: Windows
Build Version: 0.1.0-alpha

Repro Steps:

  1. Create a JavaScript project with HttpTrigger function using Functions extension.
  2. Open this project in VS Code.
  3. F1->Azure Static Web Apps: Create New API...->JavaScript->Yes to create an API endpoint (Provide an endpoint name).

Expect:
Succeed to create the new API for the function project.

Actual:
An error "Could not find template with language "JavaScript", version "~3", and id "HttpTrigger"." occurs.
image
If skip for create an API endpoint, the error shows as below.
image

Improve auto-detect of org from local project

Repro steps:

  1. Open a local project that has a git remote
  2. Create a static web app
  3. Enter a name

A few issues:

  1. Once you get to the branch step, the back button doesn't work Fixed in #24
  2. It's not obvious what it's using when it defaults the org/repo. What if we change the prompt to say Choose branch for repository "EricJizbaMSFT/ReactSite"
    Screen Shot 2020-05-06 at 6 44 59 PM
  3. The step count seems off. I feel like it should show "7" from the start, but it only goes from "8" to "7" after I enter the name

A confusing dialog pops up when adding a new endpoint for a function project

OS: Windows
Build Version: 0.1.0-alpha

Repro Steps:

  1. Create a JavaScript project with HttpTrigger function using Functions extension.
  2. Open this project in VS Code.
  3. Click the 'Create Endpoint...' button and provide an endpoint name.

Expect:
Succeed to create the endpoint for the function project.

Actual:
A confusing dialog "The selected folder is not a function project. Create new project?" pops up.
image

Handle restricted app settings

Below startswith patterns are restricted app settings in static web app functions

^APPINSIGHTS_,^APPSETTING_,^AZUREBLOBSTORAGE_,^AZUREFILESSTORAGE_,^AZURE_FUNCTION_,^CONTAINER_,^DIAGNOSTICS_,^DOCKER_,^FUNCTIONS_,^IDENTITY_,^MACHINEKEY_,^MAINSITE_,^MSDEPLOY_,^SCMSITE_,^SCM_,^WEBSITES_,^WEBSITE_,^WEBSOCKET_,^AzureWeb

The flow gives impression that they could be added
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.