Browse Source

refactor&build: 删除无用代码与无用库

Roxas 3 years ago
parent
commit
3be5e3a936

+ 0
- 38
lib/components/Editor/Upload.js View File

@@ -40,14 +40,6 @@ var _react = require("react");
40 40
 
41 41
 var _react2 = _interopRequireDefault(_react);
42 42
 
43
-var _dayjs = require("dayjs");
44
-
45
-var _dayjs2 = _interopRequireDefault(_dayjs);
46
-
47
-var _shortid = require("shortid");
48
-
49
-var _shortid2 = _interopRequireDefault(_shortid);
50
-
51 43
 var _reactIntlUniversal = require("react-intl-universal");
52 44
 
53 45
 var _reactIntlUniversal2 = _interopRequireDefault(_reactIntlUniversal);
@@ -68,36 +60,6 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
68 60
 
69 61
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
70 62
 
71
-// const client = oss => {
72
-//   return new window.OSS.Wrapper({
73
-//     accessKeyId: oss.access_key_id,
74
-//     accessKeySecret: oss.access_key_secret,
75
-//     stsToken: oss.security_token,
76
-//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
77
-//     bucket: OSS_BUCKET
78
-//   });
79
-// };
80
-
81
-// const uploadPath = (path, file) => {
82
-//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
83
-//     file.type.split("/")[1]
84
-//   }`;
85
-// };
86
-
87
-// const UploadToOss = (oss, path, file) => {
88
-//   const url = uploadPath(path, file);
89
-//   return new Promise((resolve, reject) => {
90
-//     client(oss)
91
-//       .multipartUpload(url, file)
92
-//       .then(data => {
93
-//         resolve(data);
94
-//       })
95
-//       .catch(error => {
96
-//         reject(error);
97
-//       });
98
-//   });
99
-// };
100
-
101 63
 var App = function (_React$Component) {
102 64
   _inherits(App, _React$Component);
103 65
 

+ 1
- 1
lib/components/Editor/Upload.js.map
File diff suppressed because it is too large
View File


+ 0
- 38
lib/components/Editor/index.js View File

@@ -36,14 +36,6 @@ require("antd/es/message/style");
36 36
 
37 37
 require("antd/es/input/style");
38 38
 
39
-var _dayjs = require("dayjs");
40
-
41
-var _dayjs2 = _interopRequireDefault(_dayjs);
42
-
43
-var _shortid = require("shortid");
44
-
45
-var _shortid2 = _interopRequireDefault(_shortid);
46
-
47 39
 var _propTypes = require("prop-types");
48 40
 
49 41
 var _propTypes2 = _interopRequireDefault(_propTypes);
@@ -90,36 +82,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
90 82
 
91 83
 var TextArea = _input2.default.TextArea;
92 84
 
93
-// const client = oss => {
94
-//   return new window.OSS.Wrapper({
95
-//     accessKeyId: oss.access_key_id,
96
-//     accessKeySecret: oss.access_key_secret,
97
-//     stsToken: oss.security_token,
98
-//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
99
-//     bucket: OSS_BUCKET
100
-//   });
101
-// };
102
-
103
-// const uploadPath = (path, file) => {
104
-//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
105
-//     file.type.split("/")[1]
106
-//   }`;
107
-// };
108
-
109
-// const UploadToOss = (oss, path, file) => {
110
-//   const url = uploadPath(path, file);
111
-//   return new Promise((resolve, reject) => {
112
-//     client(oss)
113
-//       .multipartUpload(url, file)
114
-//       .then(data => {
115
-//         resolve(data);
116
-//       })
117
-//       .catch(error => {
118
-//         reject(error);
119
-//       });
120
-//   });
121
-// };
122
-
123 85
 var Editor = function (_React$Component) {
124 86
   _inherits(Editor, _React$Component);
125 87
 

+ 1
- 1
lib/components/Editor/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 2
package.json View File

@@ -23,7 +23,6 @@
23 23
     "react-dom": "^16.4.1",
24 24
     "react-intl-universal": "^1.15.2",
25 25
     "react-scripts": "1.1.4",
26
-    "shortid": "^2.2.11",
27 26
     "webpack-version-file-plugin": "^0.3.3"
28 27
   },
29 28
   "lint-staged": {
@@ -42,13 +41,13 @@
42 41
     "lib": "babel ./src --out-dir ./lib --source-maps --copy-files"
43 42
   },
44 43
   "devDependencies": {
45
-    "cross-env": "^5.2.0",
46 44
     "babel-cli": "^6.26.0",
47 45
     "babel-plugin-import": "^1.8.0",
48 46
     "babel-plugin-transform-object-rest-spread": "^6.26.0",
49 47
     "babel-preset-env": "^1.7.0",
50 48
     "babel-preset-es2015": "^6.24.1",
51 49
     "babel-preset-react": "^6.24.1",
50
+    "cross-env": "^5.2.0",
52 51
     "husky": "^0.14.3",
53 52
     "lint-staged": "^7.2.0",
54 53
     "node-sass": "^4.9.4",

+ 0
- 32
src/components/Editor/Upload.js View File

@@ -1,42 +1,10 @@
1 1
 import React from "react";
2 2
 import { Upload, Icon, Modal, message, Spin } from "antd";
3
-import dayjs from "dayjs";
4
-import shortid from "shortid";
5 3
 import intl from "react-intl-universal";
6 4
 import { DRIVER_LICENSE_PATH, ERROR_DEFAULT } from "../../constant";
7 5
 import Comment from "../../Comment";
8 6
 import "./Upload.css";
9 7
 
10
-// const client = oss => {
11
-//   return new window.OSS.Wrapper({
12
-//     accessKeyId: oss.access_key_id,
13
-//     accessKeySecret: oss.access_key_secret,
14
-//     stsToken: oss.security_token,
15
-//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
16
-//     bucket: OSS_BUCKET
17
-//   });
18
-// };
19
-
20
-// const uploadPath = (path, file) => {
21
-//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
22
-//     file.type.split("/")[1]
23
-//   }`;
24
-// };
25
-
26
-// const UploadToOss = (oss, path, file) => {
27
-//   const url = uploadPath(path, file);
28
-//   return new Promise((resolve, reject) => {
29
-//     client(oss)
30
-//       .multipartUpload(url, file)
31
-//       .then(data => {
32
-//         resolve(data);
33
-//       })
34
-//       .catch(error => {
35
-//         reject(error);
36
-//       });
37
-//   });
38
-// };
39
-
40 8
 class App extends React.Component {
41 9
   constructor(props) {
42 10
     super(props);

+ 0
- 32
src/components/Editor/index.js View File

@@ -1,5 +1,3 @@
1
-import dayjs from "dayjs";
2
-import shortid from "shortid";
3 1
 import PropTypes from "prop-types";
4 2
 import classnames from "classnames";
5 3
 import React, { Fragment } from "react";
@@ -16,36 +14,6 @@ import "./index.css";
16 14
 
17 15
 const { TextArea } = Input;
18 16
 
19
-// const client = oss => {
20
-//   return new window.OSS.Wrapper({
21
-//     accessKeyId: oss.access_key_id,
22
-//     accessKeySecret: oss.access_key_secret,
23
-//     stsToken: oss.security_token,
24
-//     endpoint: OSS_ENDPOINT, //常量,你可以自己定义
25
-//     bucket: OSS_BUCKET
26
-//   });
27
-// };
28
-
29
-// const uploadPath = (path, file) => {
30
-//   return `${path}/${dayjs().format("YYYYMMDD")}/${shortid.generate()}.${
31
-//     file.type.split("/")[1]
32
-//   }`;
33
-// };
34
-
35
-// const UploadToOss = (oss, path, file) => {
36
-//   const url = uploadPath(path, file);
37
-//   return new Promise((resolve, reject) => {
38
-//     client(oss)
39
-//       .multipartUpload(url, file)
40
-//       .then(data => {
41
-//         resolve(data);
42
-//       })
43
-//       .catch(error => {
44
-//         reject(error);
45
-//       });
46
-//   });
47
-// };
48
-
49 17
 class Editor extends React.Component {
50 18
   constructor(props) {
51 19
     super(props);