Quellcode durchsuchen

:tada: create frontend project

Jeremy Zheng vor 5 Jahren
Ursprung
Commit
1f35848e46

+ 16 - 0
dashboard/.editorconfig

@@ -0,0 +1,16 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[Makefile]
+indent_style = tab

+ 9 - 0
dashboard/.gitignore

@@ -0,0 +1,9 @@
+# dependencies
+/node_modules/
+/yarn.lock
+
+# production
+/dist/
+
+# umi
+/src/.umi

+ 8 - 0
dashboard/.prettierignore

@@ -0,0 +1,8 @@
+**/*.md
+**/*.svg
+**/*.ejs
+**/*.html
+package.json
+.umi
+.umi-production
+.umi-test

+ 11 - 0
dashboard/.prettierrc

@@ -0,0 +1,11 @@
+{
+  "singleQuote": true,
+  "trailingComma": "all",
+  "printWidth": 80,
+  "overrides": [
+    {
+      "files": ".prettierrc",
+      "options": { "parser": "json" }
+    }
+  ]
+}

+ 10 - 0
dashboard/.umirc.ts

@@ -0,0 +1,10 @@
+import { defineConfig } from 'umi';
+
+export default defineConfig({
+  nodeModulesTransform: {
+    type: 'none',
+  },
+  routes: [
+    { path: '/', component: '@/pages/index' },
+  ],
+});

+ 0 - 0
dashboard/mock/.gitkeep


+ 32 - 0
dashboard/package.json

@@ -0,0 +1,32 @@
+{
+  "private": true,
+  "scripts": {
+    "start": "umi dev",
+    "build": "umi build",
+    "postinstall": "umi generate tmp",
+    "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
+    "test": "umi-test",
+    "test:coverage": "umi-test --coverage"
+  },
+  "gitHooks": {
+    "pre-commit": "lint-staged"
+  },
+  "lint-staged": {
+    "*.{js,jsx,less,md,json}": [
+      "prettier --write"
+    ],
+    "*.ts?(x)": [
+      "prettier --parser=typescript --write"
+    ]
+  },
+  "dependencies": {
+    "@umijs/preset-react": "1.x",
+    "@umijs/test": "^3.2.3",
+    "lint-staged": "^10.0.7",
+    "prettier": "^1.19.1",
+    "react": "^16.12.0",
+    "react-dom": "^16.12.0",
+    "umi": "^3.2.3",
+    "yorkie": "^2.0.0"
+  }
+}

+ 7 - 0
dashboard/src/pages/index.less

@@ -0,0 +1,7 @@
+
+.normal {
+}
+
+.title {
+  background: rgb(121, 242, 157);
+}

+ 10 - 0
dashboard/src/pages/index.tsx

@@ -0,0 +1,10 @@
+import React from 'react';
+import styles from './index.less';
+
+export default () => {
+  return (
+    <div>
+      <h1 className={styles.title}>Page index</h1>
+    </div>
+  );
+}

+ 25 - 0
dashboard/tsconfig.json

@@ -0,0 +1,25 @@
+{
+  "compilerOptions": {
+    "target": "esnext",
+    "module": "esnext",
+    "moduleResolution": "node",
+    "importHelpers": true,
+    "jsx": "react",
+    "esModuleInterop": true,
+    "sourceMap": true,
+    "baseUrl": "./",
+    "strict": true,
+    "paths": {
+      "@/*": ["src/*"],
+      "@@/*": ["src/.umi/*"]
+    },
+    "allowSyntheticDefaultImports": true
+  },
+  "include": [
+    "mock/**/*",
+    "src/**/*",
+    "config/**/*",
+    ".umirc.ts",
+    "typings.d.ts"
+  ]
+}

+ 8 - 0
dashboard/typings.d.ts

@@ -0,0 +1,8 @@
+declare module '*.css';
+declare module '*.less';
+declare module "*.png";
+declare module '*.svg' {
+  export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
+  const url: string
+  export default url
+}