This repository was archived by the owner on Oct 12, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const matman = require ( '../matman' ) ;
22
3- function getClientScriptHandler ( basePath , buildPath , regMatch ) {
3+ function getClientScriptHandler ( rootPath , buildPath , regMatch ) {
44 const clientScript = new matman . ClientScript ( {
5- basePath : basePath ,
5+ rootPath : rootPath ,
66 buildPath : buildPath ,
77 regMatch : regMatch
88 } ) ;
Original file line number Diff line number Diff 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 */
1010function 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 ;
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ const HANDLER_NAME_FIELD = 'mockerName';
1313module . exports = ( router , entry ) => {
1414 // 创建 MockerParser 对象
1515 const mockerParser = new MockerParser ( {
16- basePath : matman . mockerUtil . getMockServerBasePath ( entry . basePath , entry . mockServerPath ) ,
17- buildPath : matman . mockerUtil . getMockServerBuildPath ( entry . basePath , entry . buildPath )
16+ basePath : matman . mockerUtil . getMockServerBasePath ( entry . rootPath , entry . mockServerPath ) ,
17+ buildPath : matman . mockerUtil . getMockServerBuildPath ( entry . rootPath , entry . buildPath )
1818 } ) ;
1919
2020 // 获取所有的 mocker 列表
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ class Builder {
1818 * @desc 创建用于生产环境中的webpack打包配置
1919 *
2020 * @param {Object } params
21- * @param {RegExp } params.basePath 项目根目录
21+ * @param {RegExp } params.rootPath 项目根目录
2222 * @param {RegExp } params.clientScriptMatch 正则表达式,用于匹配路径中那些文件是 client script
2323 * @param {Object } params.entry 传递给webpack 的 entry属性属性
2424 * @param {String } params.clientScriptBuildPath 输出打包后的 client script 的路径
2525 * @param {Object } opts
2626 * @example
2727 */
2828 static createProdConfig ( params = { } , opts = { } ) {
29- const clientScriptHandler = e2eBuild . getClientScriptHandler ( params . basePath , params . clientScriptBuildPath , params . clientScriptMatch ) ;
29+ const clientScriptHandler = e2eBuild . getClientScriptHandler ( params . rootPath , params . clientScriptBuildPath , params . clientScriptMatch ) ;
3030
3131 // 设置打包规则
3232 const prodRules = [ ] ;
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ function getConfig(targetPath) {
5757 return fsHandler . handle . getModuleResult ( configFile )
5858 . then ( ( config ) => {
5959
60- // basePath 默认值为 matman.config.js 当前目录
61- if ( ! config . basePath ) {
62- config . basePath = path . dirname ( configFile ) ;
60+ // rootPath 默认值为 matman.config.js 当前目录
61+ if ( ! config . rootPath ) {
62+ config . rootPath = path . dirname ( configFile ) ;
6363 }
6464
6565 return config ;
Original file line number Diff line number Diff line change @@ -28,13 +28,9 @@ module.exports = function (args) {
2828
2929 let matmanConfig = require ( configAbsolutePath ) ;
3030
31- // 如果不定义 basePath,则默认取 process.cwd()
32- if ( ! matmanConfig . basePath ) {
33- matmanConfig . basePath = cwd ;
34- }
35-
36- if ( ! matmanConfig . buildPath ) {
37- matmanConfig . buildPath = path . resolve ( matmanConfig . basePath , './build' ) ;
31+ // 如果不定义 rootPath,则默认取 process.cwd()
32+ if ( ! matmanConfig . rootPath ) {
33+ matmanConfig . rootPath = cwd ;
3834 }
3935
4036 // 启动本地服务
Original file line number Diff line number Diff line change 1+ {}
Original file line number Diff line number Diff line change 11const path = require ( 'path' ) ;
22
33module . exports = {
4- // basePath : __dirname,
5- // dataPath : path.resolve(__dirname, './build'),
4+ // rootPath : __dirname,
5+ // buildPath : path.resolve(__dirname, './build'),
66 // mockServerPath: path.resolve(__dirname, '../../../../matman/test/data/fixtures/mock_server/mockers'),
77 mockServerPath : path . resolve ( __dirname , '../../../../now-h5-weishi-redpacket/matman-app/src/mock_server/mockers' ) ,
88 // clientScriptBuildPath: path.join(__dirname, 'dist-client-script'),
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const path = require('path');
22const localServer = require ( '../../../business/local-server' ) ;
33
44localServer . startServer ( {
5- basePath : __dirname ,
6- dataPath : path . resolve ( __dirname , './app' ) ,
5+ rootPath : __dirname ,
6+ buildPath : path . resolve ( __dirname , './app' ) ,
77 mockServerPath : path . resolve ( __dirname , '../../../../matman/test/data/fixtures/mock_service/mockers' ) ,
88} ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments