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
2 changes: 1 addition & 1 deletion .github/workflows/data-test-and-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
env:
CI_CHECKS_TOKEN: ${{ github.token }}
- name: Lint data
run: bun oxfmt react-native-libraries.json
run: bun oxfmt react-native-libraries.json --check
2 changes: 1 addition & 1 deletion react-native-libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -19284,7 +19284,7 @@
"android": true,
"newArchitecture": true
},
{
{
"githubUrl": "https://github.com/Gautham495/react-native-nitro-ios-alarm-kit",
"examples": [
"https://github.com/Gautham495/react-native-nitro-ios-alarm-kit/tree/main/example"
Expand Down
38 changes: 38 additions & 0 deletions scripts/validate-new-entries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fetch } from 'bun';
import { differenceWith, isEqual } from 'es-toolkit';

import { type LibraryType } from '~/types';
import { VALID_ENTRY_KEYS } from '~/util/Constants';

import libraries from '../react-native-libraries.json';
Expand Down Expand Up @@ -105,6 +106,43 @@ for (let i = 0; i < modifiedEntries.length; i += BATCH_SIZE) {
return false;
}

if (entryWithGitHubData?.alternatives && entryWithGitHubData.alternatives.length > 0) {
const alternativesDataResponse = await fetch(
`https://reactnative.directory/api/library?name=${entryWithGitHubData.alternatives.join(',')}`
);

if (alternativesDataResponse.status !== 200) {
console.error('Cannot check the alternative library existence in the directory.');
return false;
}

const alternativesDataJson = (await alternativesDataResponse.json()) as Record<
string,
LibraryType
>;

const alternativesChecks = entryWithGitHubData.alternatives.map(alternative => {
if (alternative in alternativesDataJson) {
if (!alternativesDataJson[alternative].unmaintained) {
console.error(
`${alternative} is not marked as unmaintained in the directory, so it cannot be defined as an alternative for the package.`
);
return false;
Comment on lines +126 to +130
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your comment you explained

the alternatives should be placed in the unmaintained package entry [...] instead of [the new package entry]

but here, you're enforcing the opposite (that the alternatives in a new package entry point to unmaintained packages) πŸ˜… @Simek

Copy link
Copy Markdown
Member Author

@Simek Simek Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, spotted that too and corrected in:

}
} else {
console.error(
`${alternative} is not listed in the directory, so it cannot be defined as an alternative for the package.`
);
return false;
}
return true;
});

if (alternativesChecks.includes(false)) {
return false;
}
}

return true;
})()
)
Expand Down