Skip to content

Commit 6a23255

Browse files
authored
refactor: migrate site to nutui-react (#2955)
* feat: save my migrate progress * feat: css transition add list * feat: save search component progress * feat: save search component progress * feat: save taro some logics * feat: save lang switch * feat: save some guide and routes logics * feat: save some guide and routes logics * feat: save some guide and routes logics * feat: save some guide & guideTaro routes logics * fix: 重置Nav Tab刷新逻辑 * chore: delete some logs * feat: save some backtop logics * refactor: 打包结构初始配置 * fix: site start vite config * fix: adjust dir * fix: extract taro basic structure * fix: vite taro site 启动入口修复 * fix: change from spa to routes 分离 * fix: header import failed * fix: taro doc build failed * fix: test build h5 demo routes * feat: taro site构建流程 * fix: add redirect link to resolve empty page bug * fix: resolve tabs activeName incorrect * fix: resolve conflicts * fix: build error * fix: build error * refactor: 简化site启动方式并更新相关的E2E测试配置 * chore: 简化本地开发方式,移除vite冗余配置 * fix: e2e url * fix: remove pics * fix: remove useless files * fix: remove useless files * fix: code highlight * chore: resolve conflict s * chore: remove harmony.css files * chore: remove harmony.css files and add git ignore file * chore: update selected version * chore: update docs
1 parent 4d38121 commit 6a23255

File tree

102 files changed

+9649
-1321
lines changed

Some content is hidden

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

102 files changed

+9649
-1321
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ node_modules
66
.npmrc
77
/dist
88
/dist-demo
9+
/dist-site
910
/release
1011
/libs
1112
/jd/upload.js
@@ -53,4 +54,7 @@ pnpm-lock.*.yaml
5354
*.sw?
5455

5556
# vitest
56-
/html
57+
/html
58+
59+
# Harmony CSS files
60+
src/packages/**/*.harmony.css

cypress/e2e/h5/index.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import { checkH5Blank } from '../common/pageWhiteTest.cy'
88
// import './exhibition.cy'
99
// import './feedback.cy'
1010

11-
describe('All Taro Demos White Page Test', () => {
11+
describe('All H5 Demos White Page Test', () => {
1212
checkH5Blank()
1313
})

cypress/e2e/utils/visit-demo.cy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const visitH5Demo = (componentName, delay = 500) => {
2-
const getPath = () => `${Cypress.env('baseUrl')}${componentName}`
2+
const getPath = () =>
3+
`http://localhost:5173/react/demo.html#/zh-CN/component/${componentName.toLowerCase()}`
34
cy.visit(getPath(componentName), {
45
onBeforeLoad: (win) => {
56
Object.defineProperty(win.navigator, 'userAgent', {

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
continue.</strong>
5050
</noscript>
5151
<div id="doc"></div>
52-
<script type="module" src="/src/sites/doc/main.tsx"></script>
52+
<script type="module" src="/src/sites/sites-react/doc/main.tsx"></script>
5353
<script>
5454
//分享配置
5555
var shareOption = {

index.taro.html

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>NutUI - 移动端React组件库</title>
6+
<meta content="telephone=no" name="format-detection" />
7+
<link rel="dns-prefetch" href="//wl.jd.com">
8+
<link rel="dns-prefetch" href="//h5.m.jd.com">
9+
<link rel="dns-prefetch" href="//img14.360buyimg.com">
10+
<link rel="dns-prefetch" href="//img10.360buyimg.com">
11+
<link rel="dns-prefetch" href="//mercury.jd.com">
12+
<link rel="dns-prefetch" href="//stream-outside.jd.com">
13+
<link rel="dns-prefetch" href="//static.hotjar.com">
14+
<link rel="shortcut icon"
15+
href="//img14.360buyimg.com/imagetools/jfs/t1/167902/2/8762/791358/603742d7E9b4275e3/e09d8f9a8bf4c0ef.png" />
16+
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
17+
<script src="//h5.m.jd.com/babelDiy/Zeus/2846ykuM7PwipD9E2RzMj2BGEQpA/plugin/share.min.js"></script>
18+
<style>
19+
html {
20+
background: #f7f7f7;
21+
}
22+
23+
a[title="站长统计"] {
24+
display: none;
25+
}
26+
</style>
27+
<!-- Hotjar Tracking Code for nutui.jd.com -->
28+
<script async>
29+
(function (h, o, t, j, a, r) {
30+
h.hj =
31+
h.hj ||
32+
function () {
33+
(h.hj.q = h.hj.q || []).push(arguments);
34+
};
35+
h._hjSettings = { hjid: 1900179, hjsv: 6 };
36+
a = o.getElementsByTagName("head")[0];
37+
r = o.createElement("script");
38+
r.async = 1;
39+
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
40+
a.appendChild(r);
41+
})(window, document, "//static.hotjar.com/c/hotjar-", ".js?sv=");
42+
</script>
43+
</head>
44+
45+
<body>
46+
<noscript>
47+
<strong>We're sorry but it doesn't work
48+
properly without JavaScript enabled. Please enable it to
49+
continue.</strong>
50+
</noscript>
51+
<div id="doc"></div>
52+
<script type="module" src="/src/sites/sites-react/doc-taro/main.tsx"></script>
53+
<script>
54+
//分享配置
55+
var shareOption = {
56+
iconUrl: "https://nutui.jd.com/img/logo_share.png",
57+
url: "https://nutui.jd.com/demo.html#/index",
58+
title: "轻量级移动端Vue组件库 - NutUI 3.0",
59+
desc: "京东风格的Vue组件库",
60+
};
61+
62+
try {
63+
/*初始化分享*/
64+
share.shareInit(shareOption);
65+
} catch (e) {
66+
console.log(e);
67+
}
68+
</script>
69+
<script type="text/javascript">
70+
var jaq = jaq || [];
71+
jaq.push(["account", "JA2018_1831300"]);
72+
jaq.push(["domain", "jd.com"]);
73+
(function () {
74+
var ja = document.createElement("script");
75+
ja.type = "text/javascript";
76+
ja.async = true;
77+
ja.src = "//wl.jd.com/joya.js";
78+
var s = document.getElementsByTagName("script")[0];
79+
s.parentNode.insertBefore(ja, s);
80+
})();
81+
</script>
82+
<script type="text/javascript" src="//s23.cnzz.com/z_stat.php?id=1276268086&web_id=1276268086"></script>
83+
</body>
84+
85+
</html>

package.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@
6868
"build": "node ./scripts/replace-css-var.js && npm run checked && node scripts/build.mjs",
6969
"build:taro": "node ./scripts/replace-css-var.js && npm run checked:taro && node scripts/build-taro.mjs",
7070
"build:taro:jmapp": "npm run checked:taro && VITE_APP_PROJECT_ID=jmapp node scripts/build-taro.mjs",
71-
"build:site": "npm run checked && vite build --config vite.config.site.mts",
72-
"build:site:jmapp": "npm run checked && VITE_APP_PROJECT_ID=jmapp vite build",
73-
"prebuild:taro:site": "pnpm run update:taro:entry",
74-
"build:taro:site": "npm run checked:taro && npm run generate:file:taro:pages && pnpm --dir ./packages/nutui-taro-demo build:h5",
75-
"build:jdtaro:site": "npm run checked:taro && npm run generate:file:taro:pages && JD=1 pnpm --dir ./packages/nutui-taro-demo build:h5",
76-
"build:taro:site:jmapp": "npm run checked:taro && VITE_APP_PROJECT_ID=jmapp npm run generate:file:taro:pages && pnpm --dir ./packages/nutui-taro-demo build:h5",
77-
"build:jdtaro:site:jmapp": "npm run checked:taro && VITE_APP_PROJECT_ID=jmapp npm run generate:file:taro:pages && JD=1 pnpm --dir ./packages/nutui-taro-demo build:h5",
71+
"build:demo": "npm run checked && vite build --config vite.config.demo.ts",
72+
"build:demo:jmapp": "npm run checked && VITE_APP_PROJECT_ID=jmapp vite build",
73+
"prebuild:taro:demo": "SKIPDD=1 pnpm run update:taro:entry",
74+
"build:taro:demo": "npm run checked:taro && npm run generate:file:taro:pages && pnpm --dir ./packages/nutui-taro-demo build:h5",
75+
"build:site": "vite build --config vite.config.site.mts",
76+
"build:taro:site": "vite build --config vite.config.site.taro.mts && node ./scripts/rename.js",
77+
"build:jdtaro:demo": "npm run checked:taro && npm run generate:file:taro:pages && JD=1 pnpm --dir ./packages/nutui-taro-demo build:h5",
78+
"build:taro:demo:jmapp": "npm run checked:taro && VITE_APP_PROJECT_ID=jmapp npm run generate:file:taro:pages && pnpm --dir ./packages/nutui-taro-demo build:h5",
79+
"build:jdtaro:demo:jmapp": "npm run checked:taro && VITE_APP_PROJECT_ID=jmapp npm run generate:file:taro:pages && JD=1 pnpm --dir ./packages/nutui-taro-demo build:h5",
7880
"generate:file": "node scripts/generate-nutui.js",
7981
"generate:themes": "node scripts/generate-themes.js",
8082
"generate:themes-dev": "node scripts/generate-themes-dev.js",
@@ -86,12 +88,12 @@
8688
"publish:beta": "npm publish --tag beta",
8789
"test": "vitest --coverage",
8890
"test:ui": "vitest --ui --coverage",
89-
"cypress:run": "cypress run --env baseUrl=http://localhost:5173/react/demo.html#/zh-CN/component/ --spec 'cypress/e2e/h5/index.cy.js'",
90-
"cypress:open": "cypress open --env baseUrl=http://localhost:5173/react/demo.html#/zh-CN/component/ 'cypress/e2e/h5/index.cy.js'",
91+
"cypress:run": "cypress run --spec 'cypress/e2e/h5/index.cy.js'",
92+
"cypress:open": "cypress open 'cypress/e2e/h5/index.cy.js'",
9193
"cypress:run:taro": "cypress run --env baseUrl=http://localhost:10086/#/ --spec 'cypress/e2e/taro/index.cy.js'",
9294
"cypress:open:taro": "cypress open --env baseUrl=http://localhost:10086/#/ 'cypress/e2e/taro/index.cy.js'",
93-
"e2e:run:h5": "start-server-and-test dev http://localhost:5173/ cypress:run",
94-
"e2e:open:h5": "start-server-and-test dev http://localhost:5173/ cypress:open",
95+
"e2e:run:h5": "start-server-and-test dev http://localhost:5173/react/ cypress:run",
96+
"e2e:open:h5": "start-server-and-test dev http://localhost:5173/react/ cypress:open",
9597
"e2e:run:taro": "start-server-and-test dev:taro:h5 http://localhost:10086 cypress:run:taro",
9698
"e2e:open:taro": "start-server-and-test dev:taro:h5 http://localhost:10086 cypress:open:taro",
9799
"update:taro:entry": "node ./scripts/harmony/update-taro-entry",
@@ -112,16 +114,18 @@
112114
"@use-gesture/react": "10.2.20",
113115
"async-validator": "^4.2.5",
114116
"classnames": "^2.5.1",
115-
"react-fast-compare": "^3.2.2",
116117
"lodash.kebabcase": "^4.1.1",
117118
"lottie-miniprogram": "^1.0.12",
118119
"lottie-react": "^2.4.0",
119-
"react-transition-group": "^4.4.5"
120+
"react-fast-compare": "^3.2.2",
121+
"react-transition-group": "^4.4.5",
122+
"rehype-highlight": "^7.0.2"
120123
},
121124
"devDependencies": {
122125
"@babel/plugin-proposal-class-properties": "^7.18.6",
123126
"@commitlint/cli": "^19.0.3",
124127
"@commitlint/config-conventional": "^19.0.3",
128+
"@inquirer/prompts": "^7.2.3",
125129
"@loadable/component": "^5.16.3",
126130
"@mdx-js/mdx": "^3.0.1",
127131
"@mdx-js/react": "^3.0.1",
@@ -131,6 +135,7 @@
131135
"@rollup/plugin-commonjs": "^26.0.1",
132136
"@rollup/plugin-node-resolve": "16.0.0",
133137
"@rollup/plugin-typescript": "^11.1.6",
138+
"@shikijs/markdown-it": "^3.0.0",
134139
"@swc/core": "^1.4.8",
135140
"@tarojs/components": "4.0.8-beta.1",
136141
"@tarojs/plugin-platform-alipay": "4.0.8-beta.1",
@@ -156,7 +161,6 @@
156161
"@vitejs/plugin-react": "^4.2.1",
157162
"@vitest/coverage-v8": "^2.0.4",
158163
"@vitest/ui": "^2.0.4",
159-
"@inquirer/prompts":"^7.2.3",
160164
"autoprefixer": "^10.4.17",
161165
"axios": "^1.6.7",
162166
"cypress": "^13.15.0",

0 commit comments

Comments
 (0)