Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
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
middleLayer_for_debug
Commits
c91f6f98
Commit
c91f6f98
authored
Nov 15, 2021
by
huoshizhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 本地服务器
parent
9dda9208
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1110 additions
and
187 deletions
+1110
-187
middleLayer_for_debug.meta
play/assets/middleLayer_for_debug.meta
+24
-1
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+576
-101
app.js
publish/app.js
+49
-82
build.js
publish/build.js
+2
-0
buildCocos.js
publish/buildCocos.js
+72
-2
package-lock.json
publish/package-lock.json
+384
-0
package.json
publish/package.json
+3
-1
No files found.
play/assets/middleLayer_for_debug.meta
View file @
c91f6f98
{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{"android":"default","ios":"default"},"optimizeHotUpdate":{"android":false,"ios":false},"inlineSpriteFrames":{"android":false,"ios":false},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
{
\ No newline at end of file
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {
"android": "default",
"ios": "default"
},
"optimizeHotUpdate": {
"android": false,
"ios": false
},
"inlineSpriteFrames": {
"android": false,
"ios": false
},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
play/assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
c91f6f98
This diff is collapsed.
Click to expand it.
publish/app.js
View file @
c91f6f98
import
{
import
express
from
"
express
"
;
buildWebDesktop
,
import
os
from
"
os
"
;
buildAndroidBundle
,
import
readline
from
"
readline
"
;
buildIosBundle
,
import
{
build
}
from
"
./buildCocos.js
"
;
buildWebBundle
,
createConfigFile
,
const
networkInfo
=
os
.
networkInterfaces
();
build_check
,
changeSettingsToBundle
,
let
host
=
''
;
changeSettingToWebDesktop
,
for
(
const
infos
of
Object
.
values
(
networkInfo
))
{
compressAll
,
for
(
const
info
of
infos
)
{
replaceIndexHtml
,
if
(
info
.
family
==
'
IPv4
'
)
{
replaceUuids
if
(
info
.
address
.
split
(
'
.
'
)[
0
]
!=
"
127
"
)
{
}
from
"
./buildCocos.js
"
;
host
=
info
.
address
;
import
{
copyDir
,
removeDir
}
from
"
./utils.js
"
;
}
}
const
startTime
=
new
Date
().
getTime
();
}
}
// 构建前检查
const
projectName
=
build_check
();
var
app
=
express
();
// 清理旧文件
app
.
use
(
'
/publish
'
,
express
.
static
(
'
publish
'
));
await
removeDir
(
'
./publish/play
'
);
await
removeDir
(
'
./publish/form
'
);
app
.
get
(
'
/
'
,
function
(
req
,
res
)
{
await
removeDir
(
'
./publish/ios
'
);
res
.
send
(
'
Hello World
'
);
await
removeDir
(
'
./publish/android
'
);
})
await
removeDir
(
'
./publish/web_desktop
'
);
let
port
=
''
;
// 构建form
var
server
=
app
.
listen
(
8081
,
function
()
{
copyDir
(
'
../form/src
'
,
'
publish/form
'
);
port
=
server
.
address
().
port
// 替换uuid
replaceUuids
();
console
.
log
(
"
测试服务已启动:%s:%s
"
,
host
,
port
)
// 构建play
})
// 改设置为非bundle
const
rl
=
readline
.
createInterface
({
changeSettingToWebDesktop
();
input
:
process
.
stdin
,
output
:
process
.
stdout
// 构建web_desktop
})
await
buildWebDesktop
();
rl
.
on
(
'
line
'
,
async
(
str
)
=>
{
if
(
str
.
trim
()
==
'
build
'
)
{
await
copyDir
(
'
../play/build/web-desktop
'
,
'
publish/play
'
);
await
build
();
console
.
log
(
"
测试服务已启动:%s:%s
"
,
host
,
port
)
replaceIndexHtml
();
console
.
log
(
'
输入 build 构建。
'
)
}
else
{
console
.
log
(
'
构建 web desktop 成功!
'
);
console
.
log
(
"
测试服务已启动:%s:%s
"
,
host
,
port
)
console
.
log
(
'
输入 build 构建。
'
)
// 改设置为bundle
}
changeSettingsToBundle
();
})
await
buildAndroidBundle
();
await
copyDir
(
'
../play/build_android/jsb-link/remote
'
,
'
publish/android
'
);
console
.
log
(
'
构建 android bundle 成功!
'
);
await
buildIosBundle
();
await
copyDir
(
'
../play/build_ios/jsb-link/remote
'
,
'
publish/ios
'
);
console
.
log
(
'
构建 ios bundle 成功!
'
);
await
buildWebBundle
();
await
copyDir
(
`../play/build_web_desktop/web-desktop/assets/
${
projectName
}
`
,
'
publish/web_desktop
'
);
console
.
log
(
'
构建 web bundle 成功!
'
);
// 改设置为非bundle
changeSettingToWebDesktop
();
createConfigFile
(
projectName
);
compressAll
(
projectName
);
const
endTime
=
new
Date
().
getTime
();
const
duration
=
new
Date
(
endTime
-
startTime
);
console
.
log
(
`打包完成!`
);
console
.
log
(
`用时
${
duration
.
getMinutes
()}
分
${
duration
.
getSeconds
()}
秒。`
);
publish/build.js
0 → 100644
View file @
c91f6f98
import
{
build
}
from
"
./buildCocos.js
"
;
await
build
();
\ No newline at end of file
publish/buildCocos.js
View file @
c91f6f98
import
{
spawn
}
from
"
child_process
"
;
import
{
spawn
}
from
"
child_process
"
;
import
fs
from
"
fs
"
;
import
fs
from
"
fs
"
;
import
compressing
from
'
compressing
'
;
import
compressing
from
'
compressing
'
;
import
{
fix2
}
from
"
./utils.js
"
;
import
{
v4
,
parse
}
from
'
uuid
'
;
import
{
v4
,
parse
}
from
'
uuid
'
;
import
{
Base64
}
from
'
js-base64
'
;
import
{
Base64
}
from
'
js-base64
'
;
import
{
copyDir
,
removeDir
,
fix2
}
from
"
./utils.js
"
;
const
creatorBasePath
=
'
C:
\\
CocosDashboard_1.0.6
\\
resources
\\
.editors
\\
Creator
'
;
export
async
function
build
()
{
const
startTime
=
new
Date
().
getTime
();
// 构建前检查
const
projectName
=
build_check
();
// 清理旧文件
await
removeDir
(
'
./publish/play
'
);
await
removeDir
(
'
./publish/form
'
);
await
removeDir
(
'
./publish/ios
'
);
await
removeDir
(
'
./publish/android
'
);
await
removeDir
(
'
./publish/web_desktop
'
);
// 构建form
copyDir
(
'
../form/src
'
,
'
publish/form
'
);
// 替换uuid
replaceUuids
();
// 构建play
// 改设置为非bundle
changeSettingToWebDesktop
();
// 构建web_desktop
await
buildWebDesktop
();
await
copyDir
(
'
../play/build/web-desktop
'
,
'
publish/play
'
);
replaceIndexHtml
();
console
.
log
(
'
构建 web desktop 成功!
'
);
// 改设置为bundle
changeSettingsToBundle
();
await
buildAndroidBundle
();
await
copyDir
(
'
../play/build_android/jsb-link/remote
'
,
'
publish/android
'
);
console
.
log
(
'
构建 android bundle 成功!
'
);
await
buildIosBundle
();
await
copyDir
(
'
../play/build_ios/jsb-link/remote
'
,
'
publish/ios
'
);
console
.
log
(
'
构建 ios bundle 成功!
'
);
await
buildWebBundle
();
await
copyDir
(
`../play/build_web_desktop/web-desktop/assets/
${
projectName
}
`
,
'
publish/web_desktop
'
);
console
.
log
(
'
构建 web bundle 成功!
'
);
// 改设置为非bundle
changeSettingToWebDesktop
();
createConfigFile
(
projectName
);
compressAll
(
projectName
);
const
endTime
=
new
Date
().
getTime
();
const
duration
=
new
Date
(
endTime
-
startTime
);
console
.
log
(
`打包完成!`
);
console
.
log
(
`用时
${
duration
.
getMinutes
()}
分
${
duration
.
getSeconds
()}
秒。`
);
}
const
creatorBasePath
=
'
C:
\\
CocosDashboard_1.0.6
\\
resources
\\
.editors
\\
Creator
'
;
export
function
buildWebDesktop
()
{
export
function
buildWebDesktop
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
buffer
=
spawn
(
const
buffer
=
spawn
(
...
...
publish/package-lock.json
View file @
c91f6f98
This diff is collapsed.
Click to expand it.
publish/package.json
View file @
c91f6f98
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +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 build.js"
,
"start"
:
"node app.js"
"start"
:
"node app.js"
},
},
"type"
:
"module"
,
"type"
:
"module"
,
...
@@ -13,7 +14,8 @@
...
@@ -13,7 +14,8 @@
"dependencies"
:
{
"dependencies"
:
{
"child_process"
:
"^1.0.2"
,
"child_process"
:
"^1.0.2"
,
"compressing"
:
"^1.5.1"
,
"compressing"
:
"^1.5.1"
,
"express"
:
"^4.17.1"
,
"js-base64"
:
"^3.7.2"
,
"js-base64"
:
"^3.7.2"
,
"uuid"
:
"^8.3.2"
"uuid"
:
"^8.3.2"
}
}
}
}
\ 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