Commit 66c8f75e authored by wildfirecode's avatar wildfirecode

init

parent b6c9f2fa
module.exports = {
opn: 0,
devPort: 8080,
proxy: {
'/ngapi/*': 'http://localhost:3000',
'/plugin/*': 'http://localhost:3000',
'/ngame/*': 'http://localhost:3000',
'/activityCommon/*': 'http://localhost:3000',
'/ctool/*': 'http://localhost:3000',
'/activityVist/*': 'http://localhost:3000',
'/collectGoods/*': 'http://localhost:3000',
'/activityPlugDrawInfo/*': 'http://localhost:3000',
'/collectRule/*': 'http://localhost:3000',
'/hdtool/*': 'http://localhost:3000',
'/activityPlugin/*': 'http://localhost:3000',
'/summer/*': 'http://localhost:3000'
}
}
\ No newline at end of file
# 所有空行或者以注释符号 # 开头的行都会被 Git 忽略。
# 可以使用标准的 glob 模式匹配。
# 匹配模式最后跟反斜杠(/)说明要忽略的是目录。
# 要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(! )取反。
# 所谓的 glob 模式是指 shell 所使用的简化了的正则表达式。星号(*)匹配零个或多个任
# 意字符; [abc] 匹配任何一个列在方括号中的字符(这个例子要么匹配一个 a,要么匹配一
# 个 b,要么匹配一个 c);问号(?)只匹配一个任意字符;如果在方括号中使用短划线分
# 隔两个字符,表示所有在这两个字符范围内的都可以匹配(比如 [0-9] 表示匹配所有 0 到
# 9 的数字)。
# 书上的一个例子
# #此为注释 – 将被 Git 忽略
# *.a
# 忽略所有 .a 结尾的文件
# !lib.a
# 但 lib.a 除外
# /TODO
# 仅仅忽略项目根目录下的 TODO 文件,不包括 subdir/TODO
# build/
# 忽略 build/ 目录下的所有文件
# doc/*.txt
# 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt
node_modules
bin-release
.DS_Store
egret/.DS_Store
**/*/.tmproject
\ No newline at end of file
registry = http://npm.dui88.com/
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080/egret/index.html",
"webRoot": "${workspaceFolder}"
}
]
}
\ No newline at end of file
# duiba-egret-games
## 安装和更新构建工具
重新拉取代码,然后安装依赖。
``` bash
git pull && cnpm install
```
## 启动本地服务器
``` bash
npm run dev
```
之后会自动打开浏览器。建议在vscode中f5调试,效率更高。
## 发布
### 全发布
```bash
npm run build
```
### 仅仅发布src下的TS代码
``` bash
npm run buildTS
```
之后只需要更新皮肤中的`output.js`文件的版本号
```js
<script crossorigin="anonymous" src="//yun.duiba.com.cn/db_games/activity/demo/1537173012/output.js"></script>
```
### 仅仅发布exmls文件
``` bash
npm run buildExml
```
之后只需要更新皮肤中的`default.thm.js`文件的版本号
```js
<script crossorigin="anonymous" src="//yun.duiba.com.cn/db_games/activity/demo/1537172754/resource/default.thm.js"></script>
```
## demo
- demo皮肤 https://mng.duiba.com.cn/DuibaNgameBrick/edit/476
- demo线上url http://activity-2.m.duiba.com.cn/ngame/index?id=3122353&dbnewopen&dpm=1.5.677.4&dcm=202.3122353.4.677
## 项目结构介绍
### .vscode
vscode调试配置文件,需要提前安装chrome debugger插件。
### egret
egret相关根目录。特别说明:暂时无法把其中文件放到根目录,后续优化。
- bin-release 发布文件目录,oss提交根目录
- libs库文件夹
- resource对应egret的resource
- scripts为发布相关脚本
- src源码目录。
- template勿删。
- autoMerger.js生成图集合并的项目配置文件。
- egretProperties.json,egret项目配置
- index.html,入口文件。
- project.json,同以前,后续考虑优化掉。
- publish.js oss发布文件。
- tsconfig.json ,ts配置。
- wingProperties.json,egret wing配置。
### mock
mock配置,同以前。
### .buildrc.js
构建配置
### .npmrc
npm源配置。
### build.js
构建脚本。
## 说明
### 自动化图集合并说明
不会合并组内的jpg。一般jpg都是外部加载,合入png图集,会显著增加png图集的体积
## 未来
- 增加webp支持,提升载入速度。
- 基于asm的mock api
- 更快的编译(优化devtool)
- 更高效的研发:引入HRM
## 背景
尽量保持以往的开发习惯,减少工作流的环节变更,减少迁移引擎导致的成本
## 优势
- 一键发布
- 自动化编译,极快的编译速度,极致的开发效率。抛弃了egret build,因为它非常的慢,空项目编译2秒,项目代码越多编译越慢,而且还需要手动编译。
- 非常快的首屏载入速度。合并了所有egret相关库为单独一个文件 //yun.duiba.com.cn/db_games/lib2_game.min.js,抛弃了非常慢的基于manifest的串行加载。(egert p2.js cdn //yun.duiba.com.cn/db_games/physics.min.js)
- tinypng图片压缩由手动升级为自动,大大提升研发效率
- 自动化合并图集。开发阶段不需要合并图集,大大提升开发效率。
- 修改exmls等其他项目文件后自动刷新浏览,进一步提升研发效率。
- 0成本迁移tc和tw(无需要修改代码)
- 0成本迁移mock
- 暂不使用egret的网络通讯库,仍然使用zepto(有空优化)
- 其他无成本迁移的开发习惯,比如自动编译、自动刷新浏览器、编辑器vscode、webstorm习惯等。
- 项目初始化简化:现在依赖只需要安装一次,不需要每个项目都安装一次。移除了project.json。
- 和其他egret工具、流程兼容,比如exml编辑器egret wing。
- 以前一个皮就是一个项目。现在只有一个vscode项目,方便管理项目。
- 使用新的git流,可以有效的减少整个仓库的体积,几十上百个项目,其实有用的不多
- 相对以前发布速度极快。只有代码变更的时候,只需要编译ts发布,只有exmls文件变更的时候,只发布exmls,大大节省了发布时间。
- 现在代码里有基本的panel,scene,loading可以参考一下,后续会独立成类似tl、wx的库
## 项目创建和维护流程
1.先建立一个分支
git checkout -b kickball-20180910
2.然后duiba-games下直接创建【项目名称】的文件夹kickball-20180910
3.push分支到远程
git push --set-upstream origin kickball-20180910
4.然后在分支下开发,如果是新类型游戏,将来可能需要换皮的,那么备份到backup下。移动 kickball-20180910到backup。
5.然后合并到主分支。
git checkout dev
git merge kickball-20180910
git push
6、因为已经backup,所以这个分支已经没用了,删除分支
git branch -D kickball-20180910
git push origin :kickball-20180910
如果不需backup后面要维护,那么留着分支,不必合并到主分支。这样可以避免频繁提交导致的频繁git pull,提升效率。
\ No newline at end of file
// let argvs = JSON.parse(process.env.npm_config_argv);
// let remain = argvs.remain;
let cmd = process.argv[2];
const DBGBuild = require('duiba-game-build');
const config = require('./.buildrc');
let build = new DBGBuild(config);
if (cmd === 'build' && process.argv[3] === 'prod') {
// if (cmd === 'build' && remain[1] === 'prod') {
cmd = 'buildProd';
if (process.argv[4] === 'ts')
cmd = 'buildProdTS';
if (process.argv[4] === 'exml')
cmd = 'buildProdEXML';
}
build[cmd]('egret');
console.log();
\ No newline at end of file
let inquirer = require('inquirer');
const spawn = require('cross-spawn');
const questions = require('./question');
let moment = require('moment');
const today = moment().format('YYYYMMDD');
inquirer.prompt(questions).then(answers => {
let cmdType = answers.commandType || '';
let skinName = answers.skinName || '';
let branchName = answers.branchName || '';
let cmd = '';
switch (cmdType) {
case 'create':
cmd = `npm run copy ${skinName}`;
break;
case 'create_react':
cmd = `npm run copy ${skinName} custom-react`;
break;
case 'prettier':
cmd = 'npm run lint';
break;
case 'develop':
cmd = `npm run dev ${skinName}`;
break;
case 'build_test':
cmd = `npm run build ${skinName}`;
break;
case 'build_prod':
cmd = `npm run build ${skinName} prod`;
break;
case 'backup':
cmd = `npm run backup`;
break;
case 'create_branch':
cmd = `git checkout -b feature/${today}-${branchName}`;
break;
default:
break;
}
if (cmd) {
cmd = cmd.split(' ');
let _cmd = cmd[0];
let _args = cmd.slice(1);
var ls = spawn(_cmd, _args);
ls.stdout.on('data', data => {
console.log(`${data}`);
});
ls.stderr.on('data', data => {
console.log(`stderr: ${data}`);
});
ls.on('close', code => {
// console.log(`子进程退出码:${code}`);
});
}
});
{
"global": {
"globalBindingDataTestObj": []
},
"1667fb18fa6": {
"bindingDataTestObj": [
{
"key": "list",
"value": "[1,2]"
}
]
},
"16680af117c": {
"bindingDataTestObj": []
},
"16680af117d": {
"bindingDataTestObj": [
{
"key": "data.message",
"value": "积分不足 \\n 多赚点再来吧"
}
]
}
}
\ No newline at end of file
{
"version": "0.2.0",
"configurations": [
{
"name": "Wing 内置播放器调试",
"type": "chrome",
"request": "launch",
"file": "index.html",
//"url": "http://mysite.com/index.html",
"runtimeExecutable": "${execPath}",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"port":5826
},
{
"name": "使用本机 Chrome 调试",
"type": "chrome",
"request": "launch",
"file": "index.html",
//"url": "http://mysite.com/index.html",
"runtimeExecutable": "",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"preLaunchTask":"build",
"userDataDir":"${tmpdir}",
"port":5826
}
]
}
\ No newline at end of file
{
"version": "0.1.0",
"command": "egret",
"isShellCommand": true,
"tasks": [
{
"taskName": "build",
"showOutput": "always",
"args": [
"build",
"-sourcemap"
],
"problemMatcher": "$tsc"
},
{
"taskName": "clean",
"showOutput": "always",
"args": [
"build",
"-e"
],
"problemMatcher": "$tsc"
},
{
"taskName": "publish",
"showOutput": "always",
"args": [
"publish"
],
"problemMatcher": "$tsc"
}
]
}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var fs = require("fs");
var path = require("path");
var resjsons = ["resource/default.res.json"];
//要扫描的res.json文件
var targetDir = "resource/TextureMerger";
//输出目录
var pathNor = path.relative(targetDir, "resource");
//返回一个相对路径
var tempindex = 0;
//创建输出文件夹
if (resjsons.length > 0) {
if (!fs.existsSync(targetDir)) {
// var paths = path.normalize(targetDir).split("\\"); //windows 下使用
var paths = path.normalize(targetDir).split("\/");
//mac linux 下使用
var target = ".";
for (var _i = 0,
paths_1 = paths; _i < paths_1.length; _i++) {
var p = paths_1[_i];
// target += ("\\" + p); // windows 下使用
target += ("\/" + p);
// mac linux 下使用
if (!fs.existsSync(target))
// 根据路径创建文件夹
fs.mkdirSync(target);
}
}
}
var _loop_1 = function (resJson) {
// 判断是否是res.json文件
if (fs.existsSync(resJson) && resJson.indexOf("res.json") > -1) {
var defaultJson = fs.readFileSync(resJson, "utf-8");
// 解析res.json文件内容
var defaultObject = JSON.parse(defaultJson);
var groups = defaultObject.groups;
//组
var resources = defaultObject.resources;
//资源
var resourcesHash_1 = {};
// 用来存放resources的资源信息
// 遍历resources
for (var _i = 0,
resources_1 = resources; _i < resources_1.length; _i++) {
var resource = resources_1[_i];
resourcesHash_1[resource.name] = resource.url;
}
// 遍历groups
for (var _a = 0,
groups_1 = groups; _a < groups_1.length; _a++) {
var group = groups_1[_a];
var tmproject = {};
//用来存放tmproject文件的信息
// tmproject文件配置
tmproject["options"] = {
"layoutMath": "2",
"sizeMode": "2n",
"useExtension": 1,
"layoutGap": 1,
"extend": 0
};
// projectName
tmproject["projectName"] = group.name;
// tmproject["projectName"] = group.name + "_" + tempindex;
// 版本
tmproject["version"] = 5;
tempindex++;
// 获取res.json分组的keys, 并分割成数组
var oldkeys = group.keys.split(",");
var oldkeysHash = {};
// 遍历oldkeys
for (var _b = 0,
oldkeys_1 = oldkeys; _b < oldkeys_1.length; _b++) {
var key = oldkeys_1[_b];
// 保存到oldkeysHash对象中
oldkeysHash[key] = true;
}
var newKeys = [];
// 遍历oldkeys
for (var _c = 0,
oldkeys_2 = oldkeys; _c < oldkeys_2.length; _c++) {
var key = oldkeys_2[_c];
if (key.indexOf("json") == -1) {
if (!oldkeysHash[key.replace("png", "json")]) {
//粒子和龙骨对应的图集不合图
if (!oldkeysHash[key.replace("png", "fnt")])
//位图字体
newKeys.push(key);
}
// else
// if (key.indexOf("jpg") > -1) {
// newKeys.push(key);
// }
}
}
oldkeysHash = {};
oldkeys = [];
// files路径
var urls = newKeys.map(function (key) {
return path.join(pathNor, resourcesHash_1[key]);
});
tmproject["files"] = urls;
// 根据tmproject写入文件
if (urls.length > 0) {
fs.writeFileSync(path.join(targetDir, tmproject["projectName"] + ".tmproject"), JSON.stringify(tmproject));
console.log('==> '+tmproject["projectName"] + '.tmproject创建完毕.')
}
tmproject = {};
}
}
};
//根据数组开始扫描
for (var _a = 0,
resjsons_1 = resjsons; _a < resjsons_1.length; _a++) {
var resJson = resjsons_1[_a];
_loop_1(resJson);
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment