Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
Chameleon
提交
0855a7e3
C
Chameleon
项目概览
DiDi
/
Chameleon
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Chameleon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0855a7e3
编写于
6月 03, 2020
作者:
W
wangmengjun
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '1.0.6-wmj' into '1.0.6'
1.0.6 wmj See merge request cml/new-open-chameleon-sets!174
上级
59d04b7f
1a84c273
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
3256 addition
and
3105 deletion
+3256
-3105
packages/chameleon-templates/project/chameleon.config.js
packages/chameleon-templates/project/chameleon.config.js
+4
-0
packages/chameleon-tool-utils/src/index.js
packages/chameleon-tool-utils/src/index.js
+4
-0
packages/chameleon-tool/commanders/web/dev-server.js
packages/chameleon-tool/commanders/web/dev-server.js
+10
-0
packages/chameleon-tool/configs/getCommonConfig.js
packages/chameleon-tool/configs/getCommonConfig.js
+17
-12
packages/chameleon-tool/lib/config.js
packages/chameleon-tool/lib/config.js
+2
-1
packages/chameleon-tool/npm-shrinkwrap.json
packages/chameleon-tool/npm-shrinkwrap.json
+3210
-3089
packages/chameleon-tool/package.json
packages/chameleon-tool/package.json
+1
-0
packages/webpack-check-plugin/index.js
packages/webpack-check-plugin/index.js
+8
-3
未找到文件。
packages/chameleon-templates/project/chameleon.config.js
浏览文件 @
0855a7e3
...
...
@@ -44,6 +44,10 @@ cml.config.merge({
publicPath
:
`
${
publicPath
}
/wx/`
,
apiPrefix
}
},
optimize
:
{
watchNodeModules
:
true
,
// 设置为true对于调试 node_modules 里面的内容很有帮助
showWarning
:
true
// 设置为true可以在构建过程中看到警告信息,比如编译过程中引入了同一个npm包的不同版本会在终端输出信息
}
})
packages/chameleon-tool-utils/src/index.js
浏览文件 @
0855a7e3
...
...
@@ -1181,6 +1181,10 @@ _.getCmlFileType = function(cmlFilePath, context, cmlType) {
});
let
subProjectIndex
=
-
1
;
for
(
let
i
=
0
;
i
<
npmNames
.
length
;
i
++
)
{
//比如 配置 npmName: '@didi/cml-login',在windows中药改成对应的分隔符
if
(
_
.
isWin
())
{
// 修复windows平台下将npm页面全部解析成component的问题
npmNames
[
i
]
=
npmNames
[
i
].
replace
(
/
\/
/g
,
'
\\
'
)
}
if
(
~
cmlFilePath
.
indexOf
(
npmNames
[
i
]))
{
subProjectIndex
=
i
;
break
;
...
...
packages/chameleon-tool/commanders/web/dev-server.js
浏览文件 @
0855a7e3
...
...
@@ -18,6 +18,7 @@ const http = require('http');
const
bodyParser
=
require
(
'
body-parser
'
)
const
argv
=
require
(
'
minimist
'
)(
process
.
argv
);
const
nopreview
=
argv
.
nopreview
||
argv
.
n
;
const
{
createProxyMiddleware
}
=
require
(
'
http-proxy-middleware
'
);
/**
* webpackConfig webpack的配置对象
...
...
@@ -31,11 +32,20 @@ module.exports = function({webpackConfig, options, compiler}) {
var
port
=
utils
.
getFreePort
().
webServerPort
;
var
autoOpenBrowser
=
true
;
var
app
=
express
();
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
app
.
use
(
bodyParser
.
text
({
type
:
'
text/html
'
}))
app
.
use
(
responseTime
());
dynamicApiMiddleware
(
app
,
options
);
// web端增加跨域自定义配置
let
devProxy
=
options
&&
options
.
devProxy
||
[];
if
(
webpackConfig
.
name
===
'
web
'
&&
Array
.
isArray
(
devProxy
))
{
devProxy
.
forEach
((
proxyConfig
)
=>
{
app
.
use
(
proxyConfig
.
path
,
createProxyMiddleware
(
proxyConfig
.
options
))
})
}
if
(
compiler
)
{
if
(
options
.
hot
===
true
)
{
...
...
packages/chameleon-tool/configs/getCommonConfig.js
浏览文件 @
0855a7e3
...
...
@@ -13,7 +13,7 @@ const ChameleonErrorsWebpackPlugin = require('chameleon-errors-webpack-plugin');
const
fs
=
require
(
'
fs
'
);
const
cmlUtils
=
require
(
'
chameleon-tool-utils
'
);
const
ExtraWatchWebpackPlugin
=
require
(
'
extra-watch-webpack-plugin
'
);
//
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const
DuplicatePackageCheckerPlugin
=
require
(
'
duplicate-package-checker-webpack-plugin
'
);
module
.
exports
=
function
(
options
)
{
let
{
...
...
@@ -46,7 +46,7 @@ module.exports = function (options) {
if
(
!
publicPath
)
{
publicPath
=
`http://
${
config
.
ip
}
:
${
webServerPort
}
/
${
type
}
/`
}
let
chameleonConfig
=
cml
.
config
.
get
();
let
commonConfig
=
{
stats
:
cml
.
logLevel
===
'
debug
'
?
'
verbose
'
:
'
none
'
,
output
:
{
...
...
@@ -144,7 +144,7 @@ module.exports = function (options) {
options
:
{
cmlType
:
type
,
media
,
check
:
c
ml
.
config
.
get
()
.
check
check
:
c
hameleonConfig
.
check
}
}
]
...
...
@@ -158,11 +158,12 @@ module.exports = function (options) {
'
process.env.platform
'
:
JSON
.
stringify
(
type
)
}),
new
ChameleonErrorsWebpackPlugin
({
cmlType
:
type
cmlType
:
type
,
showWarning
:
chameleonConfig
.
optimize
&&
chameleonConfig
.
optimize
.
showWarning
})
]
}
if
(
c
ml
.
config
.
get
()
.
enableGlobalCheck
===
true
)
{
if
(
c
hameleonConfig
.
enableGlobalCheck
===
true
)
{
commonConfig
.
plugins
.
push
(
new
WebpackCheckPlugin
({
cmlType
:
type
,
...
...
@@ -204,11 +205,11 @@ module.exports = function (options) {
dirs
:
[
path
.
join
(
cml
.
projectRoot
,
'
mock/api
'
)]
})
);
//
commonConfig.plugins.push(
//
new DuplicatePackageCheckerPlugin({
//
verbose: true
//
})
//
);
commonConfig
.
plugins
.
push
(
new
DuplicatePackageCheckerPlugin
({
verbose
:
true
})
);
}
// 兼容旧版api
commonConfig
.
plugins
.
push
(
new
webpack
.
DefinePlugin
({
...
...
@@ -230,7 +231,11 @@ module.exports = function (options) {
assetNameRegExp
:
/
\.
css$/
,
cssProcessorOptions
:
{
safe
:
true
,
discardComments
:
{
removeAll
:
true
},
autoprefixer
:
false
}
}),
new
UglifyJsPlugin
({})
new
UglifyJsPlugin
({
compress
:
{
drop_console
:
true
}
})
])
}
...
...
@@ -245,7 +250,7 @@ module.exports = function (options) {
}
let
subProject
=
c
ml
.
config
.
get
()
.
subProject
;
let
subProject
=
c
hameleonConfig
.
subProject
;
if
(
subProject
&&
subProject
.
length
>
0
)
{
subProject
.
forEach
(
item
=>
{
let
npmName
=
cmlUtils
.
isString
(
item
)
?
item
:
item
.
npmName
;
...
...
packages/chameleon-tool/lib/config.js
浏览文件 @
0855a7e3
...
...
@@ -175,7 +175,8 @@ var chameleonConfig = {
}
},
optimize
:
{
watchNodeModules
:
false
// 默认不对node_modules中的文件进行watch,提升编译性能
watchNodeModules
:
false
,
// 默认不对node_modules中的文件进行watch,提升编译性能
showWarning
:
false
// 为了兼容原来的配置,默认不开启构建过程中的警告信息,开启之后配合,DuplicatePackageCheckerPlugin 可以在构建过程中检查是否有重复npm包引入
}
}
...
...
packages/chameleon-tool/npm-shrinkwrap.json
浏览文件 @
0855a7e3
此差异已折叠。
点击以展开。
packages/chameleon-tool/package.json
浏览文件 @
0855a7e3
...
...
@@ -71,6 +71,7 @@
"glob-watcher"
:
"^5.0.3"
,
"html-loader"
:
"0.5.5"
,
"html-webpack-plugin"
:
"2.30.1"
,
"http-proxy-middleware"
:
"^1.0.4"
,
"inquirer"
:
"6.0.0"
,
"interface-loader"
:
"^1.0.6-alpha.5"
,
"ip"
:
"1.1.5"
,
...
...
packages/webpack-check-plugin/index.js
浏览文件 @
0855a7e3
const
check
=
require
(
'
./lib/check.js
'
);
const
chalk
=
require
(
'
chalk
'
);
const
IS_WIN
=
process
.
platform
.
indexOf
(
'
win
'
)
===
0
class
WebpackCheckPlugin
{
constructor
(
options
)
{
this
.
options
=
Object
.
assign
({
...
...
@@ -24,8 +24,13 @@ class WebpackCheckPlugin {
var
type
=
options
.
cmlType
;
compilation
.
modules
.
forEach
(
module
=>
{
// 项目内的文件做校验
if
(
module
.
resource
&&
module
.
resource
.
indexOf
(
cml
.
projectRoot
)
===
0
)
{
// 项目内的文件做校验 并且 对于路径包括chameleon-tool的不进行校验,因为cli可能会被安装在项目内部
let
cliName
=
'
chameleon-tool
'
;
// 内网的会被替换成 @didi/chameleon-cli 注意windows下的兼容
if
(
IS_WIN
)
{
cliName
=
cliName
.
replace
(
/
\/
/g
,
'
\\
'
)
}
let
inChameleonTool
=
module
.
resource
&&
module
.
resource
.
includes
(
cliName
)
if
(
module
.
resource
&&
module
.
resource
.
indexOf
(
cml
.
projectRoot
)
===
0
&&
!
inChameleonTool
)
{
// 白名单内的文件不做校验
let
whiteListFileLength
=
options
.
whiteListFile
.
length
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录