Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
third_party_jsframework
提交
a0e55c8a
T
third_party_jsframework
项目概览
OpenHarmony
/
third_party_jsframework
9 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
third_party_jsframework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a0e55c8a
编写于
10月 17, 2022
作者:
B
buzhifeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mock napi index 文件导入重名适配
Signed-off-by:
N
buzhifeng
<
buzhifeng2@huawei.com
>
上级
943efce6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
29 deletion
+11
-29
mock-generate/build.js
mock-generate/build.js
+2
-27
mock-generate/src/generate/generateCommonMethodSignature.ts
mock-generate/src/generate/generateCommonMethodSignature.ts
+1
-1
mock-generate/src/generate/generateIndex.ts
mock-generate/src/generate/generateIndex.ts
+8
-1
未找到文件。
mock-generate/build.js
浏览文件 @
a0e55c8a
const
fs
=
require
(
'
fs
'
);
const
fs
=
require
(
'
fs
'
);
const
{
spawn
}
=
require
(
'
child_process
'
);
const
{
spawn
Sync
}
=
require
(
'
child_process
'
);
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
const
os
=
require
(
'
os
'
);
const
os
=
require
(
'
os
'
);
function
compileMock
()
{
function
compileMock
()
{
...
@@ -11,37 +11,12 @@ function compileMock() {
...
@@ -11,37 +11,12 @@ function compileMock() {
nodeDir
=
'
./node-v12.18.4-darwin-x64/bin/node
'
;
nodeDir
=
'
./node-v12.18.4-darwin-x64/bin/node
'
;
}
}
const
bat
=
spawn
(
`
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
..
'
,
'
./node_modules/typescript/bin/tsc
'
)}
&&
const
bat
=
spawn
Sync
(
`
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
..
'
,
'
./node_modules/typescript/bin/tsc
'
)}
&&
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
dist
'
)}
/main.js &&
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
dist
'
)}
/main.js &&
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
..
'
,
'
./node_modules/eslint/bin/eslint.js
'
)}
-c .eslintrc --fix
${
mockJsPath
}
/**/*.js`
,
{
${
path
.
join
(
__dirname
,
'
..
'
,
nodeDir
)}
${
path
.
join
(
__dirname
,
'
..
'
,
'
./node_modules/eslint/bin/eslint.js
'
)}
-c .eslintrc --fix
${
mockJsPath
}
/**/*.js`
,
{
cwd
:
__dirname
,
cwd
:
__dirname
,
shell
:
true
shell
:
true
});
});
shellOutput
(
bat
);
}
function
shellOutput
(
bat
)
{
bat
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
const
lines
=
`
${
data
}
`
.
split
(
/
\r{0,1}\n
/
);
if
(
lines
)
{
lines
.
forEach
(
line
=>
{
if
(
line
.
length
>
0
)
{
console
.
log
(
line
.
toString
());
}
});
}
});
bat
.
stderr
.
on
(
'
data
'
,
(
data
)
=>
{
const
lines
=
`
${
data
}
`
.
split
(
/
\r{0,1}\n
/
);
if
(
lines
)
{
lines
.
forEach
(
line
=>
{
if
(
line
.
length
>
0
)
{
console
.
log
(
line
.
toString
());
}
});
}
});
}
}
compileMock
();
compileMock
();
mock-generate/src/generate/generateCommonMethodSignature.ts
浏览文件 @
a0e55c8a
...
@@ -64,7 +64,7 @@ export function generateCommonMethodSignature(rootName: string, methodSignatureA
...
@@ -64,7 +64,7 @@ export function generateCommonMethodSignature(rootName: string, methodSignatureA
isReturnPromise
=
true
;
isReturnPromise
=
true
;
}
}
});
});
if
(
isReturnPromise
)
{
if
(
isReturnPromise
&&
isCallBack
)
{
methodSignatureBody
+=
`else {
methodSignatureBody
+=
`else {
return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
resolve('[PC Preview] unknow boolean');
resolve('[PC Preview] unknow boolean');
...
...
mock-generate/src/generate/generateIndex.ts
浏览文件 @
a0e55c8a
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
{
firstCharacterToUppercase
}
from
"
../common/commonUtils
"
;
/**
/**
* save all mock function
* save all mock function
*/
*/
...
@@ -40,7 +42,12 @@ export function generateIndex(): string {
...
@@ -40,7 +42,12 @@ export function generateIndex(): string {
let
isHasSameValue
=
false
;
let
isHasSameValue
=
false
;
if
(
filterSet
.
has
(
value
.
mockFunctionName
))
{
if
(
filterSet
.
has
(
value
.
mockFunctionName
))
{
isHasSameValue
=
true
;
isHasSameValue
=
true
;
functionName
=
`_
${
value
.
mockFunctionName
}
`
;
const
tmpArr
=
value
.
fileName
.
split
(
'
_
'
);
let
tmpName
=
tmpArr
[
0
];
for
(
let
i
=
1
;
i
<
tmpArr
.
length
;
i
++
)
{
tmpName
+=
firstCharacterToUppercase
(
tmpArr
[
i
]);
}
functionName
=
`
${
tmpName
}
`
;
}
}
filterSet
.
add
(
functionName
);
filterSet
.
add
(
functionName
);
if
(
isHasSameValue
)
{
if
(
isHasSameValue
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录