Skip to content

Commit 899ffad

Browse files
committed
feat: add Directory package page entries, update score link
1 parent 6da46d8 commit 899ffad

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export enum ENTRY_OPTION {
66
INSTALL_SPECIFIC_VERSION = 'Install specific package version in the current workspace',
77
VISIT_HOMEPAGE = 'Visit homepage',
88
VISIT_REPO = 'Visit GitHub repository',
9+
VISIT_DIRECTORY = 'Visit React Native Directory page',
910
VISIT_NPM = 'Visit npm registry entry',
1011
VIEW_BUNDLEPHOBIA = 'View BundlePhobia analysis',
1112
VIEW_LICENSE = 'View license details',
@@ -14,6 +15,7 @@ export enum ENTRY_OPTION {
1415
COPY_NAME = 'Copy package name',
1516
COPY_REPO_URL = 'Copy GitHub repository URL',
1617
COPY_NPM_URL = 'Copy npm registry URL',
18+
COPY_DIRECTORY_URL = 'Copy React Native Directory page URL',
1719
GO_BACK = '$(newline) Go back to search',
1820
PLATFORMS = 'Platforms',
1921
COMPATIBILITY = 'Compatibility',

src/extension.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export async function activate(context: ExtensionContext) {
100100
? `$(arrow-circle-down) ${numberFormatter.format(selectedEntry.npm.downloads)}`
101101
: ''
102102
},
103+
{ label: ENTRY_OPTION.VISIT_DIRECTORY },
103104
selectedEntry.github.urls.homepage && {
104105
label: ENTRY_OPTION.VISIT_HOMEPAGE,
105106
description: selectedEntry.github.urls.homepage
@@ -136,6 +137,7 @@ export async function activate(context: ExtensionContext) {
136137
!selectedEntry.template && { label: ENTRY_OPTION.COPY_NAME },
137138
{ label: ENTRY_OPTION.COPY_REPO_URL },
138139
!selectedEntry.template && { label: ENTRY_OPTION.COPY_NPM_URL },
140+
!selectedEntry.template && { label: ENTRY_OPTION.COPY_DIRECTORY_URL },
139141
{ label: '', kind: QuickPickItemKind.Separator },
140142
{ label: ENTRY_OPTION.GO_BACK }
141143
].filter((option) => !!option && typeof option === 'object');
@@ -260,6 +262,10 @@ export async function activate(context: ExtensionContext) {
260262
env.openExternal(Uri.parse(`https://www.npmjs.com/package/${selectedEntry.npmPkg}`));
261263
break;
262264
}
265+
case ENTRY_OPTION.VISIT_DIRECTORY: {
266+
env.openExternal(Uri.parse(`https://reactnative.directory/package/${selectedEntry.npmPkg}`));
267+
break;
268+
}
263269
case ENTRY_OPTION.VIEW_LICENSE: {
264270
env.openExternal(Uri.parse(selectedEntry.github.license.url));
265271
break;
@@ -297,6 +303,11 @@ export async function activate(context: ExtensionContext) {
297303
window.showInformationMessage('npm registry URL copied to clipboard');
298304
break;
299305
}
306+
case ENTRY_OPTION.COPY_DIRECTORY_URL: {
307+
env.clipboard.writeText(`https://reactnative.directory/package/${selectedEntry.npmPkg}`);
308+
window.showInformationMessage('React Native Directory page URL copied to clipboard');
309+
break;
310+
}
300311
case ENTRY_OPTION.GO_BACK: {
301312
await openListWithSearch(packagesPick);
302313
break;
@@ -315,7 +326,7 @@ export async function activate(context: ExtensionContext) {
315326
break;
316327
}
317328
case ENTRY_OPTION.DIRECTORY_SCORE: {
318-
env.openExternal(Uri.parse(`https://reactnative.directory/scoring`));
329+
env.openExternal(Uri.parse(`https://reactnative.directory/package/${selectedEntry.npmPkg}/score`));
319330
break;
320331
}
321332
}

0 commit comments

Comments
 (0)