diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 17fb92a..f42c925 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,7 +52,7 @@ jobs: run: bun compile - name: 🎁 Package extension - run: bun vsce package + run: bun vsce package --no-dependencies - name: 🚀 Publish to Visual Studio Marketplace run: bun vsce publish @@ -75,7 +75,7 @@ jobs: run: bun compile - name: 🎁 Package extension - run: bun vsce package --out ./vscode-react-native-directory.vsix + run: bun vsce package --no-dependencies --out ./vscode-react-native-directory.vsix - name: 🚀 Publish to Open VSX run: bun ovsx publish ./vscode-react-native-directory.vsix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 24927ea..33fbe17 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: - name: 📋 Dry-running release run: bun semantic-release --dry-run env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} create: if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }} diff --git a/bun.lock b/bun.lock index e6b3f6e..fec1cd5 100644 --- a/bun.lock +++ b/bun.lock @@ -4,7 +4,6 @@ "": { "name": "vscode-react-native-directory", "dependencies": { - "axios": "^1.7.9", "preferred-pm": "^4.1.1", }, "devDependencies": { @@ -13,6 +12,7 @@ "@semantic-release/git": "^10.0.1", "@types/node": "^22.13.4", "@types/vscode": "^1.97.0", + "@vercel/ncc": "^0.38.3", "@vscode/vsce": "^3.2.2", "conventional-changelog-conventionalcommits": "^8.0.0", "eslint": "^9.20.1", @@ -166,6 +166,8 @@ "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.24.1", "", { "dependencies": { "@typescript-eslint/types": "8.24.1", "eslint-visitor-keys": "^4.2.0" } }, "sha512-EwVHlp5l+2vp8CoqJm9KikPZgi3gbdZAtabKT9KPShGeOcJhsv4Zdo3oc8T8I0uKEmYoU4ItyxbptjF08enaxg=="], + "@vercel/ncc": ["@vercel/ncc@0.38.3", "", { "bin": { "ncc": "dist/ncc/cli.js" } }, "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA=="], + "@vscode/vsce": ["@vscode/vsce@3.2.2", "", { "dependencies": { "@azure/identity": "^4.1.0", "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", "chalk": "^2.4.2", "cheerio": "^1.0.0-rc.9", "cockatiel": "^3.1.2", "commander": "^12.1.0", "form-data": "^4.0.0", "glob": "^11.0.0", "hosted-git-info": "^4.0.2", "jsonc-parser": "^3.2.0", "leven": "^3.1.0", "markdown-it": "^14.1.0", "mime": "^1.3.4", "minimatch": "^3.0.3", "parse-semver": "^1.1.1", "read": "^1.0.7", "semver": "^7.5.2", "tmp": "^0.2.3", "typed-rest-client": "^1.8.4", "url-join": "^4.0.1", "xml2js": "^0.5.0", "yauzl": "^2.3.1", "yazl": "^2.2.2" }, "optionalDependencies": { "keytar": "^7.7.0" }, "bin": { "vsce": "vsce" } }, "sha512-4TqdUq/yKlQTHcQMk/DamR632bq/+IJDomSbexOMee/UAYWqYm0XHWA6scGslsCpzY+sCWEhhl0nqdOB0XW1kw=="], "@vscode/vsce-sign": ["@vscode/vsce-sign@2.0.5", "", { "optionalDependencies": { "@vscode/vsce-sign-alpine-arm64": "2.0.2", "@vscode/vsce-sign-alpine-x64": "2.0.2", "@vscode/vsce-sign-darwin-arm64": "2.0.2", "@vscode/vsce-sign-darwin-x64": "2.0.2", "@vscode/vsce-sign-linux-arm": "2.0.2", "@vscode/vsce-sign-linux-arm64": "2.0.2", "@vscode/vsce-sign-linux-x64": "2.0.2", "@vscode/vsce-sign-win32-arm64": "2.0.2", "@vscode/vsce-sign-win32-x64": "2.0.2" } }, "sha512-GfYWrsT/vypTMDMgWDm75iDmAOMe7F71sZECJ+Ws6/xyIfmB3ELVnVN+LwMFAvmXY+e6eWhR2EzNGF/zAhWY3Q=="], @@ -214,8 +216,6 @@ "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="], - "axios": ["axios@1.7.9", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw=="], - "azure-devops-node-api": ["azure-devops-node-api@12.5.0", "", { "dependencies": { "tunnel": "0.0.6", "typed-rest-client": "^1.8.4" } }, "sha512-R5eFskGvOm3U/GzeAuxRkUsAl0hrAwGgWn6zAd2KrZmrEhWZVqLew4OOupbQlXUuojUzpGtq62SmdhJ06N88og=="], "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], @@ -776,8 +776,6 @@ "proto-list": ["proto-list@1.2.4", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="], - "proxy-from-env": ["proxy-from-env@1.1.0", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="], - "pump": ["pump@3.0.2", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw=="], "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], diff --git a/package.json b/package.json index 2291f7d..3574fb1 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "activationEvents": [ "onCommand:extension.showQuickPick" ], - "main": "./build/extension.js", + "main": "./build/index.js", "contributes": { "commands": [ { @@ -36,13 +36,12 @@ "vscode": "^1.97.0" }, "scripts": { - "compile": "rimraf build && tsc -p .", - "lint": "eslint .", - "package": "vsce package", + "compile": "rimraf build && ncc build src/extension.ts -o build -m", + "lint": "tsc --noEmit && eslint .", + "package": "vsce package --no-dependencies", "release:dry-run": "bun --env-file=.env semantic-release --dry-run" }, "dependencies": { - "axios": "^1.7.9", "preferred-pm": "^4.1.1" }, "devDependencies": { @@ -51,6 +50,7 @@ "@semantic-release/git": "^10.0.1", "@types/node": "^22.13.4", "@types/vscode": "^1.97.0", + "@vercel/ncc": "^0.38.3", "@vscode/vsce": "^3.2.2", "conventional-changelog-conventionalcommits": "^8.0.0", "eslint": "^9.20.1", diff --git a/src/utils.ts b/src/utils.ts index 5c547ed..83b414f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,4 @@ import * as vscode from 'vscode'; -import axios from 'axios'; import { DirectoryEntry, PackageData } from './types'; @@ -100,20 +99,25 @@ export async function fetchData(query?: string, keywords?: ValidKeyword[]): Prom keywords.forEach((keyword) => apiUrl.searchParams.append(keyword, 'true')); } - const { data } = await axios.get(apiUrl.href); + const response = await fetch(apiUrl.href); - if ('libraries' in data && Array.isArray(data.libraries)) { - return data.libraries.map((item: PackageData) => ({ - label: item.npmPkg, - description: item.github.description, - detail: getDetailLabel(item), - alwaysShow: true, - ...item - })); - } else { - vscode.window.showErrorMessage('Invalid React Native Directory API response'); + if (response.ok) { + const data = (await response.json()) as object; + + if ('libraries' in data && Array.isArray(data.libraries)) { + return data.libraries.map((item: PackageData) => ({ + label: item.npmPkg, + description: item.github.description, + detail: getDetailLabel(item), + alwaysShow: true, + ...item + })); + } + vscode.window.showErrorMessage(`Invalid React Native Directory API response content`); return []; } + vscode.window.showErrorMessage(`Invalid React Native Directory API response: ${response.status}`); + return []; } catch (error) { console.error(error); vscode.window.showErrorMessage('Failed to fetch data from React Native Directory API'); diff --git a/tsconfig.json b/tsconfig.json index 246b7bb..288a067 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "rootDir": "./src", - "outDir": "./build", "module": "commonjs", "target": "es2021", "lib": ["es2021"],