Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul extension binary distribution #767

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,26 @@ jobs:
artifact-name: stylua-windows-x86_64
artifact-alias: stylua-win64
cargo-target: x86_64-pc-windows-msvc
code-target: [win32-x64]
- os: ubuntu-20.04
artifact-name: stylua-linux-x86_64
artifact-alias: stylua-linux
cargo-target: x86_64-unknown-linux-gnu
code-target: [linux-x64]
- os: ubuntu-20.04
artifact-name: stylua-linux-aarch64
cargo-target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
code-target: [linux-arm64]
- os: macos-latest
artifact-name: stylua-macos-x86_64
artifact-alias: stylua-macos
cargo-target: x86_64-apple-darwin
code-target: [darwin-x64]
- os: macos-latest
artifact-name: stylua-macos-aarch64
cargo-target: aarch64-apple-darwin
code-target: [darwin-arm64]

name: Build (${{ matrix.artifact-name }})
runs-on: ${{ matrix.os }}
Expand All @@ -72,13 +77,17 @@ jobs:
shell: bash
run: |
mkdir -p staging
mkdir -p stylua-vscode/bin

if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "output/${{ matrix.cargo-target }}/release/stylua.exe" staging/
cp "output/${{ matrix.cargo-target }}/release/stylua.exe" stylua-vscode/bin/stylua.exe
cd staging
7z a ../release.zip *
else
cp "output/${{ matrix.cargo-target }}/release/stylua" staging/
cp "output/${{ matrix.cargo-target }}/release/stylua" stylua-vscode/bin/stylua
chmod 777 stylua-vscode/bin/stylua
cd staging
zip ../release.zip *
fi
Expand Down Expand Up @@ -111,6 +120,23 @@ jobs:
asset_name: ${{ matrix.artifact-alias }}.zip
asset_content_type: application/zip

- name: Copy README, CHANGELOG, LICENSE into extension
shell: bash
run: |
rm -f stylua-vscode/README.md
cp README.md stylua-vscode/README.md
rm -f stylua-vscode/CHANGELOG.md
cp CHANGELOG.md stylua-vscode/CHANGELOG.md
rm -f stylua-vscode/LICENSE.md
cp LICENSE.md stylua-vscode/LICENSE

- run: npm ci
working-directory: stylua-vscode

- name: Publish Extension
working-directory: stylua-vscode
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --target ${{ join(matrix.code-target, ' ') }}

release_cargo:
name: Publish to cargo
runs-on: ubuntu-latest
Expand Down
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/stylua-vscode"
],
"outFiles": ["${workspaceFolder}/stylua-vscode/out/**/*.js"],
"preLaunchTask": "Build StyLua and Extension"
}
]
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "Build StyLua",
"type": "shell",
"command": "cargo build --release --features lua52,lua53,lua54,luau && cp target/release/stylua stylua-vscode/bin",
"windows": {
"command": "cargo build --release --features lua52,lua53,lua54,luau ; cp target/release/stylua.exe stylua-vscode/bin"
},
"group": "build",
"detail": "Build StyLua"
},
{
"type": "npm",
"script": "compile",
"group": "build",
"problemMatcher": [],
"label": "npm: compile",
"path": "stylua-vscode/"
},
{
"label": "Build StyLua and Extension",
"dependsOn": ["Build StyLua", "npm: compile"]
}
]
}
1 change: 1 addition & 0 deletions stylua-vscode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Thumbs.db
node_modules/
out/
.vscode-test/
bin/
49 changes: 37 additions & 12 deletions stylua-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 7 additions & 46 deletions stylua-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,67 +32,26 @@
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "stylua.reinstall",
"title": "Reinstall StyLua",
"category": "StyLua"
},
{
"command": "stylua.authenticate",
"title": "Authorize StyLua to use GitHub API",
"category": "StyLua"
}
],
"configuration": {
"title": "StyLua",
"properties": {
"stylua.releaseVersion": {
"type": "string",
"default": "latest",
"enum": [
"latest",
"v0.17",
"v0.16",
"v0.15",
"v0.14",
"v0.13",
"v0.12",
"v0.11",
"v0.10",
"v0.9",
"v0.8",
"v0.7",
"v0.6",
"v0.5"
],
"enumDescriptions": [
"The most recent version released. This will always keep you up to date."
],
"markdownDescription": "The release version to install. This is overridden by `#stylua.targetReleaseVersion#`."
},
"stylua.targetReleaseVersion": {
"type": "string",
"default": "",
"markdownDescription": "Target a specific release version tag such as `v0.9.1` or `v0.9`. This overrides the version set by `#stylua.releaseVersion#`."
},
"stylua.styluaPath": {
"type": [
"string",
"null"
],
"default": null,
"description": "Specifies the path of StyLua. If not specified, will automatically download one from the GitHub releases."
"markdownDescription": "Specifies the path of StyLua. If not specified, will either look in PATH (`#stylua.searchBinaryInPATH#`) or return a bundled version"
},
"stylua.disableVersionCheck": {
"stylua.searchBinaryInPATH": {
"type": "boolean",
"default": false,
"description": "Disable checking the version of stylua for newer versions. Useful if you do not want network requests"
"default": true,
"markdownDescription": "Search for the StyLua binary in the `PATH` environment variable, and use this if available. If disabled, falls back to a bundled binary"
},
"stylua.searchParentDirectories": {
"type": "boolean",
"default": false,
"description": "Search parent directories for a stylua configuration file if one is not directly available."
"markdownDescription": "Search parent directories for a stylua configuration file if one is not directly available."
}
}
}
Expand All @@ -114,6 +73,7 @@
"@types/node-fetch": "^2.5.8",
"@types/unzipper": "^0.10.3",
"@types/vscode": "^1.53.0",
"@types/which": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.15.2",
"@typescript-eslint/parser": "^4.15.2",
"eslint": "^7.20.0",
Expand All @@ -126,6 +86,7 @@
"dependencies": {
"ignore": "^5.1.8",
"node-fetch": "^2.6.1",
"node-which": "^1.0.0",
"unzipper": "^0.10.11"
}
}
Loading