diff --git a/.eslintignore b/.eslintignore index 43ab7824efa0352bbcbffde924c60fb1d2634518..1cd605b14674299f3abf462690c5064986acd737 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,3 @@ -/functions/mock/** +/lambda/mock/** /scripts /config \ No newline at end of file diff --git a/.firebaserc b/.firebaserc deleted file mode 100644 index e3a9a50c8a53831595f67ab41862f94d8f050bd0..0000000000000000000000000000000000000000 --- a/.firebaserc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "projects": { - "default": "antd-pro" - } -} diff --git a/.gitignore b/.gitignore index 2859215803d95b14b51d6618bf9cc99587b99aa1..253591b5200c5227e85ef7fa1ea33a5279a4deaa 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,8 @@ package-lock.json # visual studio code .history *.log - -functions/mock +functions/* +lambda/mock/index.js .temp/** # umi diff --git a/README.md b/README.md index 06029c2e79bdb1e56b4010957c651cca4e0a602e..c6da6474c5ce12b04bd107d4eb5b3c74dd804b6d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ An out-of-box UI solution for enterprise applications as a React boilerplate. [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - +[![Netlify Status](https://api.netlify.com/api/v1/badges/b68e9850-a529-4364-9d3b-d70aade560f9/deploy-status)](https://app.netlify.com/sites/ant-design-pro/deploys) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/README.ru-RU.md b/README.ru-RU.md index 9ebefff6dd0e69b06b96b3a4ab8b00c11ffbbcb0..f820dfba2343571ac0803274109b2d989845e727 100644 --- a/README.ru-RU.md +++ b/README.ru-RU.md @@ -12,7 +12,7 @@ UI-решение "из коробки" для корпоративных при [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - +[![Netlify Status](https://api.netlify.com/api/v1/badges/b68e9850-a529-4364-9d3b-d70aade560f9/deploy-status)](https://app.netlify.com/sites/ant-design-pro/deploys) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/README.tr-TR.md b/README.tr-TR.md index 8d8942935e6fbe1fddd2e8624d0597a0b1522e38..8470cb79a41153736603c6bb92c63ebbbfdc2187 100644 --- a/README.tr-TR.md +++ b/README.tr-TR.md @@ -12,8 +12,7 @@ React ile kurumsal uygulamalar için taslak olarak geliştirilmiş kullanıma ha [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇺🇸) [![Gitter](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)(🇨🇳) - - +[![Netlify Status](https://api.netlify.com/api/v1/badges/b68e9850-a529-4364-9d3b-d70aade560f9/deploy-status)](https://app.netlify.com/sites/ant-design-pro/deploys) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/README.zh-CN.md b/README.zh-CN.md index a4186f308b3361c1d0f69e878587d33e4410fba1..b4b3b722c650b12905a652c59076252129a8d897 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -11,7 +11,7 @@ [![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) [![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro?type=dev) [![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - +[![Netlify Status](https://api.netlify.com/api/v1/badges/b68e9850-a529-4364-9d3b-d70aade560f9/deploy-status)](https://app.netlify.com/sites/ant-design-pro/deploys) ![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png) diff --git a/firebase.json b/firebase.json deleted file mode 100644 index a00223d4ddce6ed47ef14af8e3b78f86294c0706..0000000000000000000000000000000000000000 --- a/firebase.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "hosting": { - "public": "dist", - "rewrites": [ - { "source": "/api/**", "function": "api" }, - { - "source": "**", - "destination": "/index.html" - } - ], - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"] - } -} diff --git a/functions/index.js b/functions/index.js deleted file mode 100644 index 609b51ca4df69bf827cac9ba7e600bd6685eec89..0000000000000000000000000000000000000000 --- a/functions/index.js +++ /dev/null @@ -1,10 +0,0 @@ -// [START functionsimport] -const functions = require('firebase-functions'); -const express = require('express'); - -const matchMock = require('./matchMock'); - -const app = express(); - -app.use(matchMock); -exports.api = functions.https.onRequest(app); diff --git a/functions/package.json b/functions/package.json deleted file mode 100644 index fe77db2ab178ceec526d78d077834a401b7970a0..0000000000000000000000000000000000000000 --- a/functions/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "functions", - "description": "Cloud Functions for Firebase", - "scripts": { - "serve": "firebase serve --only functions", - "shell": "firebase functions:shell", - "start": "npm run shell", - "deploy": "npm run mock && firebase deploy --only functions", - "logs": "firebase functions:log", - "mock": "node ../scripts/generateMock.js" - }, - "dependencies": { - "@babel/runtime": "^7.0.0", - "body-parser": "^1.18.3", - "express": "^4.16.4", - "firebase-admin": "^6.4.0", - "firebase-functions": "^2.1.0", - "mockjs": "^1.0.1-beta3", - "moment": "^2.22.2", - "path-to-regexp": "^3.0.0" - }, - "private": true -} diff --git a/lambda/api.js b/lambda/api.js new file mode 100644 index 0000000000000000000000000000000000000000..e0c147a6a3baa8ee307b69df1a4a2d11ba1072c5 --- /dev/null +++ b/lambda/api.js @@ -0,0 +1,11 @@ +// [START functions import] +const express = require('express'); +const serverLess = require('serverless-http'); + +const matchMock = require('./mock/matchMock'); + +const app = express(); + +app.use(matchMock); + +exports.handler = serverLess(app); diff --git a/functions/matchMock.js b/lambda/mock/matchMock.js similarity index 90% rename from functions/matchMock.js rename to lambda/mock/matchMock.js index 924573a53a6c1cf5b58a45f43487b06b96516929..94027802a6174e0bc0322a402c51d1ec51a53bd7 100644 --- a/functions/matchMock.js +++ b/lambda/mock/matchMock.js @@ -1,7 +1,7 @@ const pathToRegexp = require('path-to-regexp'); const bodyParser = require('body-parser'); -const mockFile = require('./mock/index'); +const mockFile = require('./index'); const BODY_PARSED_METHODS = ['post', 'put', 'patch']; @@ -10,13 +10,14 @@ function parseKey(key) { let method = 'get'; let path = key; if (key.indexOf(' ') > -1) { - const splited = key.split(' '); - method = splited[0].toLowerCase(); - path = splited[1]; // eslint-disable-line + const spliced = key.split(' '); + method = spliced[0].toLowerCase(); + path = spliced[1]; // eslint-disable-line } + const routerBasePath = process.env.NODE_ENV === 'dev' ? `${path}` : `/.netlify/functions${path}`; return { method, - path, + path: routerBasePath, }; } diff --git a/netlify.toml b/netlify.toml index 18b22e9d58b17ae991caaa6f96317b1aeac87f93..9d3438c4aff06f5a644d10167b5c7133f5175e45 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,12 +1,15 @@ +[build] + functions = "./functions" + [[redirects]] from = "/api/*" - to = "https://us-central1-antd-pro.cloudfunctions.net/api/api/:splat" + to = "/.netlify/functions/api/:splat" status = 200 force = true [redirects.headers] X-From = "Netlify" X-Api-Key = "some-api-key-string" - + [[redirects]] from = "/*" to = "/index.html" diff --git a/package.json b/package.json index 239197bf85f80097f239b19b562246f6719b1a5e..af94ef99ea0cda1b4ac6f02c9a5ea3c4bd2bbd6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "2.3.0", + "version": "2.3.1", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { @@ -13,6 +13,9 @@ "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up", "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro", "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro", + "functions:build": "npm run generateMock && netlify-lambda build ./lambda", + "functions:run": "npm run generateMock && cross-env NODE_ENV=dev netlify-lambda serve ./lambda", + "generateMock": "node ./scripts/generateMock", "lint": "eslint --ext .js src mock tests && npm run lint:style && npm run lint:prettier", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js", @@ -20,8 +23,6 @@ "lint:prettier": "check-prettier lint", "lint:style": "stylelint 'src/**/*.less' --syntax less", "prettier": "node ./scripts/prettier.js", - "presite": "cd functions && npm install", - "site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy && npm run docker:push", "start": "cross-env APP_TYPE=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "test": "umi test", @@ -30,20 +31,39 @@ "tslint": "npm run tslint:fix", "tslint:fix": "tslint --fix 'src/**/*.ts*'" }, + "husky": { + "hooks": { + "pre-commit": "npm run lint-staged" + } + }, + "lint-staged": { + "**/*.less": "stylelint --syntax less", + "**/*.{js,jsx}": "npm run lint-staged:js", + "**/*.{js,ts,tsx,json,jsx,less}": [ + "node ./scripts/lint-prettier.js", + "git add" + ] + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 10" + ], "dependencies": { "@antv/data-set": "^0.10.1", - "@babel/runtime": "^7.3.1", "antd": "^3.13.0", "bizcharts": "^3.4.3", "bizcharts-plugin-slider": "^2.1.1-beta.1", "classnames": "^2.2.6", "dva": "^2.4.1", "enquire-js": "^0.2.1", + "express": "^4.16.4", "gg-editor": "^2.0.2", "lodash": "^4.17.11", "lodash-decorators": "^6.0.1", "memoize-one": "^5.0.0", "moment": "^2.24.0", + "netlify-lambda": "^1.4.3", "numeral": "^2.0.6", "nzh": "^1.0.4", "omit.js": "^1.0.0", @@ -58,6 +78,7 @@ "react-dom": "^16.7.0", "react-fittext": "^1.0.0", "react-media": "^1.9.2", + "serverless-http": "^1.9.1", "umi": "^2.4.4", "umi-plugin-react": "^1.7.2", "umi-request": "^1.0.5" @@ -110,24 +131,6 @@ "engines": { "node": ">=8.0.0" }, - "husky": { - "hooks": { - "pre-commit": "npm run lint-staged" - } - }, - "lint-staged": { - "**/*.less": "stylelint --syntax less", - "**/*.{js,jsx}": "npm run lint-staged:js", - "**/*.{js,ts,tsx,json,jsx,less}": [ - "node ./scripts/lint-prettier.js", - "git add" - ] - }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 10" - ], "checkFiles": [ "src/**/*.js*", "src/**/*.ts*", diff --git a/scripts/generateMock.js b/scripts/generateMock.js index 54c7d6d624fcefd98cec3600538284a5056910a7..e8600caf24a4bcb509b1bd8f691bed89febc5c49 100644 --- a/scripts/generateMock.js +++ b/scripts/generateMock.js @@ -1,3 +1,3 @@ const generateMock = require('merge-umi-mock-data'); const path = require('path'); -generateMock(path.join(__dirname, '../mock'), path.join(__dirname, '../functions/mock/index.js')); +generateMock(path.join(__dirname, '../mock'), path.join(__dirname, '../lambda/mock/index.js')); diff --git a/tsconfig.json b/tsconfig.json index 5be3083113eb212c29bc33d59b6e73932bbcb0f9..5c26101123fa262ec736067de2c211da06ffbfd9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "jsx": "react", "allowSyntheticDefaultImports": true, "moduleResolution": "node", - "rootDirs": ["/src", "/test", "/mock","./typings"], + "rootDirs": ["/src", "/test", "/mock", "./typings"], "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, "suppressImplicitAnyIndexErrors": true,