Skip to content

Commit

Permalink
feat(klever-web): init data
Browse files Browse the repository at this point in the history
  • Loading branch information
hewenguang committed Nov 4, 2020
1 parent 84de7f9 commit b2cdf3d
Show file tree
Hide file tree
Showing 14 changed files with 13,471 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/node_modules
/npm-debug.log*
/yarn-error.log
/package-lock.json

.DS_Store
node_modules
.github
public
src
.git
.editorconfig
.env
.gitignore
.prettierignore
.prettierrc
.umirc.ts
README.md
tsconfig.json
typings.d.ts
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASEURL = http://120.222.204.155:30100
PORT = 8080
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/npm-debug.log*
/yarn-error.log
/package-lock.json

# production
/dist

# misc
.DS_Store

# umi
/src/.umi
/src/.umi-production
/src/.umi-test
/.env.local
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
.umi-test
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
52 changes: 52 additions & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { defineConfig } from 'umi';
const OpenBrowserPlugin = require('open-browser-plugin');

export default defineConfig({
title: 'klever-web',
favicon: '/assets/favicon.ico',
theme: {
'@primary-color': '#4974D4',
'@layout-body-background': '#fcfcfc',
'@layout-header-background': '#152740',
'@layout-header-height': '50px',
'@layout-header-padding': '0 16px',
'@layout-sider-background': '#2b384a',
'@layout-trigger-height': '@layout-header-height',
'@layout-trigger-background': '@layout-sider-background',
'@layout-trigger-color': '#76889c',
'@menu-dark-bg': '@layout-sider-background',
'@menu-dark-submenu-bg': '#253141',
'@menu-item-active-bg': '@primary-color',
'@menu-icon-size': '24px',
'@menu-icon-size-lg': '24px',
'@menu-dark-item-active-bg': '@primary-color',
'@breadcrumb-base-color': '#666',
'@breadcrumb-last-item-color': '#151515',
'@breadcrumb-separator-color': '@breadcrumb-base-color',
},
request: {
dataField: '',
},
antd: {
dark: false,
},
nodeModulesTransform: {
type: 'none',
},
chainWebpack: (memo, config) => {
if (config && config.env && config.env !== 'production') {
memo.plugin('open-browser-plugin').use(OpenBrowserPlugin);
memo.plugin('open-browser-plugin').tap(() => [
{
port: process.env.PORT,
},
]);
}
},
proxy: {
'/api': {
target: process.env.BASEURL,
changeOrigin: true,
},
},
});
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:12

WORKDIR /usr/src/app

COPY package.json yarn.lock ./

RUN yarn install --prod --ignore-scripts

COPY . .

EXPOSE 8080

CMD [ "node", "app.js" ]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# klever web

## Getting Started

Install dependencies,

```bash
$ yarn
```

Start the dev server,

```bash
$ yarn start
```
26 changes: 26 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const path = require('path');
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const dotenv = require('dotenv');
dotenv.config();

const app = express();
const port = process.env.PORT || 8080;

app.use(express.static(path.join(__dirname, 'dist')));

app.use(
'/api',
createProxyMiddleware({
target: process.env.BACKEND || process.env.BASEURL,
changeOrigin: true,
}),
);

app.all('*', (req, res) => {
res.sendFile(path.join(__dirname, './dist', 'index.html'));
});

app.listen(port, () => {
console.log(`klever-web running at port ${port}`);
});
59 changes: 59 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "klever-web",
"version": "0.0.1",
"description": "klever-web",
"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",
"server": "node app.js"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"http-proxy-middleware": "^1.0.6"
},
"devDependencies": {
"@ant-design/icons": "^4.2.2",
"@types/classnames": "^2.2.10",
"@types/codemirror": "^0.0.98",
"@types/final-form-set-field-touched": "^1.0.0",
"@types/react-codemirror": "^1.0.3",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.23",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.3.1",
"final-form": "^4.20.1",
"final-form-arrays": "^3.0.2",
"final-form-set-field-touched": "^1.0.1",
"json2yaml": "^1.1.0",
"lint-staged": "^10.0.7",
"moment": "^2.29.1",
"open-browser-plugin": "^1.1.1",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-codemirror": "^1.0.0",
"react-dom": "^16.12.0",
"react-final-form": "^6.5.2",
"react-final-form-arrays": "^3.1.3",
"react-router-breadcrumbs-hoc": "^3.3.0",
"reconnecting-websocket": "^4.4.0",
"umi": "^3.2.23",
"yorkie": "^2.0.0"
}
}
25 changes: 25 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
12 changes: 12 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare module '*.css';
declare module '*.less';
declare module '*.png';
declare module 'json2yaml';
declare module 'copy-to-clipboard';
declare module '*.svg' {
export function ReactComponent(
props: React.SVGProps<SVGSVGElement>,
): React.ReactElement;
const url: string;
export default url;
}
Loading

0 comments on commit b2cdf3d

Please sign in to comment.