Skip to content

Commit

Permalink
feat: add first commit for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
kyswtn committed Aug 19, 2024
0 parents commit d4a786e
Show file tree
Hide file tree
Showing 122 changed files with 7,258 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
13 changes: 13 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"website"
]
}
5 changes: 5 additions & 0 deletions .changeset/ninety-crabs-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vscode-vercel": major
---

Overhaul and rewrite the entire thing as v2. The extension name would be the only thing left untouched.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if has nix; then
use flake
fi
Binary file added .github/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/demo.mp4
Binary file not shown.
Binary file added .github/showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/vscode-vercel-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.0.33

- name: Install dependencies
run: bun install --cwd=extension --production --frozen-lockfile

- name: Build
run: |
bun run --cwd=extension build
bun run --cwd=extension package
env:
INTEGRATION_ID: ${{ secrets.INTEGRATION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REDIRECT_URI: ${{ secrets.REDIRECT_URI }}

- name: Create release pull request or publish
uses: changesets/action@v1
with:
publish: bun run --cwd=extension publish
commit: 'chore: release'
title: 'A New Release'
setupGitUser: true
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
/.direnv
/node_modules
/result

# for preview during development
/example

# for demo
/acme-store
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"astro-build.astro-vscode",
"biomejs.biome",
"mkhl.direnv",
"oven.bun-vscode"
]
}
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/extension"
],
"outFiles": [
"${workspaceFolder}/extension/dist/**/*.js"
],
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack://vscode-vercel/./src": "${workspaceFolder}/extension/src",
"webpack://vscode-vercel/../node_modules": "${workspaceFolder}/node_modules"
}
},
{
"name": "Run Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
"--extensionTestsPath=${workspaceFolder}/extension/test/suite"
],
"outFiles": [
"${workspaceFolder}/extension/dist/extension.test.js"
],
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack://vscode-vercel/./src": "${workspaceFolder}/extension/src",
"webpack://vscode-vercel/../node_modules": "${workspaceFolder}/node_modules"
}
}
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "always"
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
}
16 changes: 16 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The project uses [Nix](https://nixos.org). In case you don't want to it, install the dependencies and language servers listed in `flake.nix` manually. The followings are essential.

- [biome](https://biomejs.dev) — linter & formatter
- [bun](https://bun.sh) — script runner & package manager

## How to run the extension

1. Install all dependencies with `bun i`.
2. `cd` into `extension/` and run `build:extension` or `watch:extension` script
3. `Run Extension` from debug panel or F5 to run the extension.

## How to setup Nix for this project

1. [Install nix](https://nix.dev/manual/nix/2.18/installation/installation). Enable [`flakes`](https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake) and [`nix-command`](https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix) features.
3. `nix develop` will bring you into [`nix-shell`](https://nix.dev/manual/nix/2.18/command-ref/nix-shell) with all the dependencies installed on the first time.
4. Install [direnv](https://direnv.net) and `direnv allow` in case you don't want to run `nix develop` everytime.
1 change: 1 addition & 0 deletions LICENSE
1 change: 1 addition & 0 deletions README.md
76 changes: 76 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"formatter": {
"ignore": ["*.astro"],
"lineEnding": "lf",
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80
},
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
},
"javascript": {
"parser": {
// ESNext decorators are not useful for us. We need TypeScript's experimental parameters to
// get design:paramtypes for Dependency Injection.
"unsafeParameterDecoratorsEnabled": true
},
"formatter": {
"semicolons": "asNeeded",
"bracketSpacing": false,
"quoteStyle": "single",
// This reduces the amount of unnecessary line diffs to review.
"trailingComma": "all"
}
},
"json": {
"formatter": {
"trailingCommas": "none"
},
"parser": {
"allowComments": true
}
},
"overrides": [
{
"include": ["./extension/src/*.ts"],
"formatter": {
// Convention is to keep comments under the line width of 100, to make them readable as they
// usually come in paragraphs (like this one). Code can go up to 120 because VSCode's APIs
// can have really verbose/lengthy names.
"lineWidth": 120
}
}
],
"linter": {
"ignore": [".vscode-test", "node_modules", "dist", "*.astro"],
"rules": {
"recommended": true,
"correctness": {
"noUnusedImports": "error"
},
"style": {
// Non-null assertions are allowed, but they should come with SAFETY explanations on why
// these assertions won't cause an exception.
"noNonNullAssertion": "off",
// Reflect API uses class constructors for Dependency Injection, they look like types.
"useImportType": "off"
},
"complexity": {
// No unnecessary square bracket accesses.
"useLiteralKeys": "off"
},
"suspicious": {
// Contrary to biome's reason, const enums are only confusing in a library setting. This is
// not a library.
"noConstEnum": "off",
// This is a feature of JS, not a bug.
"noAssignInExpressions": "off"
}
}
}
}
Binary file added bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions extension/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INTEGRATION_ID=
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
5 changes: 5 additions & 0 deletions extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.vscode-test
/dist
/.env
*.bak
*.vsix
8 changes: 8 additions & 0 deletions extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.vscode-test/
browser/
resources/custom-icons
scripts/
src/
test/
*.bak
*.vsix
21 changes: 21 additions & 0 deletions extension/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Kyaw

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.
64 changes: 64 additions & 0 deletions extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# VSCode Vercel

Enhance your Vercel deployment experience within Visual Studio Code. Monitor deployments, manage projects, and inspect deployment artifacts, all within your code editor.

<img align="center" src="https://raw.githubusercontent.com/kyswtn/vscode-vercel/main/.github/showcase.png" />

This extension complements, rather than replaces, the Vercel Dashboard and the [Official Vercel CLI](https://vercel.com/docs/cli). Its purpose is not to replicate all the website's features but to offer actionable tools that developers can use within VSCode, reducing context switching and streamlining the Vercel development experience.

The extension integrates seamlessly with the Vercel CLI. Deployments are displayed based on available projects within a folder or workspace. Projects must be [linked](#manage-projects) first to be managed.

## Features

- [**Monitor Deployments**](#monitor-deployments) &mdash; Stay on top of deployments while coding through the deployments sidebar.
- [**Manage Projects**](#manage-projects) &mdash; Link new projects, pull environment variables, even in large monorepos.
- [**Inspect Deployments**](#inspect-deployments) &mdash; Access deployment build logs and outputs, just like regular files.
- [**Seamless Authentication**](#seamless-authentication) &mdash; Multiple authentication options including OAuth, access tokens, or Vercel CLI.
- [**And more...**](#planned) &mdash; At-a-glance deployment info on status bar, `vercel.json` file validations, and more.

All these features are designed to work in all VSCode based editors such as VSCode Insiders, VSCodium, vscode.dev, and GitHub Codespaces.

### Monitor Deployments

Effortlessly monitor all your deployments through the deployment sidebar. This feature provides an organized list of deployments, displaying crucial information like status, timestamps, and URLs. Easily filter deployments to focus on what’s important, ensuring you have a clear view of your deployment history while coding.

> [!NOTE]
> **Coming soon**: Real-time updates will ensure you never miss new deployments by your teammates.
### Manage Projects

The extension works seamlessly with the Vercel CLI. Easily link new projects and pull environment variables into a local `.env.local` file, all within the editor, without needing to use the CLI. Getting a Vercel project up and running has never been easier. These features are designed to work seamlessly, even in monorepos containing multiple Vercel projects.

💡 Right-click on a folder and select "Link to Vercel Project" to link it to a Vercel project. Or link the root directory to a project with the "Link Workspace to a Project" command.

### Inspect Deployments

Inspect deployment build logs and artifacts just like regular files. Build outputs can be browsed in a file tree within deployment details sidebar. All your favorite keybindings, editor features, and extensions are available for these files, including file icon themes, syntax highlighting, complex search queries, and VIM keybindings.

This ensures that troubleshooting deployments is just a click away, helping you maintain a smooth and efficient development cycle.

### Seamless Authentication

We support multiple methods for authenticating the extension. Vercel OAuth integration is recommended for its ease of use, but manually configured access tokens for more complex permissions are also accepted. If you've already signed in using the Vercel CLI, the extension can use existing access tokens, so you don't have to sign in again.

> [!NOTE]
> Certain features will be unavailable based on the authentication method chosen. For example, linking to projects from other teams is only possible if you authenticate using a custom access token or the Vercel CLI.
If you're a VSCode extension developer, you can also use the extension as a dependency to enable Vercel authentication within your extension.

### Planned

We have many more features planned, _potentially_ including

- **Real-time Updates** &mdash; Deployments sidebar, status bar item, logs, and file trees get updated in real-time with detailed progress as new deployments queue in.
- **More Deployment Actions** &mdash; Make it easier to perform actionable tasks such as re-deploying the latest deployment, promoting a deployment to production, rolling back to a previous deployment etc.
- **Deployment Checks** &mdash; View real-time check statuses of a deployment and it's details.
- **Better Git Support** &mdash; Ensure displayed deployments are aligned with the branch you're working on.
- **Notifications** &mdash; Set conditions to get notified when met, e.g. failed deployments within `main` branch.
- **Vercel CLI Command Palette** &mdash; A command palette to run Vercel CLI commands directly from within VSCode, without needing to switch to a shell.

## Demo

Here's a quick rapid-fire demo GIF of some of the features of this extension.

<img align="center" src="https://raw.githubusercontent.com/kyswtn/vscode-vercel/main/.github/demo.gif" />
9 changes: 9 additions & 0 deletions extension/browser/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-check
/** @type {typeof import('../src/utils/node')} */
const exports = {
// @ts-ignore
crypto: globalThis.crypto,
platform: () => 'linux',
homedir: () => '/',
}
module.exports = exports
Loading

0 comments on commit d4a786e

Please sign in to comment.