Skip to content

Commit

Permalink
[fix] some Type detail bugs (fix #45)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Sep 4, 2024
1 parent be56a0f commit eaddf79
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 18 deletions.
10 changes: 6 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { withSentryConfig } from '@sentry/nextjs';
import CopyPlugin from 'copy-webpack-plugin';
import { readdirSync, statSync } from 'fs';
import setPWA from 'next-pwa';
// @ts-ignore
import withLess from 'next-with-less';
import RemarkFrontMatter from 'remark-frontmatter';
import RemarkGfm from 'remark-gfm';
Expand All @@ -27,11 +28,10 @@ const withPWA = setPWA({
disable: isDev,
});

/** @type {import('next').NextConfig} */
const nextConfig = withPWA(
withLess(
withMDX({
output: CI && 'standalone',
output: CI ? 'standalone' : undefined,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
transpilePackages: ['@sentry/browser'],

Expand Down Expand Up @@ -60,7 +60,9 @@ const nextConfig = withPWA(
);
return config;
},
rewrites: () => ({
rewrites: async () => ({
beforeFiles: [],
afterFiles: [],
fallback: [
{
source: '/article/:path*',
Expand All @@ -81,7 +83,7 @@ const nextConfig = withPWA(

export default isDev || !SENTRY_AUTH_TOKEN
? nextConfig
: withSentryConfig(...nextConfig, {
: withSentryConfig(nextConfig, {
autoInstrumentServerFunctions: false,
org: SENTRY_ORG,
project: SENTRY_PROJECT,
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/preset-react": "^7.24.7",
"@types/lodash": "^4.17.7",
"@types/next-pwa": "^5.6.9",
"@types/node": "^20.16.3",
"@types/react": "^18.3.5",
"eslint": "^8.57.0",
Expand All @@ -66,7 +67,8 @@
"typescript": "~5.5.4"
},
"resolutions": {
"native-file-system-adapter": "npm:@tech_query/native-file-system-adapter@^3.0.1"
"native-file-system-adapter": "npm:@tech_query/native-file-system-adapter@^3.0.1",
"next": "$next"
},
"prettier": {
"singleQuote": true,
Expand Down
5 changes: 4 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ enableStaticRendering(isServer());
const { t } = i18n;

globalThis.addEventListener?.('unhandledrejection', ({ reason }) => {
const { message } = (reason || {}) as HTTPError;
var { message, response } = reason as HTTPError;
const { statusText, body } = response || {};

message = body?.message || statusText || message;

if (message) alert(message);
});
Expand Down
7 changes: 2 additions & 5 deletions pages/scroll-list.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Loading } from 'idea-react';
import { RepositoryModel } from 'mobx-github';
import { GitRepository, RepositoryModel } from 'mobx-github';
import { observer } from 'mobx-react';
import { ScrollList } from 'mobx-restful-table';
import { InferGetServerSidePropsType } from 'next';
import { cache, compose, errorLogger, translator } from 'next-ssr-middleware';
import { FC } from 'react';
import { Col, Container, Row } from 'react-bootstrap';
Expand All @@ -23,9 +22,7 @@ export const getServerSideProps = compose(
},
);

const ScrollListPage: FC<
InferGetServerSidePropsType<typeof getServerSideProps>
> = observer(({ list }) => (
const ScrollListPage: FC<{ list: GitRepository[] }> = observer(({ list }) => (
<Container>
<PageHead title={i18n.t('scroll_list')} />

Expand Down
40 changes: 36 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ES6",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
Expand All @@ -15,8 +16,8 @@
"downlevelIteration": true,
"useDefineForClassFields": true,
"jsx": "preserve",
"incremental": true,
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.mjs", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

1 comment on commit eaddf79

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for next-bootstrap-ts ready!

✅ Preview
https://next-bootstrap-4gi3bwb0z-stevending1sts-projects.vercel.app

Built with commit eaddf79.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.