Skip to content

Commit 3bf3be3

Browse files
committed
chore: add demo
1 parent 7dc69b2 commit 3bf3be3

File tree

98 files changed

+9353
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+9353
-144
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
/lerna-debug.log

example/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/babel", "next/core-web-vitals"]
3+
}

example/.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
/public/cesium
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env.local
30+
.env.development.local
31+
.env.test.local
32+
.env.production.local
33+
34+
# vercel
35+
.vercel
36+
37+
# typescript
38+
*.tsbuildinfo
39+
40+
# 静态文件
41+
/static
42+
43+
# service-worker.js
44+
/public/service-worker.js
45+
/public/workbox-*.js

example/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
12+
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14+
15+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
16+
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

example/next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

example/next.config.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/** @type {import('next').NextConfig} */
2+
const semi = require('@douyinfe/semi-next').default({});
3+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
4+
const CopyWebpackPlugin = require('copy-webpack-plugin')
5+
const path = require('path');
6+
7+
const nextConfig = semi({
8+
webpack: (config, { webpack, dev, isServer }) => {
9+
config.resolve.plugins.push(new TsconfigPathsPlugin());
10+
try{
11+
config.externals.cesium = "Cesium";
12+
} catch {
13+
config.externals = {
14+
cesium: "Cesium",
15+
};
16+
}
17+
18+
if(isServer){
19+
config.plugins.push(new CopyWebpackPlugin({
20+
patterns: [{
21+
from: path.join(__dirname, (dev ?
22+
"node_modules/cesium/Build/CesiumUnminified/" :
23+
"node_modules/cesium/Build/Cesium/")),
24+
to: path.join(__dirname, "public/cesium"),
25+
},]
26+
}));
27+
}
28+
config.plugins.push(new webpack.DefinePlugin({
29+
CESIUM_BASE_URL: JSON.stringify("./cesium"),
30+
}));
31+
return config;
32+
},
33+
eslint: {
34+
ignoreDuringBuilds: true,
35+
},
36+
// FIXME: douyinfe 的第三方包存在 ts 类型错误!
37+
typescript: {
38+
ignoreBuildErrors: true,
39+
},
40+
})
41+
42+
module.exports = nextConfig;

example/package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "example",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"@douyinfe/semi-icons": "^2.25.1",
13+
"@douyinfe/semi-next": "^2.25.1",
14+
"@douyinfe/semi-ui": "^2.25.1",
15+
"@next/font": "13.0.7",
16+
"@types/node": "18.11.17",
17+
"@types/react": "18.0.26",
18+
"@types/react-color": "^3.0.6",
19+
"@types/react-dom": "18.0.9",
20+
"ahooks": "^3.7.2",
21+
"cesium": "^1.99.0",
22+
"classnames": "^2.3.2",
23+
"eslint": "8.30.0",
24+
"eslint-config-next": "13.0.7",
25+
"lodash": "^4.17.21",
26+
"next": "13.0.7",
27+
"react": "18.2.0",
28+
"react-color": "^2.19.3",
29+
"react-dom": "18.2.0",
30+
"react-sortable-hoc": "^2.0.0",
31+
"tiff-imagery-provider": "workspace:^1.0.1",
32+
"typescript": "4.8.4"
33+
},
34+
"devDependencies": {
35+
"@types/lodash": "^4.14.191",
36+
"copy-webpack-plugin": "^11.0.0",
37+
"tsconfig-paths-webpack-plugin": "^4.0.0"
38+
}
39+
}

example/pages/_app.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import '../styles/globals.scss';
2+
import App from 'next/app';
3+
import { Theme } from '@/hooks/use-theme';
4+
import { UrlStateHook } from '@/hooks/use-search';
5+
6+
class MyApp extends App {
7+
8+
render() {
9+
const { Component, pageProps } = this.props;
10+
11+
return (
12+
<UrlStateHook.Provider>
13+
<Theme.Provider>
14+
<Component {...pageProps} />
15+
</Theme.Provider>
16+
</UrlStateHook.Provider>
17+
);
18+
}
19+
}
20+
21+
export default MyApp;

example/pages/index.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defaultLoading } from "@/components/Loading";
2+
import { NextPage } from "next";
3+
import dynamic from "next/dynamic";
4+
5+
const Earth = dynamic(() => import('@/components/Earth'),
6+
{
7+
loading: () => defaultLoading,
8+
ssr: false
9+
}
10+
)
11+
12+
const Platform: NextPage = () => {
13+
14+
return (
15+
<Earth />
16+
)
17+
}
18+
19+
export default Platform

example/public/favicon.ico

25.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)