Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Z_04_syys
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
Z_04_syys
Commits
795a4873
Commit
795a4873
authored
Aug 20, 2020
by
huoshizhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 自动化打包完成
parent
8cd992fe
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
237 additions
and
224 deletions
+237
-224
.gitignore
.gitignore
+3
-0
publish.js
form/bin/publish.js
+2
-1
publish_2.js
form/bin/publish_2.js
+0
-115
syys.fire
play/assets/z_04_syys/scene/syys.fire
+197
-64
syys.js
play/assets/z_04_syys/scene/syys.js
+2
-2
project.json
play/settings/project.json
+1
-0
build.bat
publish/build.bat
+0
-8
build.cmd
publish/build.cmd
+2
-0
build.js
publish/build.js
+30
-34
No files found.
.gitignore
View file @
795a4873
/publish/form
/publish/play
/publish/node_modules
/publish/publish/play
/publish/publish/form
/publish/publish/*.zip
form/bin/publish.js
View file @
795a4873
...
...
@@ -69,7 +69,8 @@ const runSpawn = async function (){
let
zippath
=
path
.
resolve
(
__dirname
,
"
../dist
"
,
pkg
.
name
);
//压缩包的存放目录
let
date
=
new
Date
();
let
zipname
=
pkg
.
name
+
"
_
"
+
date
.
Format
(
"
yyyyMMdd hh-mm-ss
"
);
// let zipname = pkg.name+"_"+date.Format("yyyyMMdd hh-mm-ss");
let
zipname
=
'
form
'
;
let
zipdir
=
path
.
resolve
(
__dirname
,
"
../publish/
"
+
zipname
+
"
.zip
"
);
clean
(
zipdir
);
//删除原有的包
...
...
form/bin/publish_2.js
deleted
100644 → 0
View file @
8cd992fe
/****
* 批量编译打包模板工具
* 运行 npm run publish T_01 命令来打包T_01模板
* 运行 npm run publish T_01,T_02,T_03,T_04 命令来分别打包 T_01,T_02,T_03,T_04 这四个模板,注意逗号要用英文的
* 运行 npm run publish all 命令来打包所有模板
*/
const
spawn
=
require
(
'
child_process
'
).
spawn
;
const
path
=
require
(
"
path
"
);
const
fs
=
require
(
"
fs
"
);
const
os
=
require
(
'
os
'
);
const
compressing
=
require
(
"
compressing
"
);
//Linux系统上'Linux'
//macOS 系统上'Darwin'
//Windows系统上'Windows_NT'
let
sysType
=
os
.
type
();
Date
.
prototype
.
Format
=
function
(
fmt
)
{
var
o
=
{
"
M+
"
:
this
.
getMonth
()
+
1
,
"
d+
"
:
this
.
getDate
(),
"
h+
"
:
this
.
getHours
(),
"
m+
"
:
this
.
getMinutes
(),
"
s+
"
:
this
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
"
S
"
:
this
.
getMilliseconds
()
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
this
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
));
for
(
var
k
in
o
)
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)));
return
fmt
;
}
function
clean
(
zipPath
){
if
(
fs
.
existsSync
(
zipPath
)){
fs
.
unlinkSync
(
zipPath
);
}
}
const
runSpawn
=
async
function
(){
await
new
Promise
(
function
(
resolve
,
reject
){
let
pkg
=
require
(
"
../package.json
"
);
let
ls
;
if
(
sysType
===
"
Windows_NT
"
){
//ng build --prod --build--optimizer --base-href /ng-one/
ls
=
spawn
(
"
cmd.exe
"
,
[
'
/c
'
,
'
ng
'
,
'
build
'
,
'
--prod
'
,
'
--build--optimizer
'
,
'
--base-href
'
,
'
/template-base-href/
'
]
);
}
else
{
ls
=
spawn
(
"
ng
"
,
[
'
build
'
,
'
--prod
'
,
'
--build--optimizer
'
,
'
--base-href
'
,
'
/template-base-href/
'
]
);
}
ls
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`
${
data
}
`
);
});
ls
.
stderr
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`stderr:
${
data
}
`
);
reject
();
});
ls
.
on
(
'
close
'
,
(
code
)
=>
{
console
.
log
(
`child process exited with code
${
code
}
`
);
//要压缩的目录
let
zippath
=
path
.
resolve
(
__dirname
,
"
../dist
"
,
pkg
.
name
);
//压缩包的存放目录
let
date
=
new
Date
();
// let zipname = pkg.name+"_"+date.Format("yyyyMMdd hh-mm-ss");
let
zipname
=
'
form
'
;
let
zipdir
=
path
.
resolve
(
__dirname
,
"
../publish/
"
+
zipname
+
"
.zip
"
);
clean
(
zipdir
);
//删除原有的包
const
tarStream
=
new
compressing
.
zip
.
Stream
();
fs
.
readdir
(
zippath
,
function
(
err
,
files
){
if
(
err
){
console
.
log
(
"
======文件打开异常======
"
);
console
.
log
(
err
);
reject
();
}
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
){
tarStream
.
addEntry
(
zippath
+
"
/
"
+
files
[
i
]);
}
let
writeStream
=
fs
.
createWriteStream
(
zipdir
);
tarStream
.
pipe
(
writeStream
);
writeStream
.
on
(
'
close
'
,
()
=>
{
console
.
log
(
`模板
${
pkg
.
name
}
打包已完成!`
);
resolve
();
})
});
});
});
}
// let projects = "";
// if(process.argv.length<3){
// console.log("缺少参数");
// return;
// }
// projects = process.argv[2];
let
exec
=
async
function
(){
//压缩模板
await
runSpawn
();
}
exec
();
play/assets/z_04_syys/scene/syys.fire
View file @
795a4873
...
...
@@ -78,22 +78,22 @@
"__id__": 8
},
{
"__id__":
48
"__id__":
50
}
],
"_active": true,
"_components": [
{
"__id__": 5
0
"__id__": 5
2
},
{
"__id__": 5
1
"__id__": 5
3
},
{
"__id__": 5
2
"__id__": 5
4
},
{
"__id__": 5
3
"__id__": 5
5
}
],
"_prefab": null,
...
...
@@ -183,7 +183,7 @@
"array": [
0,
0,
530.
3187749955615
,
530.
8735725198609
,
0,
0,
0,
...
...
@@ -384,31 +384,34 @@
"__id__": 14
},
{
"__id__": 1
5
"__id__": 1
6
},
{
"__id__": 1
9
"__id__": 1
7
},
{
"__id__": 2
2
"__id__": 2
1
},
{
"__id__":
33
"__id__":
24
},
{
"__id__":
40
"__id__":
35
},
{
"__id__": 44
"__id__": 42
},
{
"__id__": 46
}
],
"_active": true,
"_components": [
{
"__id__": 4
6
"__id__": 4
8
},
{
"__id__": 4
7
"__id__": 4
9
}
],
"_prefab": null,
...
...
@@ -718,6 +721,136 @@
"_N$target": null,
"_id": "18UTk0lXJDAqsdv+mOBQkG"
},
{
"__type__": "cc.Node",
"_name": "BtnWheel",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 250,
"height": 300
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-453.613,
248.796,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "94qRkJLitFTKW165CylmUA"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "b0yXRAUxRPNanaC5goUhJV"
},
{
"__type__": "cc.Node",
"_name": "NodeBubblePos",
...
...
@@ -785,13 +918,13 @@
},
"_children": [
{
"__id__": 1
6
"__id__": 1
8
}
],
"_active": true,
"_components": [
{
"__id__":
18
"__id__":
20
}
],
"_prefab": null,
...
...
@@ -847,13 +980,13 @@
"_name": "NodeTree",
"_objFlags": 0,
"_parent": {
"__id__": 1
5
"__id__": 1
7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 1
7
"__id__": 1
9
}
],
"_prefab": null,
...
...
@@ -909,7 +1042,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
6
"__id__": 1
8
},
"_enabled": true,
"_materials": [
...
...
@@ -941,7 +1074,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
5
"__id__": 1
7
},
"_enabled": true,
"_materials": [
...
...
@@ -967,10 +1100,10 @@
"_active": true,
"_components": [
{
"__id__": 2
0
"__id__": 2
2
},
{
"__id__": 2
1
"__id__": 2
3
}
],
"_prefab": null,
...
...
@@ -1026,7 +1159,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
19
"__id__":
21
},
"_enabled": true,
"_materials": [
...
...
@@ -1058,7 +1191,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
19
"__id__":
21
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -1088,9 +1221,6 @@
"__id__": 8
},
"_children": [
{
"__id__": 23
},
{
"__id__": 25
},
...
...
@@ -1102,6 +1232,9 @@
},
{
"__id__": 31
},
{
"__id__": 33
}
],
"_active": true,
...
...
@@ -1159,13 +1292,13 @@
"_name": "NodeFishPos_0",
"_objFlags": 0,
"_parent": {
"__id__": 2
2
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
4
"__id__": 2
6
}
],
"_prefab": null,
...
...
@@ -1221,7 +1354,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
3
"__id__": 2
5
},
"_enabled": true,
"_materials": [
...
...
@@ -1253,13 +1386,13 @@
"_name": "NodeFishPos_1",
"_objFlags": 0,
"_parent": {
"__id__": 2
2
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
6
"__id__": 2
8
}
],
"_prefab": null,
...
...
@@ -1315,7 +1448,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
5
"__id__": 2
7
},
"_enabled": true,
"_materials": [
...
...
@@ -1347,13 +1480,13 @@
"_name": "NodeFishPos_2",
"_objFlags": 0,
"_parent": {
"__id__": 2
2
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
28
"__id__":
30
}
],
"_prefab": null,
...
...
@@ -1409,7 +1542,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
7
"__id__": 2
9
},
"_enabled": true,
"_materials": [
...
...
@@ -1441,13 +1574,13 @@
"_name": "NodeFishPos_3",
"_objFlags": 0,
"_parent": {
"__id__": 2
2
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
0
"__id__": 3
2
}
],
"_prefab": null,
...
...
@@ -1503,7 +1636,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
29
"__id__":
31
},
"_enabled": true,
"_materials": [
...
...
@@ -1535,13 +1668,13 @@
"_name": "NodeFishPos_4",
"_objFlags": 0,
"_parent": {
"__id__": 2
2
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
2
"__id__": 3
4
}
],
"_prefab": null,
...
...
@@ -1597,7 +1730,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
1
"__id__": 3
3
},
"_enabled": true,
"_materials": [
...
...
@@ -1632,14 +1765,14 @@
"__id__": 8
},
"_children": [
{
"__id__": 34
},
{
"__id__": 36
},
{
"__id__": 38
},
{
"__id__": 40
}
],
"_active": true,
...
...
@@ -1697,13 +1830,13 @@
"_name": "NodeCharacterNormal",
"_objFlags": 0,
"_parent": {
"__id__": 3
3
"__id__": 3
5
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
5
"__id__": 3
7
}
],
"_prefab": null,
...
...
@@ -1759,7 +1892,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
4
"__id__": 3
6
},
"_enabled": true,
"_materials": [
...
...
@@ -1799,13 +1932,13 @@
"_name": "NodeCharacterWalk",
"_objFlags": 0,
"_parent": {
"__id__": 3
3
"__id__": 3
5
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
7
"__id__": 3
9
}
],
"_prefab": null,
...
...
@@ -1861,7 +1994,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
6
"__id__": 3
8
},
"_enabled": true,
"_materials": [
...
...
@@ -1901,13 +2034,13 @@
"_name": "NodeCharacterWater",
"_objFlags": 0,
"_parent": {
"__id__": 3
3
"__id__": 3
5
},
"_children": [],
"_active": false,
"_components": [
{
"__id__":
39
"__id__":
41
}
],
"_prefab": null,
...
...
@@ -1963,7 +2096,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
38
"__id__":
40
},
"_enabled": true,
"_materials": [
...
...
@@ -2007,13 +2140,13 @@
},
"_children": [
{
"__id__": 4
1
"__id__": 4
3
}
],
"_active": true,
"_components": [
{
"__id__": 4
3
"__id__": 4
5
}
],
"_prefab": null,
...
...
@@ -2069,13 +2202,13 @@
"_name": "NodeKnock",
"_objFlags": 0,
"_parent": {
"__id__": 4
0
"__id__": 4
2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
2
"__id__": 4
4
}
],
"_prefab": null,
...
...
@@ -2131,7 +2264,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
1
"__id__": 4
3
},
"_enabled": true,
"_materials": [
...
...
@@ -2163,7 +2296,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
0
"__id__": 4
2
},
"_enabled": true,
"_materials": [
...
...
@@ -2189,7 +2322,7 @@
"_active": false,
"_components": [
{
"__id__": 4
5
"__id__": 4
7
}
],
"_prefab": null,
...
...
@@ -2245,7 +2378,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
4
"__id__": 4
6
},
"_enabled": true,
"_materials": [
...
...
@@ -2342,7 +2475,7 @@
"_active": true,
"_components": [
{
"__id__":
49
"__id__":
51
}
],
"_prefab": null,
...
...
@@ -2398,7 +2531,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
48
"__id__":
50
},
"_enabled": true,
"开门": {
...
...
play/assets/z_04_syys/scene/syys.js
View file @
795a4873
...
...
@@ -103,8 +103,8 @@ cc.Class({
},
initListeners
()
{
const
nodeWheel
=
cc
.
find
(
'
Canvas/NodeBg/Node
Wheel
'
);
node
Wheel
.
on
(
'
click
'
,
()
=>
{
const
btnWheel
=
cc
.
find
(
'
Canvas/NodeBg/Btn
Wheel
'
);
btn
Wheel
.
on
(
'
click
'
,
()
=>
{
this
.
onClickWheel
();
});
},
...
...
play/settings/project.json
View file @
795a4873
...
...
@@ -8,6 +8,7 @@
]
],
"excluded-modules"
:
[
"3D Physics/cannon.js"
,
"3D Physics/Builtin"
],
"preview-port"
:
7456
,
...
...
publish/build.bat
deleted
100644 → 0
View file @
8cd992fe
cd ../play
CocosCreator.exe --path "./" --build "configPath=../publish/buildConfig.json" --force
cd ../form
npm run publish_2
cd ../publish
node build.js
pause
publish/build.cmd
0 → 100644
View file @
795a4873
cd ../form & npm run publish & cd ../play & CocosCreator.exe --path "./" --build "configPath=../publish/buildConfig.json" --force & cd ../publish & node build.js
pause
publish/build.js
View file @
795a4873
...
...
@@ -16,54 +16,50 @@ async function initFiles() {
}
}
async
function
copyDir
(
src
,
dst
)
{
// fs.fileex
const
exists
=
await
fs
.
existsSync
(
dst
);
if
(
!
exists
)
{
await
fs
.
mkdirSync
(
dst
);
}
//读取目录
const
paths
=
await
fs
.
readdirSync
(
src
);
paths
.
forEach
(
async
function
(
path
)
{
const
newSrc
=
`
${
src
}
/
${
path
}
`
;
const
newDst
=
`
${
dst
}
/
${
path
}
`
;
const
st
=
await
fs
.
statSync
(
newSrc
);
if
(
st
.
isFile
())
{
console
.
log
(
'
copy
'
+
newDst
);
const
data
=
await
fs
.
readFileSync
(
newSrc
);
await
fs
.
writeFileSync
(
newDst
,
data
);
}
else
if
(
st
.
isDirectory
())
{
copyDir
(
newSrc
,
newDst
);
}
});
}
async
function
main
()
{
let
date
=
new
Date
();
let
fileName
=
`Release_
${
date
.
getFullYear
()}${
fix2
(
date
.
getMonth
()
+
1
)}${
fix2
(
date
.
getDate
())}
`
;
fileName
+=
`
${
fix2
(
date
.
getHours
())}
-
${
fix2
(
date
.
getMinutes
())}
-
${
fix2
(
date
.
getSeconds
())}
`
;
// await initFiles();
await
copyDir
(
'
../play/build/web-desktop
'
,
'
./publish/play
'
);
const
data
=
await
fs
.
readFileSync
(
'
./index.html
'
);
await
fs
.
writeFileSync
(
'
./publish/play/index.html
'
,
data
);
compressing
.
zip
.
uncompress
(
'
../form/publish/form.zip
'
,
'
./publish/form
'
)
.
then
(()
=>
{
const
tarStream
=
new
compressing
.
zip
.
Stream
();
tarStream
.
addEntry
(
'
.
./play/build/web-desktop
'
);
tarStream
.
addEntry
(
'
.
/publish/play
'
);
tarStream
.
addEntry
(
'
./publish/form
'
);
const
destStream
=
fs
.
createWriteStream
(
`publish/
${
fileName
}
.zip`
);
tarStream
.
pipe
(
destStream
);
console
.
log
(
'
打包完成!
'
);
});
}
main
();
// var copy = async function (src, dst) {
// //读取目录
// const paths = await fs.readdirSync(src);
// paths.forEach(async function (path) {
// const newSrc = `${src}/${path}`;
// const newDst = `${dst}/${path}`;
// const st = await fs.statSync(newSrc);
// if (st.isFile()) {
// const data = await fs.readFileSync(newSrc);
// await fs.writeFileSync(newDst, data);
// } else if (st.isDirectory()) {
// exists(newSrc, newDst, copy);
// }
// });
// }
// var exists = function (src, dst, callback) {
// //测试某个路径下文件是否存在
// fs.exists(dst, function (exists) {
// if (exists) {//不存在
// callback(src, dst);
// } else {//存在
// fs.mkdir(dst, function () {//创建目录
// callback(src, dst)
// })
// }
// })
// }
// exists('../from', '../to', copy)
\ No newline at end of file
main
();
\ 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