Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_cocos_dds
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
dfzx_cocos_dds
Commits
618dfdb1
Commit
618dfdb1
authored
Mar 15, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 打包脚本更新
parent
b5dbef21
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
5 deletions
+52
-5
et_13.js
play/assets/et_13/script/et_13.js
+3
-1
build.sh
publish/build.sh
+4
-0
build_check.js
publish/build_check.js
+9
-3
build_step_0.js
publish/build_step_0.js
+16
-0
build_step_1.js
publish/build_step_1.js
+20
-0
.DS_Store
publish/publish/.DS_Store
+0
-0
utils.js
publish/utils.js
+0
-1
No files found.
play/assets/et_13/script/et_13.js
View file @
618dfdb1
...
@@ -91,7 +91,9 @@ cc.Class({
...
@@ -91,7 +91,9 @@ cc.Class({
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
onHomeworkFinish
(()
=>
{});
if
(
middleLayerComponent
.
role
==
'
student
'
)
{
middleLayerComponent
.
onHomeworkFinish
(()
=>
{
});
}
return
;
return
;
}
}
},
},
...
...
publish/build
_app
.sh
→
publish/build.sh
View file @
618dfdb1
...
@@ -14,6 +14,10 @@ npm install
...
@@ -14,6 +14,10 @@ npm install
npm run publish
npm run publish
cd
../publish
node build_step_0.js
cd
../play
cd
../play
/Applications/CocosCreator/Creator/2.4.0/CocosCreator.app/Contents/MacOS/CocosCreator
--path
"./"
--build
"platform=web-desktop;debug=true"
--force
/Applications/CocosCreator/Creator/2.4.0/CocosCreator.app/Contents/MacOS/CocosCreator
--path
"./"
--build
"platform=web-desktop;debug=true"
--force
...
...
publish/build_check.js
View file @
618dfdb1
...
@@ -3,10 +3,16 @@ let fs = require('fs');
...
@@ -3,10 +3,16 @@ let fs = require('fs');
const
dirNames
=
__dirname
.
split
(
'
/
'
);
const
dirNames
=
__dirname
.
split
(
'
/
'
);
const
projectName
=
dirNames
[
dirNames
.
length
-
2
];
const
projectName
=
dirNames
[
dirNames
.
length
-
2
];
const
path
=
'
../play/assets
'
const
path
=
'
../play/assets
'
const
folderName
=
fs
.
readdirSync
(
path
)[
0
];
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
}
});
if
(
projectName
!=
folderName
)
{
if
(
projectName
!=
folderName
)
{
throw
(
'
项目名与bundle文件夹名不相同
'
);
throw
(
`项目名(
${
projectName
}
)与bundle文件夹名(
${
folderName
}
)不相同`
);
}
}
let
same
=
false
;
let
same
=
false
;
const
files
=
fs
.
readdirSync
(
`
${
path
}
/
${
folderName
}
/scene`
);
const
files
=
fs
.
readdirSync
(
`
${
path
}
/
${
folderName
}
/scene`
);
...
@@ -22,5 +28,5 @@ files.forEach(fileName => {
...
@@ -22,5 +28,5 @@ files.forEach(fileName => {
});
});
if
(
!
same
)
{
if
(
!
same
)
{
throw
(
'
bundle文件夹名称与scene名称不相同
'
);
throw
(
`bundle文件夹名称(
${
folderName
}
)与scene名称不相同`
);
}
}
\ No newline at end of file
publish/build_step_0.js
0 → 100644
View file @
618dfdb1
let
fs
=
require
(
'
fs
'
);
const
path
=
'
../play/assets
'
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
}
});
const
metaPath
=
`
${
path
}
/
${
folderName
}
.meta`
;
const
metaDataStr
=
fs
.
readFileSync
(
metaPath
);
const
metaData
=
JSON
.
parse
(
metaDataStr
);
metaData
.
isBundle
=
false
;
fs
.
writeFileSync
(
metaPath
,
JSON
.
stringify
(
metaData
));
publish/build_step_1.js
View file @
618dfdb1
const
{
removeDir
,
copyDir
,
fix2
}
=
require
(
'
./utils
'
);
const
{
removeDir
,
copyDir
,
fix2
}
=
require
(
'
./utils
'
);
const
compressing
=
require
(
'
compressing
'
);
const
compressing
=
require
(
'
compressing
'
);
let
fs
=
require
(
'
fs
'
);
async
function
main
()
{
async
function
main
()
{
await
removeDir
(
'
./publish/play
'
);
await
removeDir
(
'
./publish/play
'
);
...
@@ -12,6 +13,25 @@ async function main() {
...
@@ -12,6 +13,25 @@ async function main() {
await
fs
.
writeFileSync
(
'
./publish/play/index.html
'
,
data
);
await
fs
.
writeFileSync
(
'
./publish/play/index.html
'
,
data
);
await
removeDir
(
'
../play/build/web-desktop
'
);
await
removeDir
(
'
../play/build/web-desktop
'
);
const
path
=
'
../play/assets
'
let
folderName
=
''
;
fs
.
readdirSync
(
path
).
find
(
fileName
=>
{
const
st
=
fs
.
statSync
(
`
${
path
}
/
${
fileName
}
`
);
if
(
st
.
isDirectory
())
{
folderName
=
fileName
;
}
});
const
metaPath
=
`
${
path
}
/
${
folderName
}
.meta`
;
const
metaDataStr
=
fs
.
readFileSync
(
metaPath
);
const
metaData
=
JSON
.
parse
(
metaDataStr
);
metaData
.
isBundle
=
true
;
metaData
.
isRemoteBundle
=
{
ios
:
true
,
android
:
true
};
fs
.
writeFileSync
(
metaPath
,
JSON
.
stringify
(
metaData
));
}
}
main
();
main
();
\ No newline at end of file
publish/publish/.DS_Store
View file @
618dfdb1
No preview for this file type
publish/utils.js
View file @
618dfdb1
...
@@ -39,7 +39,6 @@ module.exports = {
...
@@ -39,7 +39,6 @@ module.exports = {
//读取目录
//读取目录
const
st
=
await
fs
.
statSync
(
src
);
const
st
=
await
fs
.
statSync
(
src
);
console
.
log
(
st
);
const
paths
=
await
fs
.
readdirSync
(
src
);
const
paths
=
await
fs
.
readdirSync
(
src
);
for
(
let
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
let
path
=
paths
[
i
];
let
path
=
paths
[
i
];
...
...
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