Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tjx666 authored Aug 28, 2024
0 parents commit 3b735dd
Show file tree
Hide file tree
Showing 28 changed files with 8,130 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

permissions:
contents: write

on:
push:
branches:
- main

jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
outputs:
GIT_TAG: ${{ steps.set-tag.outputs.GIT_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Get the date on Ubuntu/MacOS
id: date_unix
if: runner.os != 'Windows'
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- name: Get the date on Windows
id: date_windows
if: runner.os == 'Windows'
run: echo "DATE=$(Get-Date -Format 'yyyyMMdd')" >> $GITHUB_OUTPUT

- name: Cache .vscode-test
uses: actions/cache@v4
env:
# we use date as part of key because the vscode insiders updated daily
CACHE_PREFIX: ${{ runner.os }}-vscode-test-${{ steps.date_unix.outputs.DATE || steps.date_windows.outputs.DATE }}
with:
path: .vscode-test
key: ${{ env.CACHE_PREFIX }}-${{ hashFiles('test/runTests.ts') }}
restore-keys: ${{ env.CACHE_PREFIX }}

- run: xvfb-run -a pnpm test
if: runner.os == 'Linux'
- run: pnpm test
if: runner.os != 'Linux'

- name: Set GIT_TAG
id: set-tag
if: runner.os == 'Linux'
run: |
git fetch --tags origin
GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$GIT_TAG" ] && [ "$(git rev-list -n 1 $GIT_TAG 2>/dev/null || echo "")" = "$(git rev-parse HEAD)" ]; then
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT
else
echo "GIT_TAG=''" >> $GITHUB_OUTPUT
fi
publish:
needs: test
if: startsWith(needs.test.outputs.GIT_TAG, 'v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Publish to Visual Studio Marketplace
run: pnpm run publish:vs-marketplace
env:
VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }}

- name: Publish to Open VSX Registry
run: pnpm run publish:open-vsx -p ${{ secrets.OPEN_VSX_TOKEN }}

- name: Github Release
run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
out
node_modules
.vscode-test/
*.vsix

# esbuild-visualizer
meta.json
stats.html
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry="https://registry.npmmirror.com/"
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.17.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-workspace
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"connor4312.esbuild-problem-matchers",
"github.vscode-github-actions",
"YuTengjing.vscode-archive",
"YuTengjing.package-manager-enhancer"
]
}
54 changes: 54 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Dev",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceFolder}/test-workspace"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/resources/app/out/vs/**",
"**/.vscode-insiders/extensions/",
"**/.vscode/extensions/"
],
"sourceMaps": true,
"env": {
"VSCODE_DEBUG_MODE": "true"
},
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Test",
"type": "extensionHost",
"request": "launch",
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**",
"**/resources/app/out/vs/**",
"**/.vscode-insiders/extensions/",
"**/.vscode/extensions/"
],
"sourceMaps": true,
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/"
],
"env": {
"VSCODE_DEBUG_MODE": "true"
},
"preLaunchTask": "compile:test"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.validate": ["typescript", "json", "jsonc", "markdown"]
}
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "esbuild:watch",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "compile:test",
"type": "npm",
"script": "compile:test",
"problemMatcher": "$tsc"
}
]
}
29 changes: 29 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# source
src
scripts
assets
!assets/logo.png

# output
out
!out/src/extension.js
*.map
*.vsix

# test
test
test-workspace
.vscode-test

# configs
.github
.vscode
tsconfig.*
.eslintrc*
.prettier*
.gitignore
pnpm-lock.yaml

# esbuild-visualizer
meta.json
stats.html
Loading

0 comments on commit 3b735dd

Please sign in to comment.