Skip to content

Commit

Permalink
Merge branch 'main' into component/code-block
Browse files Browse the repository at this point in the history
  • Loading branch information
shleewhite committed Sep 6, 2022
2 parents 214bc65 + e9312c1 commit c4d5e48
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 27 deletions.
21 changes: 21 additions & 0 deletions apps/vs-code-intellisense/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Twilio Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 1 addition & 5 deletions apps/vs-code-intellisense/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<h1 align="center">
<img height="320px" src="https://raw.githubusercontent.com/twilio-labs/paste/main/apps/vs-code-intellisense/assets/favicon.png" alt="" />
<br/>
Twilio Paste Intellisense
</h1>
# Twilio Paste Intellisense

Twilio Paste Intellisense extends the development experience of Twilio Paste by giving Visual Studio Code users additional functionality such as hover.

Expand Down
Binary file added apps/vs-code-intellisense/assets/get-user-id.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions apps/vs-code-intellisense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
"displayName": "Twilio Paste Intellisense",
"description": "Intelligent Twilio Paste Design tooling for VS Code",
"version": "0.0.1",
"author": "Twilio Inc.",
"private": true,
"license": "MIT",
"publisher": "Paste",
"publisher": "TwilioPaste",
"author": "Twilio Inc.",
"contributors": [
{
"name": "Gapur Kassym",
"email": "gapur.kassym@gmail.com",
"url": "https://gkassym.netlify.app"
}
],
"repository": {
"type": "git",
"url": "https://github.com/twilio-labs/paste.git",
"directory": "apps/vs-code-intellisense"
},
"keywords": [
"twilio",
"twilio-paste",
Expand Down
50 changes: 30 additions & 20 deletions apps/vs-code-intellisense/publishing-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

We will publish the vscode extension to the [VS Code Extension Marketplace](https://marketplace.visualstudio.com/vscode) so others can find, download, and use your extension.

First, We need to install the [vsce](https://github.com/microsoft/vscode-vsce) command-line tool for packaging and publishing VS Code extensions. Let’s install it:
First, We need to install the [vsce](https://github.com/microsoft/vscode-vsce) command-line tool for packaging and publishing VS Code extensions. Let’s install it:

```sh
npm install -g vsce
```

Note: until we write nicer scripts, you may need to sudo this

### Security Concerns

`vsce` will not publish extensions that contain user-provided SVG images.

The publishing tool checks the following constraints:

- The icon provided in package.json may not be an SVG.
- The badges provided in the package.json may not be SVGs unless they are from [trusted badge providers](https://code.visualstudio.com/api/references/extension-manifest#approved-badges).
- Image URLs in README.md and CHANGELOG.md need to resolve to https URLs.
Expand All @@ -22,44 +25,51 @@ The publishing tool checks the following constraints:

Visual Studio Code uses `Azure DevOps` for its Marketplace services. This means that authentication, hosting, and management of extensions are provided through Azure DevOps. Therefore we need to create a new account in [Azure DevOps](https://azure.microsoft.com/en-gb/services/devops/).

`vsce` can only publish extensions using Personal Access Tokens. First we need to [create your own organization](https://docs.microsoft.com/en-gb/azure/devops/organizations/accounts/create-organization?view=azure-devops) in Azure DevOps. I will create like `twilio-labs`.
`vsce` can only publish extensions using Personal Access Tokens (PAT). Since PATs expire within 3 months, we likely need to create these from time to time. Make sure to join the existing [paste-plugins organization](https://dev.azure.com/paste-plugins/) by asking for an email invite from the team in Slack.

Next, from your organization's home page (for example: https://dev.azure.com/twilio-labs), open the User settings dropdown menu next to your profile image and select Personal access tokens:
Next, create a personal access [token for this organization](https://dev.azure.com/paste-plugins/_usersSettings/tokens):

<img src="https://raw.githubusercontent.com/twilio-labs/paste/docs/readme-publishing/apps/vs-code-intellisense/assets/organization-page.png" alt="Personal Access Token" />
- Fill in a Token Name, like `paste-vs-code-plugin`
- Set Organization to `All accessible organizations`
- Optionally extend its expiration date to `90 days`
- Set Scopes to `Custom defined`
- Click `Show all scopes` at the bottom of the panel
- Choose the `Marketplace > Manage` scope (it will auto select Read and Publish for you)

On the `Personal Access Tokens` page, select `New Token` to create a new Personal Access Token and set the following details:
- Access Token Name
- Set Organization to All accessible organizations
- Optionally extend its expiration date
- Set Scopes to `Custom defined` and choose the `Marketplace > Manage` scope
![Create a Personal Access Token](https://github.com/twilio-labs/paste/blob/main/apps/vs-code-intellisense/assets/create-personal-access-token.png)

<img src="https://raw.githubusercontent.com/twilio-labs/paste/docs/readme-publishing/apps/vs-code-intellisense/assets/create-personal-access-token.png" alt="Create Personal Access Token" />
Select `Create` and you'll be presented with your newly created Personal Access Token. **Copy it and save it somewhere safe**, you'll need it to create a publisher.

Select `Create` and you'll be presented with your newly created Personal Access Token. Copy it, you'll need it to create a publisher.

### Create a publisher
### Marketplace Publisher Account

A publisher is an identity who can publish extensions to the VS Code Marketplace. Each extension must include the publisher's name in its package.json [file](https://code.visualstudio.com/api/references/extension-manifest).

Now We need to create a new publisher through the Visual Studio Marketplace publisher [management page](https://marketplace.visualstudio.com/manage).
Join the [TwilioPaste](https://marketplace.visualstudio.com/manage/publishers/twiliopaste) Publisher via user ID invite. Email invites are broken, so you need to get your User ID by visiting the [marketplace homepage](https://marketplace.visualstudio.com/) and hovering over your username on the top right. Give the User ID to a colleague in Slack to add you to the Publisher account.

![Grab your User ID](https://github.com/twilio-labs/paste/blob/main/apps/vs-code-intellisense/assets/get-user-id.png)

#### Creating a new Publisher

To create a new publisher, go to the Visual Studio Marketplace publisher [management page](https://marketplace.visualstudio.com/manage).

![Create a Publisher](https://github.com/twilio-labs/paste/blob/main/apps/vs-code-intellisense/assets/create-a-publisher.png)

<img src="https://raw.githubusercontent.com/twilio-labs/paste/docs/readme-publishing/apps/vs-code-intellisense/assets/create-a-publisher.png" alt="Create a publisher" />
### Publishing

Last, we can test our publisher's personal access token by the following command:

```sh
vsce login <publisher name>
```

<img src="https://raw.githubusercontent.com/twilio-labs/paste/docs/readme-publishing/apps/vs-code-intellisense/assets/vsce-login-done.png" alt="vsce login" />
![vsce login](https://github.com/twilio-labs/paste/blob/main/apps/vs-code-intellisense/assets/vsce-login-done.png)

### Publish an extension

Now, we can publish an extension using `vsce` with the `publish` command:

```sh
vsce publish
vsce publish --no-yarn
```

We can auto-increment an extension's version number when we publish by specifying the [SemVer](https://semver.org) compatible number to increment: `major`, `minor`, or `patch`.
Expand All @@ -80,6 +90,6 @@ vsce publish 2.0.1

## Go further

* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
- Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
- [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
- Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).

0 comments on commit c4d5e48

Please sign in to comment.