Skip to content

Commit 72869ff

Browse files
authored
fix: missing dependency in VSIX, drop axios (#3)
1 parent cb3949b commit 72869ff

File tree

6 files changed

+27
-26
lines changed

6 files changed

+27
-26
lines changed

Diff for: .github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: bun compile
5353

5454
- name: 🎁 Package extension
55-
run: bun vsce package
55+
run: bun vsce package --no-dependencies
5656

5757
- name: 🚀 Publish to Visual Studio Marketplace
5858
run: bun vsce publish
@@ -75,7 +75,7 @@ jobs:
7575
run: bun compile
7676

7777
- name: 🎁 Package extension
78-
run: bun vsce package --out ./vscode-react-native-directory.vsix
78+
run: bun vsce package --no-dependencies --out ./vscode-react-native-directory.vsix
7979

8080
- name: 🚀 Publish to Open VSX
8181
run: bun ovsx publish ./vscode-react-native-directory.vsix

Diff for: .github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: 📋 Dry-running release
3535
run: bun semantic-release --dry-run
3636
env:
37-
GITHUB_TOKEN: ${{ github.token }}
37+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
3838

3939
create:
4040
if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }}

Diff for: bun.lock

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"": {
55
"name": "vscode-react-native-directory",
66
"dependencies": {
7-
"axios": "^1.7.9",
87
"preferred-pm": "^4.1.1",
98
},
109
"devDependencies": {
@@ -13,6 +12,7 @@
1312
"@semantic-release/git": "^10.0.1",
1413
"@types/node": "^22.13.4",
1514
"@types/vscode": "^1.97.0",
15+
"@vercel/ncc": "^0.38.3",
1616
"@vscode/vsce": "^3.2.2",
1717
"conventional-changelog-conventionalcommits": "^8.0.0",
1818
"eslint": "^9.20.1",
@@ -166,6 +166,8 @@
166166

167167
"@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.24.1", "eslint-visitor-keys": "^4.2.0" } }, "sha512-EwVHlp5l+2vp8CoqJm9KikPZgi3gbdZAtabKT9KPShGeOcJhsv4Zdo3oc8T8I0uKEmYoU4ItyxbptjF08enaxg=="],
168168

169+
"@vercel/ncc": ["@vercel/[email protected]", "", { "bin": { "ncc": "dist/ncc/cli.js" } }, "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA=="],
170+
169171
"@vscode/vsce": ["@vscode/[email protected]", "", { "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=="],
170172

171173
"@vscode/vsce-sign": ["@vscode/[email protected]", "", { "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 @@
214216

215217
"asynckit": ["[email protected]", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
216218

217-
"axios": ["[email protected]", "", { "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } }, "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw=="],
218-
219219
"azure-devops-node-api": ["[email protected]", "", { "dependencies": { "tunnel": "0.0.6", "typed-rest-client": "^1.8.4" } }, "sha512-R5eFskGvOm3U/GzeAuxRkUsAl0hrAwGgWn6zAd2KrZmrEhWZVqLew4OOupbQlXUuojUzpGtq62SmdhJ06N88og=="],
220220

221221
"balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
@@ -776,8 +776,6 @@
776776

777777
"proto-list": ["[email protected]", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="],
778778

779-
"proxy-from-env": ["[email protected]", "", {}, "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="],
780-
781779
"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw=="],
782780

783781
"punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],

Diff for: package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"activationEvents": [
2323
"onCommand:extension.showQuickPick"
2424
],
25-
"main": "./build/extension.js",
25+
"main": "./build/index.js",
2626
"contributes": {
2727
"commands": [
2828
{
@@ -36,13 +36,12 @@
3636
"vscode": "^1.97.0"
3737
},
3838
"scripts": {
39-
"compile": "rimraf build && tsc -p .",
40-
"lint": "eslint .",
41-
"package": "vsce package",
39+
"compile": "rimraf build && ncc build src/extension.ts -o build -m",
40+
"lint": "tsc --noEmit && eslint .",
41+
"package": "vsce package --no-dependencies",
4242
"release:dry-run": "bun --env-file=.env semantic-release --dry-run"
4343
},
4444
"dependencies": {
45-
"axios": "^1.7.9",
4645
"preferred-pm": "^4.1.1"
4746
},
4847
"devDependencies": {
@@ -51,6 +50,7 @@
5150
"@semantic-release/git": "^10.0.1",
5251
"@types/node": "^22.13.4",
5352
"@types/vscode": "^1.97.0",
53+
"@vercel/ncc": "^0.38.3",
5454
"@vscode/vsce": "^3.2.2",
5555
"conventional-changelog-conventionalcommits": "^8.0.0",
5656
"eslint": "^9.20.1",

Diff for: src/utils.ts

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as vscode from 'vscode';
2-
import axios from 'axios';
32

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

@@ -100,20 +99,25 @@ export async function fetchData(query?: string, keywords?: ValidKeyword[]): Prom
10099
keywords.forEach((keyword) => apiUrl.searchParams.append(keyword, 'true'));
101100
}
102101

103-
const { data } = await axios.get(apiUrl.href);
102+
const response = await fetch(apiUrl.href);
104103

105-
if ('libraries' in data && Array.isArray(data.libraries)) {
106-
return data.libraries.map((item: PackageData) => ({
107-
label: item.npmPkg,
108-
description: item.github.description,
109-
detail: getDetailLabel(item),
110-
alwaysShow: true,
111-
...item
112-
}));
113-
} else {
114-
vscode.window.showErrorMessage('Invalid React Native Directory API response');
104+
if (response.ok) {
105+
const data = (await response.json()) as object;
106+
107+
if ('libraries' in data && Array.isArray(data.libraries)) {
108+
return data.libraries.map((item: PackageData) => ({
109+
label: item.npmPkg,
110+
description: item.github.description,
111+
detail: getDetailLabel(item),
112+
alwaysShow: true,
113+
...item
114+
}));
115+
}
116+
vscode.window.showErrorMessage(`Invalid React Native Directory API response content`);
115117
return [];
116118
}
119+
vscode.window.showErrorMessage(`Invalid React Native Directory API response: ${response.status}`);
120+
return [];
117121
} catch (error) {
118122
console.error(error);
119123
vscode.window.showErrorMessage('Failed to fetch data from React Native Directory API');

Diff for: tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compilerOptions": {
33
"rootDir": "./src",
4-
"outDir": "./build",
54
"module": "commonjs",
65
"target": "es2021",
76
"lib": ["es2021"],

0 commit comments

Comments
 (0)