Skip to content

Commit 6da46d8

Browse files
committed
feat: add Nightly Program data, link and filter
1 parent 5c7b381 commit 6da46d8

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

src/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export enum ENTRY_OPTION {
1010
VIEW_BUNDLEPHOBIA = 'View BundlePhobia analysis',
1111
VIEW_LICENSE = 'View license details',
1212
VIEW_DEPENDENCIES = 'View dependencies',
13+
VIEW_NIGHTLY_RESULTS = 'View results of Nightly Program tests',
1314
COPY_NAME = 'Copy package name',
1415
COPY_REPO_URL = 'Copy GitHub repository URL',
1516
COPY_NPM_URL = 'Copy npm registry URL',
@@ -53,5 +54,6 @@ export const VALID_KEYWORDS_MAP = {
5354
ispopular: 'isPopular',
5455
wasrecentlyupdated: 'wasRecentlyUpdated',
5556
newarchitecture: 'newArchitecture',
56-
configplugin: 'configPlugin'
57+
configplugin: 'configPlugin',
58+
nightlyprogram: 'nightlyProgram'
5759
};

src/extension.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export async function activate(context: ExtensionContext) {
113113
description: `$(package) ${numberFormatter.format(selectedEntry.github.stats.dependencies)} ${selectedEntry.github.stats.dependencies === 1 ? 'dependency' : 'dependencies'}`
114114
},
115115
!selectedEntry.template && { label: ENTRY_OPTION.VIEW_BUNDLEPHOBIA },
116+
selectedEntry.nightlyProgram && { label: ENTRY_OPTION.VIEW_NIGHTLY_RESULTS },
116117
{ label: 'details', kind: QuickPickItemKind.Separator },
117118
{
118119
label: ENTRY_OPTION.PLATFORMS,
@@ -267,6 +268,10 @@ export async function activate(context: ExtensionContext) {
267268
env.openExternal(Uri.parse(`https://bundlephobia.com/package/${selectedEntry.npmPkg}`));
268269
break;
269270
}
271+
case ENTRY_OPTION.VIEW_NIGHTLY_RESULTS: {
272+
env.openExternal(Uri.parse(`https://react-native-community.github.io/nightly-tests/`));
273+
break;
274+
}
270275
case ENTRY_OPTION.PLATFORMS: {
271276
const searchValue = deduplicateSearchTokens(packagesPick.value, platformsList);
272277
await openListWithSearch(packagesPick, searchValue);

src/types.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ export type PackageData = {
3535
github: {
3636
name: string;
3737
fullName: string;
38-
description: string;
38+
description?: string;
3939
registry?: string;
4040
topics?: string[];
4141
hasTypes?: boolean;
4242
newArchitecture?: boolean;
4343
isArchived?: boolean;
4444
isPrivate?: boolean;
4545
hasNativeCode: boolean;
46+
hasReadme?: boolean;
4647
configPlugin?: boolean;
4748
moduleType?: 'expo' | 'nitro' | 'turbo';
4849
urls: {
@@ -52,8 +53,10 @@ export type PackageData = {
5253
stats: {
5354
hasIssues: boolean;
5455
hasWiki: boolean;
56+
hasProjects: boolean;
5557
hasSponsorships: boolean;
5658
hasDiscussions: boolean;
59+
hasVulnerabilityAlerts: boolean;
5760
hasTopics?: boolean;
5861
updatedAt: Date | string;
5962
createdAt: Date | string;
@@ -71,26 +74,22 @@ export type PackageData = {
7174
url: string;
7275
id: string;
7376
};
74-
lastRelease?: {
75-
name: string;
76-
tagName: string;
77-
createdAt: Date | string;
78-
publishedAt: Date | string;
79-
isPrerelease: boolean;
80-
};
8177
};
8278
npm?: {
8379
downloads?: number;
8480
weekDownloads?: number;
8581
size?: number;
82+
versionsCount?: number;
8683
latestRelease?: string;
8784
latestReleaseDate?: string;
85+
hasReadme?: boolean;
8886
};
8987
score: number;
9088
matchingScoreModifiers: string[];
9189
topicSearchString: string;
9290
popularity?: number;
9391
matchScore?: number;
92+
nightlyProgram?: boolean;
9493
};
9594

9695
export type NpmRegistryData = {

src/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ function getDetailLabel(item: PackageData) {
1616
item.template && '$(folder-library) Template',
1717
platforms.length && '•',
1818
platforms.join(', '),
19-
(item.newArchitecture || item.expoGo || item.github.hasTypes) && '•',
19+
(item.newArchitecture || item.expoGo) && '•',
2020
(item.newArchitecture || item.expoGo) &&
2121
`$(verified) New Architecture${item.newArchitecture === 'new-arch-only' ? ' only' : ''}`,
22-
item.github.hasTypes && `$(symbol-type-parameter) Types`
22+
item.github.hasTypes && `• $(symbol-type-parameter) Types`,
23+
item.nightlyProgram && `• $(beaker) Nightly Program`
2324
]
2425
.filter(Boolean)
2526
.join(' ');
@@ -57,7 +58,7 @@ export async function fetchData(query?: string, keywords?: ValidKeyword[]): Prom
5758
if ('libraries' in data && Array.isArray(data.libraries)) {
5859
return data.libraries.map((item: PackageData) => ({
5960
label: item.npmPkg,
60-
description: item.github.description,
61+
description: item.github.description ?? 'No description',
6162
detail: getDetailLabel(item),
6263
alwaysShow: true,
6364
...item

0 commit comments

Comments
 (0)