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

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
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

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
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' }}

bun.lock

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
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",

src/utils.ts

Lines changed: 16 additions & 12 deletions
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');

tsconfig.json

Lines changed: 0 additions & 1 deletion
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)