Skip to content

fix: missing dependency in VSIX, drop axios #3

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

Merged
merged 1 commit into from
Feb 20, 2025
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
8 changes: 3 additions & 5 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"": {
"name": "vscode-react-native-directory",
"dependencies": {
"axios": "^1.7.9",
"preferred-pm": "^4.1.1",
},
"devDependencies": {
Expand All @@ -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",
Expand Down Expand Up @@ -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=="],
Expand Down Expand Up @@ -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=="],
Expand Down Expand Up @@ -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=="],
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"activationEvents": [
"onCommand:extension.showQuickPick"
],
"main": "./build/extension.js",
"main": "./build/index.js",
"contributes": {
"commands": [
{
Expand All @@ -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": {
Expand All @@ -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",
Expand Down
28 changes: 16 additions & 12 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as vscode from 'vscode';
import axios from 'axios';

import { DirectoryEntry, PackageData } from './types';

Expand Down Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build",
"module": "commonjs",
"target": "es2021",
"lib": ["es2021"],
Expand Down