This commit is contained in:
João Moreno 2021-07-23 11:23:29 +02:00
Родитель 7db1ae9b02
Коммит 799d93f3b1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 896B853774D1A575
8 изменённых файлов: 227 добавлений и 8 удалений

83
.github/workflows/ci.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,83 @@
name: CI
on:
push:
branches:
- "**"
tags:
- "v*"
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: ia32
npm_config_arch: ia32
- os: windows-latest
platform: win32
arch: arm64
npm_config_arch: arm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
- os: ubuntu-latest
platform: linux
arch: armhf
npm_config_arch: arm
- os: ubuntu-latest
platform: alpine
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_config_arch }}
- shell: pwsh
run: |
echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
echo "version=$((Get-Content .\package.json | ConvertFrom-Json).version)" >> $env:GITHUB_ENV
- run: npx vsce package -o vscode-platform-specific-sample-${{ env.target }}-${{ env.version }}.vsix --target ${{ env.target }}
- uses: actions/upload-artifact@v2
with:
name: vscode-platform-specific-sample-${{ env.target }}
path: "*.vsix"
publish:
runs-on: ubuntu-latest
needs: build
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
- run: |
npm i -g vsce
for vsix in $(find . -iname *.vsix); do
target=$(echo $vsix | cut -d'-' -f 5,6 | cut -d'/' -f 1)
npx vsce publish --packagePath $vsix -t $target
done
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}

2
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
node_modules
*.vsix

17
.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
// A launch configuration that launches the extension 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": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}

11
.vscodeignore Normal file
Просмотреть файл

@ -0,0 +1,11 @@
.vscode/**
.vscode-test/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/jsconfig.json
**/*.map
**/.eslintrc.json
.github
node_modules
!node_modules/vscode-ripgrep

Просмотреть файл

@ -1,14 +1,10 @@
# Project
# vscode-platform-specific-sample README
> This repo has been populated by an initial template to help get you started. Please
> make sure to update the content to build a great experience for community-building.
[![CI](https://github.com/joaomoreno/vscode-platform-specific-sample/actions/workflows/ci.yml/badge.svg)](https://github.com/joaomoreno/vscode-platform-specific-sample/actions/workflows/ci.yml)
As the maintainer of this project, please make a few updates:
This is an example platform-specific VS Code extension. It exposes a single command `Get Ripgrep version`, which pops up a notification containing the version of the bundled [ripgrep](https://github.com/BurntSushi/ripgrep) executable. It bundles the ripgrep executable by depending on [vscode-ripgrep](https://github.com/microsoft/vscode-ripgrep), which contains the platform-specific ripgrep executable.
- Improving this README.MD file to provide a great experience
- Updating SUPPORT.MD with content about this project's support experience
- Understanding the security reporting process in SECURITY.MD
- Remove this section from the README
The [CI script](https://github.com/joaomoreno/vscode-platform-specific-sample/actions/workflows/ci.yml) makes sure VSIXs for all supported VS Code targets are built in an automated fashion. [Once built](https://github.com/joaomoreno/vscode-platform-specific-sample/actions/runs/1059108370), each VSIX should be available as a build artifact. Furthermore, if a tag (eg `v1.0.0`) is pushed to the repo, an additional build stage will collect all built VSIX files and publish them accordingly to the VS Marketplace using the new `--target` [vsce](https://github.com/microsoft/vscode-vsce) flag.
## Contributing

17
extension.js Normal file
Просмотреть файл

@ -0,0 +1,17 @@
const vscode = require('vscode');
const { rgPath } = require('vscode-ripgrep');
const cp = require('child_process');
const { promisify } = require('util');
const execFile = promisify(cp.execFile);
async function run() {
const { stdout } = await execFile(rgPath, ['--version'], { encoding: 'utf8' });
vscode.window.showInformationMessage(`Ripgrep version: ${stdout}`);
}
function activate(context) {
let disposable = vscode.commands.registerCommand('vscode-platform-specific-sample.run', run);
context.subscriptions.push(disposable);
}
module.exports = { activate };

55
package-lock.json сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,55 @@
{
"name": "vscode-platform-specific-sample",
"version": "1.5.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/vscode": {
"version": "1.58.1",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.58.1.tgz",
"integrity": "sha512-sa76rDXiSif09he8KoaWWUQxsuBr2+uND0xn1GUbEODkuEjp2p7Rqd3t5qlvklfmAedLFdL7MdnsPa57uzwcOw==",
"dev": true
},
"agent-base": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g=="
},
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"requires": {
"ms": "2.1.2"
}
},
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
"requires": {
"agent-base": "5",
"debug": "4"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"vscode-ripgrep": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/vscode-ripgrep/-/vscode-ripgrep-1.12.0.tgz",
"integrity": "sha512-tn+bM7RbVElyuIGjIFyuSZZSuqodDjPNVQeHdo9w7EOIFEOuNtXuZ82s/Sy59lG/gJyMEkXjXjKunbUNNa5kOw==",
"requires": {
"https-proxy-agent": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
}
}
}

38
package.json Normal file
Просмотреть файл

@ -0,0 +1,38 @@
{
"name": "vscode-platform-specific-sample",
"displayName": "vscode-platform-specific-sample",
"description": "VS Code platform specific extension sample",
"publisher": "joaomoreno",
"repository": {
"type": "git",
"url": "https://github.com/joaomoreno/vscode-platform-specific-sample"
},
"version": "1.5.0",
"engines": {
"vscode": "^1.58.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:vscode-platform-specific-sample.run"
],
"main": "./extension.js",
"contributes": {
"commands": [
{
"command": "vscode-platform-specific-sample.run",
"title": "Get Ripgrep version"
}
]
},
"scripts": {
"lint": "eslint ."
},
"devDependencies": {
"@types/vscode": "^1.58.0"
},
"dependencies": {
"vscode-ripgrep": "^1.12.0"
}
}