diff --git a/.github/workflows/release-npm.yaml b/.github/workflows/release-npm.yaml new file mode 100644 index 0000000..5e5270e --- /dev/null +++ b/.github/workflows/release-npm.yaml @@ -0,0 +1,49 @@ +name: Release NPM + +on: + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Prepare repository + run: git fetch --unshallow --tags + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install Bun + uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Install wasm-pack + uses: jetli/wasm-pack-action@0d096b08b4e5a7de8c28de67e11e945404e9eefa + with: + version: 'latest' + + - name: Install dependencies + run: bun install + + - name: Build Language Server + run: bun run build + + - name: Package Language Server + run: bun run pack:server + + - name: Publish Language Server + run: bun run publish:server + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_LSP_SERVER_TOKEN }} diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index b452b6b..54d9300 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -51,4 +51,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.VSIX_DISPATCH_TOKEN }} - + - name: Trigger NPM Publish Release + if: ${{ steps.release.outputs.release_created }} + run: gh workflow run release-npm.yaml + env: + GITHUB_TOKEN: ${{ secrets.NPM_DISPATCH_TOKEN }} + diff --git a/.gitignore b/.gitignore index eaf6912..90fbbc5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules/ .DS_Store .env +*.tgz \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1b37457..f1763aa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,6 @@ { "crates/does-it-throw": "0.1.11", "crates/does-it-throw-wasm": "0.1.11", - ".": "0.2.5" + ".": "0.2.5", + "server": "0.2.5" } diff --git a/.vscode/settings.json b/.vscode/settings.json index d9ccc5f..6288fb8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,7 @@ "source.fixAll.eslint": "explicit" }, "[json]": { - "editor.defaultFormatter": "biomejs.biome" + "editor.defaultFormatter": "vscode.json-language-features" }, "[javascript]": { "editor.defaultFormatter": "biomejs.biome" diff --git a/README.md b/README.md index 7643615..1f421ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@

- +

+

+ Rust Build Status + TypeScript Build Status +

# Well, Does it Throw? @@ -10,11 +14,11 @@ TLDR; This is a *blazingly* fast **lsp server** to find *throw statements* in yo ### Check it out in action: -![demo](./assets/basic-throw.gif) +![demo](https://github.com/michaelangeloio/does-it-throw/blob/main/assets/basic-throw.gif) Also supports **call expressions**: -![demo](./assets/calltothrow.gif) +![demo](https://github.com/michaelangeloio/does-it-throw/blob/main/assets/calltothrow.gif) ## Why? @@ -51,7 +55,7 @@ Untyped `throw` statements can be a pain for those who come from languages like Contributions are certainly welcome! Please open an issue or submit a PR. If you find a use case that isn't supported yet, please search the open issues and open a new one if it doesn't exist. ### Dev Setup -Everything can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file! +Everything can be found in the [CONTRIBUTING.md](https://github.com/michaelangeloio/does-it-throw/blob/main/CONTRIBUTING.md) file! ## Feedback & Suggestions Please use the GitHub discussions tab to provide feedback and suggestions. Thanks! @@ -62,4 +66,4 @@ Please use the GitHub discussions tab to provide feedback and suggestions. Thank - [Oso Vscode Extension](https://github.com/osohq/oso) - For the WASM inspiration. Excellent article [here](https://www.osohq.com/post/building-vs-code-extension-with-rust-wasm-typescript). ## License -MIT - See [LICENSE](./LICENSE) for more information. +MIT - See [LICENSE](https://github.com/michaelangeloio/does-it-throw/blob/main/LICENSE.txt) for more information. diff --git a/bun.lockb b/bun.lockb index 2664bfa..806a971 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/client/package.json b/client/package.json index 165873a..4854c26 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,10 @@ { "name": "vscode-does-it-throw-client", - "description": "VSCode part of a language server", - "author": "Microsoft Corporation", + "description": "VSCode Client for the Does It Throw extension", + "author": { + "name": "Michael Angelo", + "email": "email@michaelangelo.io" + }, "license": "MIT", "version": "0.1.6", "publisher": "vscode", diff --git a/package-lock.json b/package-lock.json index 8d85f11..280b37e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -914,6 +914,10 @@ "node": ">=6.0.0" } }, + "node_modules/does-it-throw-lsp": { + "resolved": "server", + "link": true + }, "node_modules/dom-serializer": { "version": "2.0.0", "dev": true, @@ -2990,10 +2994,6 @@ "resolved": "client", "link": true }, - "node_modules/vscode-does-it-throw-server": { - "resolved": "server", - "link": true - }, "node_modules/vscode-jsonrpc": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", @@ -3133,13 +3133,16 @@ } }, "server": { - "name": "vscode-does-it-throw-server", - "version": "0.1.6", + "name": "does-it-throw-lsp", + "version": "0.2.5", "license": "MIT", "dependencies": { "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, + "bin": { + "does-it-throw-lsp": "bin/does-it-throw" + }, "engines": { "node": "*" } diff --git a/package.json b/package.json index bba3395..78ad70b 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,18 @@ "name": "Michael Angelo", "email": "email@michaelangelo.io" }, - "categories": ["Programming Languages", "Linters", "Debuggers"], - "keywords": ["does it throw", "throw finder", "throw", "javascript", "typescript"], + "categories": [ + "Programming Languages", + "Linters", + "Debuggers" + ], + "keywords": [ + "does it throw", + "throw finder", + "throw", + "javascript", + "typescript" + ], "galleryBanner": { "color": "#050b1f", "theme": "dark" @@ -66,28 +76,48 @@ "doesItThrow.throwStatementSeverity": { "scope": "resource", "type": "string", - "enum": ["Error", "Warning", "Information", "Hint"], + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], "default": "Hint", "description": "Controls the severity level (underline) of a throw statement." }, "doesItThrow.functionThrowSeverity": { "scope": "resource", "type": "string", - "enum": ["Error", "Warning", "Information", "Hint"], + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], "default": "Hint", "description": "Controls the severity level (underline) of a function/const that throws." }, "doesItThrow.callToThrowSeverity": { "scope": "resource", "type": "string", - "enum": ["Error", "Warning", "Information", "Hint"], + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], "default": "Hint", "description": "Controls the severity level (underline) of a function/const that calls a function that throws in the same file." }, "doesItThrow.callToImportedThrowSeverity": { "scope": "resource", "type": "string", - "enum": ["Error", "Warning", "Information", "Hint"], + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], "default": "Hint", "description": "Controls the severity level (underline) of a function/const that calls a function that throws in a different file." }, @@ -100,7 +130,11 @@ "doesItThrow.trace.server": { "scope": "window", "type": "string", - "enum": ["off", "messages", "verbose"], + "enum": [ + "off", + "messages", + "verbose" + ], "default": "off", "description": "Enable for debug mode. Traces the communication between VS Code and the language server." } @@ -119,8 +153,13 @@ "build": "bun run build.ts", "vscode:release": "vsce publish", "vscode:package": "vsce package", - "format": "biome format ." + "format": "biome format .", + "pack:server": "cp README.md server/README.md && cp LICENSE.txt server/LICENSE.txt && npm pack --workspace server", + "publish:server": "npm publish --workspace server" }, "types": "index.d.ts", - "workspaces": ["client", "server"] -} + "workspaces": [ + "client", + "server" + ] +} \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json index 86977d9..faea58a 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -14,6 +14,9 @@ ".": { "release-type": "node" }, + "server": { + "release-type": "node" + }, "crates/does-it-throw": { "release-type": "rust" }, diff --git a/server/.gitignore b/server/.gitignore index 1fcb152..95c4528 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1 +1,4 @@ out +README.md +LICENSE.txt +assets \ No newline at end of file diff --git a/server/bin/does-it-throw b/server/bin/does-it-throw new file mode 100755 index 0000000..3eac73c --- /dev/null +++ b/server/bin/does-it-throw @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +const path = require('path'); +require(path.join(__dirname, '..', 'out', 'server.js')) \ No newline at end of file diff --git a/server/package.json b/server/package.json index 4e037a1..c1806c6 100644 --- a/server/package.json +++ b/server/package.json @@ -1,19 +1,33 @@ { - "name": "vscode-does-it-throw-server", - "description": "Example implementation of a language server in node.", - "version": "0.1.6", - "author": "Microsoft Corporation", + "name": "does-it-throw-lsp", + "description": "Language Server for Does It Throw", + "version": "0.2.5", + "author": { + "name": "Michael Angelo", + "email": "email@michaelangelo.io" + }, "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/michaelangeloio/does-it-throw/blob/main/LICENSE" + } + ], "engines": { "node": "*" }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-extension-samples" - }, + "repository": "https://github.com/michaelangeloio/does-it-throw", + "categories": ["Programming Languages", "Linters", "Debuggers"], + "keywords": ["does it throw", "throw finder", "throw", "javascript", "typescript", "lsp", "language server"], + "qna": "https://github.com/michaelangeloio/does-it-throw/discussions", "dependencies": { "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.8" }, + "files": ["out", "package.json", "README.md", "LICENSE.txt", "bin"], + "main": "out/server.js", + "bin": { + "does-it-throw-lsp": "./bin/does-it-throw" + }, "scripts": {} }