add build.js

This commit is contained in:
zhichen 2018-09-20 20:15:23 +08:00
parent 2986620fef
commit 5c04f1f274
8 changed files with 37 additions and 56 deletions

View File

@ -10,4 +10,7 @@
# misc
.DS_Store
npm-debug.log*
/index.html
/index.css
/index.js

View File

@ -3,7 +3,7 @@
"outputPath": "./build",
"proxy": {
"/": {
"target": "http://127.0.0.1:8080", //这边写你自己的服务Ip
"target": "http://10.101.109.214:8080", //这边写你自己的服务Ip
"changeOrigin": true,
"pathRewrite": { "^/" : "" }
}

View File

@ -0,0 +1,30 @@
const cp = require('child_process');
const fs = require('fs');
const path = require('path');
// 默认打包存放地址
const buildDir = 'build';
// 打包后文件存放地址
const targetDir = __dirname;
const spawnAsync = (...args) => new Promise((resolve, reject) => {
const worker = cp.spawn(...args, { stdio: 'inherit' });
worker.on('close', resolve);
worker.on('error', reject);
});
spawnAsync('roadhog', ['build'])
.then(() => {
const _buildDir = path.join(__dirname, buildDir);
if (!fs.statSync(_buildDir).isDirectory()) {
return;
}
let fileList = fs.readdirSync(_buildDir, "utf8");
fileList.forEach((fileName) => {
if (fileName === "." || fileName === "..") {
return;
}
const _buildPath = path.join(buildDir, fileName);
const _targetPath = path.join(targetDir, fileName);
fs.writeFileSync(_targetPath, fs.readFileSync(_buildPath, "utf8"), "utf8");
})
});

File diff suppressed because one or more lines are too long

View File

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Nacos</title>
<link rel="shortcut icon" href="//www.aliyun.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="//g.alicdn.com/aliyun/console-base/0.0.18/app.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun/console/1.3.63/styles/bootstrap/bootstrap.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/aliyun/console/1.3.63/styles/console1412.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/cm/edas/2.132.6/styles/edas/edas.console.css">
<!-- 第三方css开始 -->
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/merge.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/bootstrap.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/cm-design/simpleMVC/public/styles/icons/icon.css">
<link rel="stylesheet" type="text/css" href="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/font-awesome.css">
<link rel="stylesheet" type="text/css" href="index.css">
<!-- 第三方css结束 -->
<script src="//g.alicdn.com/cm-design/simplemvc-cdn/0.0.67/jquery.js"></script>
<!-- i18nJs开始 -->
<script src="i18ndoc.js"></script>
<!-- i18nJs结束 -->
</head>
<body>
<div id="root" style="overflow:hidden"></div>
<div id="app"></div>
<div id="other"></div>
<!-- 第三方js开始 -->
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.64/naruto/lib/codemirror.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/javascript.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/xml.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.addone.fullscreen.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.addone.lint.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.lib.json-lint.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.addone.json-lint.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/codemirror.lib.clike-lint.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/diff_match_patch.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/merge.js"></script>
<script src="//g.alicdn.com/EFDP/naruto-cdn/0.0.52/naruto/lib/loader.js"></script>
<!-- 第三方js结束 -->
<script src="index.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,8 @@
"private": true,
"scripts": {
"start": "roadhog dev",
"build": "ESLINT=none roadhog build",
"build": "node build.js",
"dist": "roadhog build",
"lint": "eslint --ext .js src test"
},
"dependencies": {

View File

@ -145,7 +145,7 @@ class ValidateDialog extends React.Component {
let data = Object.assign({}, config.data, {
codeType: this.state.codeType,
verifyCode: this.state.verifyCode,
requestId: this.state.window.requestId
requestId: this.state.requestId
});
let preSucess = config.success;
this.setState({