Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

merge package.json and GitHub topics, update and cleanup libraries #495

Merged
merged 1 commit into from
Nov 9, 2020
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"data:update": "babel-node scripts/build-and-score-data.js --presets @babel/preset-env",
"data:test": "babel-node scripts/validate-libraries.js --presets @babel/preset-env",
"data:validate": "ajv validate -s react-native-libraries.schema.json -d react-native-libraries.json --verbose",
"libraries:cleanup": "babel-node scripts/cleanup-libraries-json.js --presets @babel/preset-env"
"libraries:cleanup": "babel-node scripts/cleanup-libraries-json.js --presets @babel/preset-env && yarn libraries:format",
"libraries:format": "prettier --write react-native-libraries.json"
},
"dependencies": {
"@expo/html-elements": "^0.0.0",
Expand Down
51 changes: 34 additions & 17 deletions react-native-libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -1880,12 +1880,6 @@
"expo": true,
"unmaintained": true
},
{
"githubUrl": "https://github.com/joao-alberto/react-native-tilt",
"ios": true,
"android": true,
"expo": true
},
{
"githubUrl": "https://github.com/Polidea/react-native-ble-plx",
"ios": true,
Expand Down Expand Up @@ -3121,10 +3115,20 @@
"windows": true
},
{
"githubUrl": "https://github.com/microsoft/react-native-dualscreen",
"githubUrl": "https://github.com/microsoft/react-native-dualscreen/tree/master/dualscreeninfo",
"android": true,
"npmPkg": "react-native-dualscreeninfo"
},
{
"githubUrl": "https://github.com/microsoft/react-native-dualscreen/tree/master/twopane-navigation",
"android": true,
"npmPkg": "react-native-twopane-navigation"
},
{
"githubUrl": "https://github.com/microsoft/react-native-dualscreen/tree/master/twopaneview",
"android": true,
"npmPkg": "react-native-twopaneview"
},
{
"githubUrl": "https://github.com/expo/expo/tree/master/packages/expo-splash-screen",
"ios": true,
Expand Down Expand Up @@ -3743,7 +3747,8 @@
{
"githubUrl": "https://github.com/luggit/react-native-config",
"ios": true,
"android": true
"android": true,
"windows": true
},
{
"githubUrl": "https://github.com/luisfcofv/react-native-deep-linking",
Expand Down Expand Up @@ -4222,7 +4227,8 @@
"unmaintained": true
},
{
"githubUrl": "https://github.com/uxcam/react-native-ux-cam",
"githubUrl": "https://github.com/uxcam/react-native-ux-cam/tree/master/uxcam-react-wrapper",
"npmPkg": "react-native-ux-cam",
"ios": true,
"android": true
},
Expand Down Expand Up @@ -5347,7 +5353,9 @@
},
{
"githubUrl": "https://github.com/WrathChaos/react-native-bouncy-checkbox",
"images": ["https://github.com/WrathChaos/react-native-bouncy-checkbox/raw/master/assets/Screenshots/example.gif"],
"images": [
"https://github.com/WrathChaos/react-native-bouncy-checkbox/raw/master/assets/Screenshots/example.gif"
],
"ios": true,
"android": true
},
Expand All @@ -5368,8 +5376,9 @@
},
{
"githubUrl": "https://github.com/facebook/flipper/tree/master/react-native/react-native-flipper",
"npmPkg": "react-native-flipper",
"examples": ["https://github.com/facebook/flipper/tree/master/react-native/ReactNativeFlipperExample"],
"examples": [
"https://github.com/facebook/flipper/tree/master/react-native/ReactNativeFlipperExample"
],
"ios": true,
"android": true,
"dev": true
Expand All @@ -5390,7 +5399,9 @@
},
{
"githubUrl": "https://github.com/terrysahaidak/react-native-gallery-toolkit",
"examples": ["https://github.com/terrysahaidak/react-native-gallery-toolkit/tree/master/Example"],
"examples": [
"https://github.com/terrysahaidak/react-native-gallery-toolkit/tree/master/Example"
],
"images": [
"https://github.com/terrysahaidak/react-native-gallery-toolkit/raw/master/gifs/promo.gif",
"https://github.com/terrysahaidak/react-native-gallery-toolkit/raw/master/gifs/promo_2.gif"
Expand All @@ -5400,7 +5411,9 @@
},
{
"githubUrl": "https://github.com/junedomingo/react-native-rename",
"images": ["https://cloud.githubusercontent.com/assets/5106887/24444940/cbcb0a58-149a-11e7-9714-2c7bf5254b0d.gif"],
"images": [
"https://cloud.githubusercontent.com/assets/5106887/24444940/cbcb0a58-149a-11e7-9714-2c7bf5254b0d.gif"
],
"ios": true,
"android": true,
"dev": true
Expand All @@ -5423,7 +5436,9 @@
},
{
"githubUrl": "https://github.com/Naturalclar/react-native-color-picker-ios",
"examples": ["https://github.com/Naturalclar/react-native-color-picker-ios/tree/master/example"],
"examples": [
"https://github.com/Naturalclar/react-native-color-picker-ios/tree/master/example"
],
"images": [
"https://user-images.githubusercontent.com/6936373/95818710-758a8a80-0d5f-11eb-8e45-fb0573049c34.jpeg",
"https://user-images.githubusercontent.com/6936373/95818705-73283080-0d5f-11eb-8a10-c0f166ed13a9.jpeg",
Expand Down Expand Up @@ -5501,7 +5516,7 @@
{
"githubUrl": "https://github.com/nandorojo/dripsy",
"examples": [
"https://github.com/nandorojo/dripsy/tree/master/next-example",
"https://github.com/nandorojo/dripsy/tree/master/next-example",
"https://github.com/nandorojo/dripsy/tree/master/example"
],
"ios": true,
Expand All @@ -5527,7 +5542,9 @@
},
{
"githubUrl": "https://github.com/dooboolab/react-native-audio-recorder-player",
"examples": ["https://github.com/dooboolab/react-native-audio-recorder-player/tree/master/Example"],
"examples": [
"https://github.com/dooboolab/react-native-audio-recorder-player/tree/master/Example"
],
"ios": true,
"android": true
},
Expand Down
23 changes: 12 additions & 11 deletions scripts/fetch-github-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,29 +224,33 @@ const getLicenseFromPackageJson = packageJson => {
}
};

const processTopics = topics =>
(topics || []).map(topic => topic.replace(/([ _])/g, '-').toLowerCase());

const createRepoDataWithResponse = (json, monorepo) => {
if (json.packageJson) {
const packageJson = JSON.parse(json.packageJson.text);

if (monorepo) {
json.homepageUrl = packageJson.homepage;
json.name = packageJson.name;
json.topics = packageJson.keywords;
json.topics = processTopics(packageJson.keywords);
json.description = packageJson.description;
json.licenseInfo = getLicenseFromPackageJson(packageJson);
}

if (!monorepo) {
json.topics = json.repositoryTopics.nodes.map(({ topic }) => topic.name);
json.topics = [
...new Set([
...processTopics(packageJson.keywords),
...processTopics(json.repositoryTopics.nodes.map(({ topic }) => topic.name)),
]),
];

if (!json.description) {
json.description = packageJson.description;
}

if (json.topics.length === 0) {
json.topics = packageJson.keywords;
}

if (!json.licenseInfo || (json.licenseInfo && json.licenseInfo.key === 'other')) {
json.licenseInfo = getLicenseFromPackageJson(packageJson) || json.licenseInfo;
}
Expand All @@ -266,9 +270,6 @@ const createRepoDataWithResponse = (json, monorepo) => {

const lastCommitAt = json.defaultBranchRef.target.history.nodes[0].committedDate;

const hasTopics = json.topics && json.topics.length > 0;
const topics = hasTopics ? json.topics.map(topic => topic.toLowerCase()) : [];

return {
urls: {
repo: json.url,
Expand All @@ -280,7 +281,7 @@ const createRepoDataWithResponse = (json, monorepo) => {
hasWiki: json.hasWikiEnabled,
hasPages: json.deployments.totalCount > 0,
hasDownloads: true,
hasTopics,
hasTopics: json.topics.length > 0,
updatedAt: lastCommitAt,
createdAt: json.createdAt,
pushedAt: lastCommitAt,
Expand All @@ -292,7 +293,7 @@ const createRepoDataWithResponse = (json, monorepo) => {
name: json.name,
fullName: json.nameWithOwner,
description: json.description,
topics,
topics: json.topics,
license: json.licenseInfo,
lastRelease: json.lastRelease,
hasTypes: json.types,
Expand Down