Skip to content

Commit

Permalink
【docs】chore: Update next、react version, support netlify (#250)
Browse files Browse the repository at this point in the history
* Update next version, support netlify (#2)

* chore: support netlify

* chore: support netlify
  • Loading branch information
yazhouio authored Jun 18, 2024
1 parent 8fdb001 commit ecd4526
Show file tree
Hide file tree
Showing 15 changed files with 6,815 additions and 6,725 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_OPTIONS=--openssl-legacy-provider
I18NEXT_DEFAULT_CONFIG_PATH=/var/task/docs/next-i18next.config.cjs
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
15 changes: 0 additions & 15 deletions docs/.babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions docs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_OPTIONS=--openssl-legacy-provider
I18NEXT_DEFAULT_CONFIG_PATH=/var/task/docs/next-i18next.config.cjs
2 changes: 1 addition & 1 deletion docs/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
4 changes: 1 addition & 3 deletions docs/lib/components/SideMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ export default function SideMenu({ title, category, menu, slug }: SideMenuProps)
const kebabMenu = kebabCase(item);
return (
<li key={item} className={cx({ active: slug === kebabMenu })}>
<Link href={`/${category}/${kebabMenu}`}>
<a>{t(item)}</a>
</Link>
<Link href={`/${category}/${kebabMenu}`}>{t(item)}</Link>
</li>
);
})}
Expand Down
6 changes: 3 additions & 3 deletions docs/lib/layouts/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const TopMenu = styled.div`
}
`;

const TopMenuItem = styled.a`
const TopMenuItem = styled.span`
color: #eff4f9;
&:hover {
Expand Down Expand Up @@ -114,8 +114,8 @@ const TopBar = ({ isHome = true, isScroll = false }: TopBarProps) => {
<TopMenu>
<Group style={{ marginRight: '70px' }} spacing={20}>
{menus.map((menu) => (
<Link href={`/${menu.value}`} key={menu.value}>
<a className="topmenu-item">{t(menu.label)}</a>
<Link href={`/${menu.value}`} key={menu.value} className="topmenu-item">
{t(menu.label)}
</Link>
))}
</Group>
Expand Down
4 changes: 3 additions & 1 deletion docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');

/** @type {import('next-i18next').UserConfig} */
module.exports = {
i18n: {
defaultLocale: 'en',
Expand Down
30 changes: 21 additions & 9 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
const withPlugins = require('next-compose-plugins');
const withTM = require('next-transpile-modules')([
'@kubed/components',
'@kubed/hooks',
'@kubed/hooks',
'rehype-react',
'hast-to-hyperscript',
]);
const { i18n } = require('./next-i18next.config');
// const withTM = require('next-transpile-modules')([
// '@kubed/components',
// '@kubed/hooks',
// '@kubed/hooks',
// 'rehype-react',
// 'hast-to-hyperscript',
// ]);
process.env.I18NEXT_DEFAULT_CONFIG_PATH = `${__dirname}/next-i18next.config.cjs`;

module.exports = withPlugins([withTM], {
const { i18n } = require('./next-i18next.config.cjs');

module.exports = withPlugins([], {
transpilePackages: ['@kubed/components', '@kubed/hooks', '@kubed/hooks'],
reactStrictMode: false,
i18n,
experimental: {
forceSwcTransforms: true,
},
compiler: {
styledComponents: true,
},
typescript: {
ignoreBuildErrors: true,
},
async redirects() {
return [
{
Expand Down
17 changes: 10 additions & 7 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"fs-extra": "^10.0.0",
"gray-matter": "^4.0.3",
"lodash": "^4.17.21",
"next": "11.0.1",
"next-i18next": "^8.6.0",
"next": "14.2.4",
"next-i18next": "15.3.0",
"react-i18next": "14.1.2",
"i18next": "23.11.5",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-feather": "^2.0.9",
"react-live": "^2.3.0",
"react-simple-code-editor": "^0.11.0",
Expand All @@ -34,13 +36,14 @@
"rehype-toc2": "^0.0.5"
},
"devDependencies": {
"@types/react": "^17.0.8",
"babel-plugin-styled-components": "^1.13.2",
"eslint": "^7.27.0",
"eslint-config-next": "11.0.1",
"next-compose-plugins": "^2.2.1",
"next-mdx-remote": "^3.0.2",
"next-transpile-modules": "^8.0.0",
"typescript": "^4.3.5"
"typescript": "^4.5.2",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18"
}
}
21 changes: 15 additions & 6 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{
"extends": "../tsconfig.json",
// "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../packages/**/*.tsx"],
// "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../packages/**/*.tsx"],
"compilerOptions": {
"paths": {
"@docs/demos": ["./docs/src/demos"],
"@kubed/*": ["packages/*/src"],
// "@demos/*": ["packages/*/src/demos"]
"@docs/demos": [
"./docs/src/demos"
],
"@kubed/*": [
"packages/*/src"
]
// "@demos/*": ["packages/*/src/demos"]
},
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
Expand All @@ -20,6 +28,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"noImplicitAny": false
"noImplicitAny": false,
"incremental": true
}
}
23 changes: 23 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[functions]
included_files = ["docs/next-i18next.config.cjs", "docs/public/locales/**"]


[[plugins]]
package = "@netlify/plugin-nextjs"


[build]
base = "/"
command = "npm run build:docs"
publish = "docs/.next"


# Netlify configuration
# Runtime Next.js
# Base directory /
# Package directory /docs
# Build command npm run build:docs
# Publish directory /docs/.next
# Functions directory /netlify/functions
# Deploy log visibility Logs are public
# Build status Active
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"license": "MIT",
"scripts": {
"start:docs": "cd ./docs && npm run dev",
"build:docs": "cd ./docs && npm run build",
"postinstall": "npm run docs:docgen && npm run build:icons",
"syncpack": "syncpack list-mismatches",
"typecheck": "tsc --noEmit",
Expand Down Expand Up @@ -77,7 +78,7 @@
"open": "^8.2.0",
"prettier": "^2.3.2",
"react-docgen-typescript": "2.1.0",
"react-dom": "^17.0.2",
"react-dom": "^18.3.1",
"rimraf": "^3.0.2",
"rollup": "^2.50.5",
"rollup-plugin-esbuild": "^4.2.3",
Expand All @@ -94,7 +95,7 @@
"dayjs": "^1.10.7",
"prism-react-renderer": "^1.2.1",
"lodash": "^4.17.21",
"react": "^17.0.2",
"react": "^18.3.1",
"react-router-dom": "^5.2.0",
"styled-components": "^5.3.0"
},
Expand Down
Loading

0 comments on commit ecd4526

Please sign in to comment.