Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP17
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
OP17
Commits
53902fd1
Commit
53902fd1
authored
Nov 25, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善编译命令
parent
3c6b05a3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
22 deletions
+39
-22
app.js
bin/app.js
+11
-6
buildCocos.js
bin/buildCocos.js
+26
-0
package.json
package.json
+1
-1
cocos_generator.meta
play/assets/cocos_generator.meta
+1
-15
No files found.
bin/app.js
View file @
53902fd1
const
express
=
require
(
'
express
'
);
const
express
=
require
(
'
express
'
);
const
os
=
require
(
'
os
'
);
const
os
=
require
(
'
os
'
);
const
readline
=
require
(
'
readline
'
);
const
readline
=
require
(
'
readline
'
);
const
{
build
}
=
require
(
'
./buildCocos
'
);
const
{
build
,
buildAndroid
,
buildIos
}
=
require
(
'
./buildCocos
'
);
const
networkInfo
=
os
.
networkInterfaces
();
const
networkInfo
=
os
.
networkInterfaces
();
...
@@ -33,6 +33,11 @@ var server = app.listen(8081, function () {
...
@@ -33,6 +33,11 @@ var server = app.listen(8081, function () {
console
.
log
(
"
如果已经build可访问如下地址
"
);
console
.
log
(
"
如果已经build可访问如下地址
"
);
console
.
log
(
"
http://%s:%s/dist/play/index.html
"
,
host
,
port
)
console
.
log
(
"
http://%s:%s/dist/play/index.html
"
,
host
,
port
)
console
.
log
(
"
http://%s:%s/dist/play/index.html
"
,
"
localhost
"
,
port
)
console
.
log
(
"
http://%s:%s/dist/play/index.html
"
,
"
localhost
"
,
port
)
console
.
log
(
'
-----------------
'
);
console
.
log
(
"
输入 build 构建全部脚本
"
);
console
.
log
(
"
输入 build android 构建安卓脚本
"
);
console
.
log
(
"
输入 build ios 构建IOS脚本
"
);
console
.
log
(
'
-----------------
'
);
})
})
...
@@ -43,10 +48,10 @@ const rl = readline.createInterface({
...
@@ -43,10 +48,10 @@ const rl = readline.createInterface({
rl
.
on
(
'
line
'
,
async
(
str
)
=>
{
rl
.
on
(
'
line
'
,
async
(
str
)
=>
{
if
(
str
.
trim
()
==
'
build
'
)
{
if
(
str
.
trim
()
==
'
build
'
)
{
await
build
();
await
build
();
console
.
log
(
"
测试服务已启动:%s:%s
"
,
host
,
port
)
}
else
if
(
str
.
trim
()
==
'
build android
'
)
{
console
.
log
(
'
输入 build 构建。
'
)
await
buildAndroid
();
}
else
{
}
else
if
(
str
.
trim
()
==
'
build ios
'
)
{
console
.
log
(
"
测试服务已启动:%s:%s
"
,
host
,
port
)
await
buildIos
();
console
.
log
(
'
输入 build 构建。
'
)
}
}
console
.
log
(
"
服务器:%s:%s
"
,
host
,
port
)
})
})
bin/buildCocos.js
View file @
53902fd1
...
@@ -336,4 +336,30 @@ module.exports = {
...
@@ -336,4 +336,30 @@ module.exports = {
console
.
log
(
`用时
${
duration
.
getMinutes
()}
分
${
duration
.
getSeconds
()}
秒。`
);
console
.
log
(
`用时
${
duration
.
getMinutes
()}
分
${
duration
.
getSeconds
()}
秒。`
);
},
},
buildAndroid
:
async
function
()
{
// 改设置为bundle
changeSettingsToBundle
();
await
removeDir
(
'
dist/android
'
);
await
buildAndroidBundle
();
await
copyDir
(
'
play/build_android/jsb-link/remote
'
,
'
dist/android
'
);
console
.
log
(
'
构建 android bundle 成功!
'
);
// 改设置为非bundle
changeSettingToWebDesktop
();
},
buildIos
:
async
function
()
{
// 改设置为bundle
changeSettingsToBundle
();
await
removeDir
(
'
dist/ios
'
);
await
buildIosBundle
();
await
copyDir
(
'
play/build_ios/jsb-link/remote
'
,
'
dist/ios
'
);
console
.
log
(
'
构建 ios bundle 成功!
'
);
// 改设置为非bundle
changeSettingToWebDesktop
();
}
};
};
package.json
View file @
53902fd1
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"main"
:
"build.js"
,
"main"
:
"build.js"
,
"scripts"
:
{
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"
build
"
:
"node ./bin/build.js"
,
"
publish
"
:
"node ./bin/build.js"
,
"start"
:
"node ./bin/app.js"
"start"
:
"node ./bin/app.js"
},
},
"author"
:
""
,
"author"
:
""
,
...
...
play/assets/cocos_generator.meta
View file @
53902fd1
{
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
"ver": "1.1.2",
\ No newline at end of file
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment