Skip to content
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
54 changes: 27 additions & 27 deletions react-native-libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -10791,7 +10791,7 @@
},
{
"githubUrl": "https://github.com/Richou/react-native-android-location-enabler",
"example": [
"examples": [
"https://github.com/Richou/react-native-android-location-enabler/tree/main/example"
],
"images": [
Expand Down Expand Up @@ -13729,7 +13729,7 @@
"examples": ["https://github.com/liveakshay/expo-spellchecker/tree/main/example"],
"ios": true,
"android": true,
"expo": true,
"expoGo": true,
"newArchitecture": true
},
{
Expand All @@ -13750,7 +13750,7 @@
"ios": true,
"android": true,
"web": true,
"expo": true,
"expoGo": true,
"newArchitecture": true
},
{
Expand All @@ -13762,7 +13762,7 @@
"ios": true,
"android": true,
"web": true,
"expo": true,
"expoGo": true,
"newArchitecture": true,
"fireos": true
},
Expand All @@ -13772,7 +13772,7 @@
"ios": true,
"android": true,
"web": true,
"expo": true,
"expoGo": true,
"newArchitecture": true,
"fireos": true
},
Expand All @@ -13781,7 +13781,7 @@
"ios": true,
"android": true,
"web": true,
"expo": true,
"expoGo": true,
"newArchitecture": true,
"fireos": true
},
Expand All @@ -13791,7 +13791,7 @@
"android": true,
"web": true,
"fireos": true,
"expo": true,
"expoGo": true,
"newArchitecture": true
},
{
Expand All @@ -13800,7 +13800,7 @@
"ios": true,
"android": true,
"web": true,
"expo": true,
"expoGo": true,
"newArchitecture": true
},
{
Expand All @@ -13809,36 +13809,36 @@
"ios": true,
"android": true,
"web": true,
"expo": true
"expoGo": true
},
{
"githubUrl": "https://github.com/FortAwesome/Font-Awesome/tree/6.x/js-packages/@fortawesome/free-regular-svg-icons",
"npmPkg": "@fortawesome/free-regular-svg-icons",
"ios": true,
"android": true,
"web": true,
"expo": true
"expoGo": true
},
{
"githubUrl": "https://github.com/FortAwesome/Font-Awesome/tree/6.x/js-packages/@fortawesome/free-solid-svg-icons",
"npmPkg": "@fortawesome/free-solid-svg-icons",
"ios": true,
"android": true,
"web": true,
"expo": true
"expoGo": true
},
{
"githubUrl": "https://github.com/FilipiRafael/react-native-motion-tabs",
"ios": true,
"android": true,
"expo": true,
"expoGo": true,
"newArchitecture": true
},
{
"githubUrl": "https://github.com/vantuan88291/react-native-ota-hot-update",
"ios": true,
"android": true,
"expo": true,
"expoGo": true,
"newArchitecture": true,
"configPlugin": true
},
Expand Down Expand Up @@ -17428,7 +17428,7 @@
{
"githubUrl": "https://github.com/avas-app/react-native-android-otp-autofill",
"npmPkg": "@avasapp/react-native-otp-autofill",
"example": ["https://github.com/avas-app/react-native-android-otp-autofill/tree/main/example"],
"examples": ["https://github.com/avas-app/react-native-android-otp-autofill/tree/main/example"],
"ios": true,
"android": true,
"newArchitecture": true,
Expand Down Expand Up @@ -17732,20 +17732,16 @@
},
{
"githubUrl": "https://github.com/orcunorcun/react-native-cookie-handler",
"npmPkg": "react-native-cookie-handler",
"examples": [
"https://github.com/orcunorcun/react-native-cookie-handler/tree/master/example"
],
"examples": ["https://github.com/orcunorcun/react-native-cookie-handler/tree/master/example"],
"ios": true,
"android": true
},
{
"githubUrl": "https://github.com/mCodex/react-native-nitro-sfsymbols",
"npmPkg": "react-native-nitro-sfsymbols",
"examples": [
"https://github.com/mCodex/react-native-nitro-sfsymbols/tree/main/example"
"examples": ["https://github.com/mCodex/react-native-nitro-sfsymbols/tree/main/example"],
"images": [
"https://raw.githubusercontent.com/mCodex/react-native-nitro-sfsymbols/refs/heads/main/example.gif"
],
"images": ["https://raw.githubusercontent.com/mCodex/react-native-nitro-sfsymbols/refs/heads/main/example.gif"],
"ios": true,
"macos": true,
"tvos": true,
Expand All @@ -17754,16 +17750,20 @@
},
{
"githubUrl": "https://github.com/sbaiahmed1/react-native-menus",
"npmPkg": "react-native-menus",
"examples": [
"https://github.com/sbaiahmed1/react-native-menus/tree/main/example"
],
"examples": ["https://github.com/sbaiahmed1/react-native-menus/tree/main/example"],
"images": [
"https://raw.githubusercontent.com/sbaiahmed1/react-native-menus/refs/heads/main/android-image.png",
"https://raw.githubusercontent.com/sbaiahmed1/react-native-menus/refs/heads/main/ios-image.png"
],
"ios": true,
"expo": true,
"android": true,
"newArchitecture": true,
"expoGo": true
},
{
"githubUrl": "https://github.com/software-mansion-labs/react-native-shine",
"examples": ["https://github.com/software-mansion-labs/react-native-shine/tree/main/example"],
"ios": true,
"android": true,
"newArchitecture": true,
"expoGo": true
Expand Down
11 changes: 11 additions & 0 deletions scripts/cleanup-libraries-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from 'node:path';

import libraries from '~/react-native-libraries.json';
import { type LibraryDataEntryType } from '~/types';
import { VALID_ENTRY_KEYS } from '~/util/Constants';

const LIBRARIES_JSON_PATH = path.join('react-native-libraries.json');

Expand All @@ -14,6 +15,16 @@ function removeEmptyArray(lib: LibraryDataEntryType, key: 'examples' | 'images')
}

const processedLibraries = libraries
// Remove invalid keys in entry
.map(lib => {
const invalidKeys = Object.keys(lib).filter(key => !VALID_ENTRY_KEYS.has(key));

if (invalidKeys.length > 0) {
return omit(lib, invalidKeys);
}

return lib;
})
// Remove redundant `npmPkg` for libraries with the correct GitHub repository name
.map((lib: LibraryDataEntryType) =>
lib.npmPkg && !lib.npmPkg.includes('/') && lib.githubUrl.endsWith(`/${lib.npmPkg}`)
Expand Down
20 changes: 16 additions & 4 deletions scripts/validate-libraries.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { fillNpmName } from '~/scripts/helpers';
import { type LibraryType } from '~/types';
import { VALID_ENTRY_KEYS } from '~/util/Constants';

import libraries from '../react-native-libraries.json';

Expand All @@ -11,27 +13,37 @@ function validateLibrariesFormat(libraries: LibraryType[]) {
const errorsList = libraries.reduce<Record<string, string[]>>((errors, library, index) => {
const libraryErrors = [];
const libraryProperties = Object.keys(library);
const libraryWithNpmName = fillNpmName(library);

// Check that it has the githubUrl property and that it is in the correct format
if (!libraryProperties.includes('githubUrl')) {
libraryErrors.push('Must contain a githubUrl property');
libraryErrors.push(`- Must contain a 'githubUrl' property`);
} else if (!library.githubUrl.match(GITHUB_URL_PATTERN)) {
libraryErrors.push(
`The githubUrl of ${library.githubUrl} must be in the format:\nhttps://github.com/owner/repo-name or https://github.com/owner/repo-name/tree/default-branch/name for monorepos`
`- The 'githubUrl' of ${library.githubUrl} must be in the format:\nhttps://github.com/owner/repo-name or https://github.com/owner/repo-name/tree/default-branch/name for monorepos`
);
}

const invalidKeys = libraryProperties.filter(key => !VALID_ENTRY_KEYS.has(key));

if (invalidKeys.length > 0) {
invalidKeys.forEach(key => {
libraryErrors.push(`- Uses invalid key - ${key}`);
});
}

// If there were errors, add them to the object
if (libraryErrors.length > 0) {
errors[index] = libraryErrors;
errors[libraryWithNpmName.npmPkg] = libraryErrors;
}

return errors;
}, {});

if (Object.keys(errorsList).length > 0) {
const errorDescriptions = Object.entries(errorsList).map(
([index, libraryErrors]) => `Library at index ${index}:\n${libraryErrors.join('\n')}`
([npmPkg, libraryErrors], index) =>
`Library entry for '${npmPkg}' contains errors:\n${libraryErrors.join('\n')}`
);
console.error('❌ Malformed libraries found:\n' + errorDescriptions.join('\n'));
process.exit(1);
Expand Down
15 changes: 14 additions & 1 deletion scripts/validate-new-entries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { fetch } from 'bun';
import { differenceWith, isEqual } from 'es-toolkit';

import { VALID_ENTRY_KEYS } from '~/util/Constants';

import { fetchGithubData } from './fetch-github-data';
import { fetchNpmDownloadData } from './fetch-npm-download-data';
import { fillNpmName, hasMismatchedPackageData } from './helpers';
Expand All @@ -20,7 +22,7 @@ if (libraries.length === mainData.length) {
process.exit(0);
}

console.log('πŸ”οΈ Detected changes in data entries, checking!');
console.log('🚩️ Detected changes in data entries, checking!');

const modifiedEntries = differenceWith(libraries, mainData, isEqual);

Expand Down Expand Up @@ -80,6 +82,16 @@ const checkResults = await Promise.all(

return false;
}

const invalidKeys = Object.keys(entry).filter(key => !VALID_ENTRY_KEYS.has(key));

if (invalidKeys.length > 0) {
console.error(
`Package entry for '${entryWithGitHubData.npmPkg}' contains invalid fields: ${invalidKeys.map(key => `'${key}'`).join(', ')}. Correct or remove the listed keys to fix the definition.`
);
return false;
}

return true;
})
);
Expand All @@ -88,4 +100,5 @@ if (checkResults.filter(result => !result).length > 0) {
console.error('\n❌ There were errors spotted during new entries check!');
process.exit(1);
}

console.log('βœ… All checks have passed!');
23 changes: 23 additions & 0 deletions util/Constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
export const NUM_PER_PAGE = 30;

export const VALID_ENTRY_KEYS = new Set([
'githubUrl',
'ios',
'android',
'web',
'expoGo',
'windows',
'macos',
'fireos',
'tvos',
'visionos',
'unmaintained',
'dev',
'template',
'newArchitecture',
'newArchitectureNote',
'configPlugin',
'alternatives',
'npmPkg',
'examples',
'images',
]);