|
| 1 | +import orgPkg from '../../../../package.json'; |
| 2 | + |
| 3 | +export const htmlContent = ` |
| 4 | + <!DOCTYPE html> |
| 5 | + <html> |
| 6 | + <head> |
| 7 | + <meta charset="UTF-8"> |
| 8 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 9 | + <meta http-equiv="X-UA-Compatible" content="ie=edge"> |
| 10 | + <link rel="icon" href="/favicon.ico"> |
| 11 | + <title>TDesign</title> |
| 12 | + <!--[if lte IE 9]> |
| 13 | + <style> |
| 14 | + #app { |
| 15 | + display: none; |
| 16 | + } |
| 17 | + </style> |
| 18 | + <![endif]--> |
| 19 | + </head> |
| 20 | +
|
| 21 | + <body> |
| 22 | + <!--[if lte IE 9]> |
| 23 | + <h1 style="position: absolute; width: 100%; text-align:center; top: 45%">请使用 IE 10 以及更新版本的浏览器访问,建议使用 <a href="https://www.google.cn/chrome/">Chrome</a></h1> |
| 24 | + <![endif]--> |
| 25 | +
|
| 26 | + <div id="app"></div> |
| 27 | + </body> |
| 28 | +
|
| 29 | + </html> |
| 30 | +`; |
| 31 | + |
| 32 | +export const mainJsContent = ` |
| 33 | + import React from 'react'; |
| 34 | + import ReactDOM from 'react-dom/client'; |
| 35 | +
|
| 36 | + import Demo from './demo'; |
| 37 | + import './index.css'; |
| 38 | + import 'tdesign-mobile-react/es/style/index.css'; |
| 39 | +
|
| 40 | + const root = ReactDOM.createRoot(document.getElementById('app')); |
| 41 | +
|
| 42 | + root.render( |
| 43 | + <React.StrictMode> |
| 44 | + <Demo /> |
| 45 | + </React.StrictMode>, |
| 46 | + ); |
| 47 | +`; |
| 48 | + |
| 49 | +export const styleContent = ` |
| 50 | + /* 竖排展示 demo 行间距 16px */ |
| 51 | + .tdesign-demo-block-column { |
| 52 | + display: flex; |
| 53 | + flex-direction: column; |
| 54 | + row-gap: 16px; |
| 55 | + } |
| 56 | +
|
| 57 | + /* 竖排展示 demo 行间距 32px */ |
| 58 | + .tdesign-demo-block-column-large { |
| 59 | + display: flex; |
| 60 | + flex-direction: column; |
| 61 | + row-gap: 32px; |
| 62 | + } |
| 63 | +
|
| 64 | + /* 横排排展示 demo 列间距 16px */ |
| 65 | + .tdesign-demo-block-row { |
| 66 | + display: flex; |
| 67 | + column-gap: 16px; |
| 68 | + align-items: center; |
| 69 | + } |
| 70 | +`; |
| 71 | + |
| 72 | +export const tsconfigContent = `{ |
| 73 | + "compilerOptions": { |
| 74 | + "target": "es5", |
| 75 | + "lib": [ |
| 76 | + "dom", |
| 77 | + "dom.iterable", |
| 78 | + "esnext" |
| 79 | + ], |
| 80 | + "allowJs": true, |
| 81 | + "skipLibCheck": true, |
| 82 | + "esModuleInterop": true, |
| 83 | + "allowSyntheticDefaultImports": true, |
| 84 | + "strict": true, |
| 85 | + "forceConsistentCasingInFileNames": true, |
| 86 | + "noFallthroughCasesInSwitch": true, |
| 87 | + "module": "esnext", |
| 88 | + "moduleResolution": "node", |
| 89 | + "resolveJsonModule": true, |
| 90 | + "isolatedModules": true, |
| 91 | + "noEmit": true, |
| 92 | + "jsx": "react-jsx" |
| 93 | + }, |
| 94 | + "include": [ |
| 95 | + "src" |
| 96 | + ] |
| 97 | +} |
| 98 | +`; |
| 99 | + |
| 100 | +export const packageJSONContent = JSON.stringify( |
| 101 | + { |
| 102 | + name: 'tdesign-mobile-react-demo', |
| 103 | + version: '0.0.0', |
| 104 | + description: 'React example starter project', |
| 105 | + keywords: ['react', 'starter'], |
| 106 | + main: 'src/main.tsx', |
| 107 | + dependencies: { |
| 108 | + react: orgPkg.devDependencies.react, |
| 109 | + dayjs: orgPkg.dependencies.dayjs, |
| 110 | + 'react-dom': orgPkg.devDependencies['react-dom'], |
| 111 | + 'tdesign-mobile-react': orgPkg.version, |
| 112 | + 'tdesign-icons-react': orgPkg.dependencies['tdesign-icons-react'], |
| 113 | + '@types/react': orgPkg.devDependencies['@types/react'], |
| 114 | + '@types/react-dom': orgPkg.devDependencies['@types/react-dom'], |
| 115 | + }, |
| 116 | + devDependencies: { |
| 117 | + typescript: '^4.4.4', |
| 118 | + 'react-scripts': '^5.0.0', |
| 119 | + }, |
| 120 | + scripts: { |
| 121 | + start: 'react-scripts start', |
| 122 | + build: 'react-scripts build', |
| 123 | + test: 'react-scripts test --env=jsdom', |
| 124 | + eject: 'react-scripts eject', |
| 125 | + }, |
| 126 | + browserslist: ['>0.2%', 'not dead', 'not ie <= 11', 'not op_mini all'], |
| 127 | + }, |
| 128 | + null, |
| 129 | + 2, |
| 130 | +); |
0 commit comments