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
67c3cec7
Commit
67c3cec7
authored
Dec 01, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 打包脚本
parent
63ce70b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
buildCocos.js
bin/buildCocos.js
+26
-6
No files found.
bin/buildCocos.js
View file @
67c3cec7
...
...
@@ -227,6 +227,7 @@ function changeSettingsToBundle () {
function
replaceUuids
()
{
console
.
log
(
'
build_step_0 开始~!
'
);
const
path
=
'
assets
'
function
getFolderName
(
path
)
{
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
...
...
@@ -237,6 +238,31 @@ function replaceUuids () {
});
return
folderName
;
}
const
folderName
=
getFolderName
(
path
);
let
oldFireUuid
=
''
;
let
oldJsUuid
=
''
;
let
oldJsShortUuid
=
''
;
let
oldJsId
=
''
;
const
fireMetaStr
=
fs
.
readFileSync
(
`assets/
${
folderName
}
/scene/
${
folderName
}
.fire.meta`
);
if
(
fireMetaStr
.
indexOf
(
'
57ea7c61-9b8b-498a-b024-c98ee9124beb
'
)
>
0
)
{
// 老Cocos脚手架
oldFireUuid
=
'
57ea7c61-9b8b-498a-b024-c98ee9124beb
'
;
oldJsUuid
=
'
f4ede462-f8d7-4069-ba80-915611c058ca
'
;
oldJsShortUuid
=
'
f4edeRi+NdAabqAkVYRwFjK
'
;
oldJsId
=
'
e687yyoRBIzZAOVRL8Sseh
'
;
}
if
(
fireMetaStr
.
indexOf
(
'
0737ce42-24f0-45c6-8e1a-8bdab4f74ba3
'
)
>
0
)
{
// 新Cocos脚手架
oldFireUuid
=
'
0737ce42-24f0-45c6-8e1a-8bdab4f74ba3
'
;
oldJsUuid
=
'
408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5
'
;
oldJsShortUuid
=
'
408a6f4ZfpM8Yzyg+IOGg/V
'
;
oldJsId
=
'
eaTVUpqahPfZeO9+sUI7RP
'
;
}
if
(
oldFireUuid
===
''
)
{
return
;
}
function
editFolderMeta
(
path
,
folderName
)
{
const
metaPath
=
`
${
path
}
/
${
folderName
}
.meta`
;
const
metaDataStr
=
fs
.
readFileSync
(
metaPath
);
...
...
@@ -258,19 +284,13 @@ function replaceUuids () {
return
uuid
.
substring
(
0
,
5
)
+
Base64
.
fromUint8Array
(
bytes
).
substring
(
2
);
}
const
path
=
'
assets
'
const
folderName
=
getFolderName
(
path
);
editFolderMeta
(
path
,
folderName
);
const
oldFireUuid
=
'
0737ce42-24f0-45c6-8e1a-8bdab4f74ba3
'
;
const
newFireUuid
=
v4
();
fileReplace
(
`assets/
${
folderName
}
/scene/
${
folderName
}
.fire.meta`
,
oldFireUuid
,
newFireUuid
);
fileReplace
(
`assets/
${
folderName
}
/scene/
${
folderName
}
.fire`
,
oldFireUuid
,
newFireUuid
);
fileReplace
(
'
settings/builder.json
'
,
oldFireUuid
,
newFireUuid
);
const
oldJsUuid
=
'
408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5
'
;
const
oldJsShortUuid
=
'
408a6f4ZfpM8Yzyg+IOGg/V
'
;
const
oldJsId
=
'
eaTVUpqahPfZeO9+sUI7RP
'
;
const
newJsUuid
=
v4
();
const
newJsShortUuid
=
getShortUuid
(
newJsUuid
);
const
newJsId
=
v4
().
replace
(
/-/g
,
''
).
substring
(
0
,
oldJsId
.
length
);
...
...
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