Skip to content

Commit 4e49515

Browse files
authored
alter home page redirect, deps bump, libraries cleanup (#2338)
1 parent 61ba5c2 commit 4e49515

File tree

8 files changed

+138
-107
lines changed

8 files changed

+138
-107
lines changed

.oxlintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"ts-nocheck": true
145145
}
146146
],
147+
"typescript/consistent-indexed-object-style": ["error", "record"],
147148
"typescript/consistent-type-imports": [
148149
"error",
149150
{
@@ -177,7 +178,6 @@
177178
"typescript/unbound-method": "off",
178179
"unicorn/consistent-date-clone": "error",
179180
"unicorn/consistent-empty-array-spread": "error",
180-
"unicorn/consistent-indexed-object-style": ["error", "record"],
181181
"unicorn/consistent-existence-index-check": "error",
182182
"unicorn/error-message": "error",
183183
"unicorn/no-anonymous-default-export": "error",

bun.lock

Lines changed: 106 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@radix-ui/react-hover-card": "^1.1.15",
2828
"@radix-ui/react-tooltip": "^1.2.8",
2929
"@react-native-picker/picker": "^2.11.4",
30-
"@sentry/react": "^10.46.0",
30+
"@sentry/react": "^10.47.0",
3131
"@visx/gradient": "^3.12.0",
3232
"@visx/responsive": "^3.12.0",
3333
"@visx/xychart": "^3.12.0",
@@ -67,16 +67,16 @@
6767
"@types/semver": "^7.7.1",
6868
"@vercel/blob": "^0.27.3",
6969
"ajv-cli": "^5.0.0",
70-
"browserslist": "^4.28.1",
70+
"browserslist": "^4.28.2",
7171
"cheerio": "^1.2.0",
7272
"dotenv": "^17.3.1",
7373
"lint-staged": "^16.4.0",
7474
"next-compose-plugins": "^2.2.1",
7575
"next-fonts": "^1.5.1",
7676
"next-images": "^1.8.5",
77-
"oxfmt": "^0.42.0",
78-
"oxlint": "^1.57.0",
79-
"oxlint-tsgolint": "^0.17.4",
77+
"oxfmt": "^0.43.0",
78+
"oxlint": "^1.58.0",
79+
"oxlint-tsgolint": "^0.18.1",
8080
"simple-git-hooks": "^2.13.1",
8181
"typescript": "^6.0.2",
8282
"user-agent-data-types": "^0.4.3"

pages/index.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { cloneDeep } from 'es-toolkit/object';
2-
import { type NextPageContext } from 'next';
2+
import { type GetServerSidePropsContext } from 'next';
33

44
import HomeScene from '~/scenes/HomeScene';
55
import { type HomePageProps } from '~/types/pages';
@@ -12,13 +12,14 @@ function Index(props: HomePageProps) {
1212

1313
const LIMIT = 8;
1414

15-
Index.getInitialProps = async (ctx: NextPageContext) => {
16-
if (ctx.res && ctx.query && Object.keys(ctx.query).length > 0) {
17-
ctx.res.writeHead(302, {
18-
Location: urlWithQuery('/packages', ctx.query),
19-
});
20-
ctx.res.end();
21-
return;
15+
export async function getServerSideProps(ctx: GetServerSidePropsContext) {
16+
if (Object.keys(ctx.query).length > 0) {
17+
return {
18+
redirect: {
19+
destination: urlWithQuery('/packages', ctx.query),
20+
permanent: false,
21+
},
22+
};
2223
}
2324

2425
const mostDownloadedResponse = await ssrFetch(
@@ -56,12 +57,14 @@ Index.getInitialProps = async (ctx: NextPageContext) => {
5657
const statisticResponse = await ssrFetch('/libraries/statistic', {}, ctx);
5758

5859
return {
59-
mostDownloaded: await mostDownloadedResponse.json(),
60-
recentlyAdded: await recentlyAddedResponse.json(),
61-
recentlyUpdated: await recentlyUpdatedResponse.json(),
62-
popular: await popularResponse.json(),
63-
statistic: await statisticResponse.json(),
60+
props: {
61+
mostDownloaded: await mostDownloadedResponse.json(),
62+
recentlyAdded: await recentlyAddedResponse.json(),
63+
recentlyUpdated: await recentlyUpdatedResponse.json(),
64+
popular: await popularResponse.json(),
65+
statistic: await statisticResponse.json(),
66+
},
6467
};
65-
};
68+
}
6669

6770
export default Index;

react-native-libraries.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5217,12 +5217,6 @@
52175217
"expoGo": true,
52185218
"unmaintained": true
52195219
},
5220-
{
5221-
"githubUrl": "https://github.com/aprock/react-native-os",
5222-
"ios": true,
5223-
"android": true,
5224-
"expoGo": true
5225-
},
52265220
{
52275221
"githubUrl": "https://github.com/tradle/react-native-level-fs",
52285222
"ios": true,
@@ -18088,7 +18082,7 @@
1808818082
"newArchitecture": true
1808918083
},
1809018084
{
18091-
"githubUrl": "https://github.com/tristanmanchester/react-native-dotgrid",
18085+
"githubUrl": "https://github.com/tristanmanchester/react-native-dotgrid/tree/main/packages/react-native-dotgrid",
1809218086
"examples": ["https://github.com/tristanmanchester/react-native-dotgrid/tree/main/example"],
1809318087
"images": [
1809418088
"https://raw.githubusercontent.com/tristanmanchester/react-native-dotgrid/main/demos/wave.webp",
@@ -20212,16 +20206,6 @@
2021220206
"ios": true,
2021320207
"android": true
2021420208
},
20215-
{
20216-
"githubUrl": "https://github.com/mohamed2m2018/react-native-agentic-ai",
20217-
"examples": [
20218-
"https://github.com/mohamed2m2018/react-native-agentic-ai/tree/main/example-ai-testing",
20219-
"https://github.com/mohamed2m2018/react-native-agentic-ai/tree/main/example-expo-router",
20220-
"https://github.com/mohamed2m2018/react-native-agentic-ai/tree/main/example-react-navigation"
20221-
],
20222-
"ios": true,
20223-
"android": true
20224-
},
2022520209
{
2022620210
"githubUrl": "https://github.com/usl-dev/react-intl-phone-username-input",
2022720211
"examples": [
@@ -20288,7 +20272,6 @@
2028820272
},
2028920273
{
2029020274
"githubUrl": "https://github.com/alicanov98/react-native-debug-logger",
20291-
"npmPkg": "react-native-debug-logger",
2029220275
"ios": true,
2029320276
"android": true
2029420277
},

scripts/build-and-score-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const DATASET: LibraryDataEntryType[] = USE_DEBUG_REPOS ? debugGithubRepos : git
3434
const DATA_PATH = path.resolve('assets', 'data.json');
3535
const CHECK_DATA_PATH = path.resolve('assets', 'check-data.json');
3636

37-
const CHUNK_SIZE = 20;
37+
const CHUNK_SIZE = 25;
3838
const NPM_STATS_CHUNK_SIZE = 10;
3939
const SLEEP_TIME = 500;
4040

util/SSRFetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type NextPageContext } from 'next';
1+
import { type GetServerSidePropsContext, type NextPageContext } from 'next';
22

33
import { type Query } from '~/types';
44
import { NEXT_1H_CACHE_HEADER } from '~/util/Constants';
@@ -8,7 +8,7 @@ import urlWithQuery from '~/util/urlWithQuery';
88
export async function ssrFetch(
99
url: string,
1010
query: Partial<Query>,
11-
ctx: NextPageContext
11+
ctx: NextPageContext | GetServerSidePropsContext
1212
): Promise<Response> {
1313
return await fetch(getApiUrl(urlWithQuery(url, query), ctx), NEXT_1H_CACHE_HEADER);
1414
}

util/getApiUrl.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { type NextPageContext } from 'next';
1+
import { type GetServerSidePropsContext, type NextPageContext } from 'next';
22

3-
export default function getApiUrl(path: string, { req }: NextPageContext) {
3+
export default function getApiUrl(
4+
path: string,
5+
{ req }: NextPageContext | GetServerSidePropsContext
6+
) {
47
if (!req && typeof window !== 'undefined') {
58
return `/api${path}`;
69
}

0 commit comments

Comments
 (0)