Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

Commit 0b99d4f

Browse files
author
HeLinJiang
authored
Merge pull request #24 from matmanjs/v1.1.0
V1.1.0
2 parents 39ffa82 + 245253e commit 0b99d4f

44 files changed

Lines changed: 1564 additions & 409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

business/e2e-build/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const matman = require('../matman');
2+
3+
function getClientScriptHandler(rootPath, buildPath, regMatch) {
4+
const clientScript = new matman.ClientScript({
5+
rootPath: rootPath,
6+
buildPath: buildPath,
7+
regMatch: regMatch
8+
});
9+
10+
return clientScript;
11+
}
12+
13+
module.exports = {
14+
getClientScriptHandler: getClientScriptHandler
15+
};

business/local-server/config/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('path');
44
/**
55
* 获取最终的配置数据
66
* @param {Object | String} opts 用户传递过来的参数
7-
* @param {String} [opts.basePath] 项目根目录
7+
* @param {String} [opts.rootPath] 项目根目录
88
* @returns {Object}
99
*/
1010
function getConfigOpts(opts) {
@@ -29,9 +29,9 @@ function getConfigOpts(opts) {
2929
return null;
3030
}
3131

32-
// 如果没有 basePath,则将无法启动成功
33-
if (!configOpts.basePath) {
34-
console.error('Should define basePath!', opts, configOpts);
32+
// 如果没有 rootPath,则将无法启动成功
33+
if (!configOpts.rootPath) {
34+
console.error('Should define rootPath!', opts, configOpts);
3535
return null;
3636
}
3737

@@ -43,8 +43,8 @@ function getConfigOpts(opts) {
4343
}, configOpts.mocker);
4444
}
4545

46-
// 日志文件存储的路径,默认值为 ${basePath}/logs
47-
configOpts.LOG_PATH = configOpts.LOG_PATH || path.join(configOpts.basePath, 'logs');
46+
// 日志文件存储的路径,默认值为 ${rootPath}/logs
47+
configOpts.LOG_PATH = configOpts.LOG_PATH || path.join(configOpts.rootPath, 'logs');
4848

4949
// matman 启动之后的服务端口号,默认为 9527
5050
configOpts.port = configOpts.port || 9527;

business/local-server/plugins/mocker/router.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require('path');
12
const _ = require('lodash');
23
const baseRouter = require('../../server/router/base-router');
34
const matman = require('../../../../business/matman');
@@ -10,11 +11,13 @@ const PLUGIN_NAME = 'mocker';
1011
const HANDLER_NAME_FIELD = 'mockerName';
1112

1213
module.exports = (router, entry) => {
14+
// 创建 MockerParser 对象
1315
const mockerParser = new MockerParser({
14-
basePath: entry.mockServerPath,
15-
dataPath: entry.dataPath
16+
basePath: matman.mockerUtil.getMockServerBasePath(entry.rootPath, entry.mockServerPath),
17+
buildPath: matman.mockerUtil.getMockServerBuildPath(entry.rootPath, entry.buildPath)
1618
});
1719

20+
// 获取所有的 mocker 列表
1821
let mockerList = mockerParser.getAllMocker();
1922

2023
// GET /matman-cgi/mocker 所有的 mocker 列表信息

business/local-server/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = (opts) => {
3939
//====================================================================================
4040
logger.init(configOpts.LOG_PATH);
4141
matmanLogger.info(configOpts);
42-
console.log('configOpts:', configOpts);
42+
// console.log('configOpts:', configOpts);
4343

4444
//====================================================================================
4545
// 4. 创建服务,并加入 handler 路由
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"main.css": "static/css/main.6ff71260.css",
3-
"main.css.map": "static/css/main.6ff71260.css.map",
4-
"main.js": "static/js/main.3c3dc714.js",
5-
"main.js.map": "static/js/main.3c3dc714.js.map"
2+
"main.css": "static/css/main.f1c110c9.css",
3+
"main.css.map": "static/css/main.f1c110c9.css.map",
4+
"main.js": "static/js/main.2fe9eb4d.js",
5+
"main.js.map": "static/js/main.2fe9eb4d.js.map"
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="/favicon.ico"><title>React App</title><link href="/static/css/main.6ff71260.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.3c3dc714.js"></script></body></html>
1+
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="shortcut icon" href="/favicon.ico"><title>React App</title><link href="/static/css/main.f1c110c9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.2fe9eb4d.js"></script></body></html>

business/local-server/webui/build/service-worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

business/local-server/webui/build/static/css/main.6ff71260.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

business/local-server/webui/build/static/css/main.6ff71260.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

business/local-server/webui/build/static/css/main.f1c110c9.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)