Skip to content

Commit

Permalink
upgrade 5.2.28
Browse files Browse the repository at this point in the history
  • Loading branch information
runinspring committed Sep 11, 2019
1 parent 4f11e37 commit c13aad4
Show file tree
Hide file tree
Showing 88 changed files with 924 additions and 462 deletions.
4 changes: 2 additions & 2 deletions agora/demo/egretProperties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"engineVersion": "5.2.27",
"compilerVersion": "5.2.27",
"engineVersion": "5.2.28",
"compilerVersion": "5.2.28",
"template": {},
"target": {
"current": "web"
Expand Down
4 changes: 4 additions & 0 deletions agora/demo/scripts/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ declare module 'built-in' {
* 其他传递的消息参数
*/
info?:any
/**
* use wechat engine plugin
*/
useWxPlugin?: boolean
}

/**
Expand Down
7 changes: 5 additions & 2 deletions agora/demo/scripts/config.vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
Expand All @@ -28,11 +28,14 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
new UglifyPlugin([{
sources: ["resource/default.thm.js"],
target: "default.thm.min.js"
}, {
sources: ["main.js"],
target: "main.min.js"
}
Expand Down
48 changes: 31 additions & 17 deletions agora/demo/scripts/vivogame/vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export class VivogamePlugin implements plugins.Command {
async onFile(file: plugins.File) {
if (file.extname == '.js') {
const filename = file.origin;
this.jsFileList.push(file.basename)

if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
return null;
}
this.jsFileList.push(file.basename)
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
let content = file.contents.toString();
content += `;window.egret = egret;`;
Expand Down Expand Up @@ -86,27 +87,40 @@ export class VivogamePlugin implements plugins.Command {
const gameJSONPath = path.join(pluginContext.outputDir, "manifest.json");
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
gameJSONContent.deviceOrientation = orientation;
let engineVersion = this.readData(path.join(pluginContext.projectRoot, "egretProperties.json")).engineVersion
if(!gameJSONContent.thirdEngine)gameJSONContent.thirdEngine={}
gameJSONContent.thirdEngine.egret = engineVersion

fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
let isPublish = pluginContext.buildConfig.command == "publish" ? true : false;
let configOption = "webpackConf.externals = Object.assign(webpackConf.externals || {\n\t\t"
let configArr: any[] = []
for (var i = 0, len = this.jsFileList.length; i < len; i++) {
let jsFile = this.jsFileList[i];
if(isPublish && jsFile == "main.js"){
jsFile = 'main.min.js'
}
configOption += `"js/${jsFile}":"commonjs js/${jsFile}"`
if (i < len - 1) {
configOption += ",\n\t\t"
} else {
configOption += "\n\t\t"
if (isPublish) {
if (jsFile == "main.js") {
jsFile = 'main.min.js'
} else if (jsFile == "default.thm.js") {
jsFile = "default.thm.min.js"
}
}
configArr.push(JSON.stringify({
module_name: `./js/${jsFile}`,
module_path: `./js/${jsFile}`,
module_from: `engine/js/${jsFile}`,
}, null, "\t"))
}
configOption += "})"
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configOption + '\n\t\t\/\/----auto option end----';

const webpackConfigPath = path.join(pluginContext.outputDir, '../config', "webpack.config.js");
let configJSContent = fs.readFileSync(webpackConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(webpackConfigPath, configJSContent);
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configArr.toString() + '\n\t\t\/\/----auto option end----';
const minigameConfigPath = path.join(pluginContext.outputDir,"../", "minigame.config.js");
if(!fs.existsSync(minigameConfigPath)){
//5.2.28版本,vivo更新了项目结构,老项目需要升级
fs.writeFileSync(path.join(pluginContext.outputDir,"../","vivo更新了项目结构,请重新创建vivo小游戏项目.js"), "vivo更新了项目结构,请重新创建vivo小游戏项目");
}else{
let configJSContent = fs.readFileSync(minigameConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(minigameConfigPath, configJSContent);
}
}
readData(filePath: string): any {
return JSON.parse(fs.readFileSync(filePath, { encoding: "utf8" }));
}
}
4 changes: 2 additions & 2 deletions benchmark/demo/egretProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"path": "../libsrc"
}
],
"engineVersion": "5.2.27",
"compilerVersion": "5.2.27"
"engineVersion": "5.2.28",
"compilerVersion": "5.2.28"
}
4 changes: 4 additions & 0 deletions benchmark/demo/scripts/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ declare module 'built-in' {
* 其他传递的消息参数
*/
info?:any
/**
* use wechat engine plugin
*/
useWxPlugin?: boolean
}

/**
Expand Down
7 changes: 5 additions & 2 deletions benchmark/demo/scripts/config.vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
Expand All @@ -28,11 +28,14 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
new UglifyPlugin([{
sources: ["resource/default.thm.js"],
target: "default.thm.min.js"
}, {
sources: ["main.js"],
target: "main.min.js"
}
Expand Down
48 changes: 31 additions & 17 deletions benchmark/demo/scripts/vivogame/vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export class VivogamePlugin implements plugins.Command {
async onFile(file: plugins.File) {
if (file.extname == '.js') {
const filename = file.origin;
this.jsFileList.push(file.basename)

if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
return null;
}
this.jsFileList.push(file.basename)
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
let content = file.contents.toString();
content += `;window.egret = egret;`;
Expand Down Expand Up @@ -86,27 +87,40 @@ export class VivogamePlugin implements plugins.Command {
const gameJSONPath = path.join(pluginContext.outputDir, "manifest.json");
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
gameJSONContent.deviceOrientation = orientation;
let engineVersion = this.readData(path.join(pluginContext.projectRoot, "egretProperties.json")).engineVersion
if(!gameJSONContent.thirdEngine)gameJSONContent.thirdEngine={}
gameJSONContent.thirdEngine.egret = engineVersion

fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
let isPublish = pluginContext.buildConfig.command == "publish" ? true : false;
let configOption = "webpackConf.externals = Object.assign(webpackConf.externals || {\n\t\t"
let configArr: any[] = []
for (var i = 0, len = this.jsFileList.length; i < len; i++) {
let jsFile = this.jsFileList[i];
if(isPublish && jsFile == "main.js"){
jsFile = 'main.min.js'
}
configOption += `"js/${jsFile}":"commonjs js/${jsFile}"`
if (i < len - 1) {
configOption += ",\n\t\t"
} else {
configOption += "\n\t\t"
if (isPublish) {
if (jsFile == "main.js") {
jsFile = 'main.min.js'
} else if (jsFile == "default.thm.js") {
jsFile = "default.thm.min.js"
}
}
configArr.push(JSON.stringify({
module_name: `./js/${jsFile}`,
module_path: `./js/${jsFile}`,
module_from: `engine/js/${jsFile}`,
}, null, "\t"))
}
configOption += "})"
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configOption + '\n\t\t\/\/----auto option end----';

const webpackConfigPath = path.join(pluginContext.outputDir, '../config', "webpack.config.js");
let configJSContent = fs.readFileSync(webpackConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(webpackConfigPath, configJSContent);
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configArr.toString() + '\n\t\t\/\/----auto option end----';
const minigameConfigPath = path.join(pluginContext.outputDir,"../", "minigame.config.js");
if(!fs.existsSync(minigameConfigPath)){
//5.2.28版本,vivo更新了项目结构,老项目需要升级
fs.writeFileSync(path.join(pluginContext.outputDir,"../","vivo更新了项目结构,请重新创建vivo小游戏项目.js"), "vivo更新了项目结构,请重新创建vivo小游戏项目");
}else{
let configJSContent = fs.readFileSync(minigameConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(minigameConfigPath, configJSContent);
}
}
readData(filePath: string): any {
return JSON.parse(fs.readFileSync(filePath, { encoding: "utf8" }));
}
}
4 changes: 2 additions & 2 deletions dcagent/demo/egretProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"path": "${EGRET_DEFAULT}"
}
],
"engineVersion": "5.2.27",
"compilerVersion": "5.2.27"
"engineVersion": "5.2.28",
"compilerVersion": "5.2.28"
}
4 changes: 4 additions & 0 deletions dcagent/demo/scripts/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ declare module 'built-in' {
* 其他传递的消息参数
*/
info?:any
/**
* use wechat engine plugin
*/
useWxPlugin?: boolean
}

/**
Expand Down
7 changes: 5 additions & 2 deletions dcagent/demo/scripts/config.vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
Expand All @@ -28,11 +28,14 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
new UglifyPlugin([{
sources: ["resource/default.thm.js"],
target: "default.thm.min.js"
}, {
sources: ["main.js"],
target: "main.min.js"
}
Expand Down
48 changes: 31 additions & 17 deletions dcagent/demo/scripts/vivogame/vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export class VivogamePlugin implements plugins.Command {
async onFile(file: plugins.File) {
if (file.extname == '.js') {
const filename = file.origin;
this.jsFileList.push(file.basename)

if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
return null;
}
this.jsFileList.push(file.basename)
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
let content = file.contents.toString();
content += `;window.egret = egret;`;
Expand Down Expand Up @@ -86,27 +87,40 @@ export class VivogamePlugin implements plugins.Command {
const gameJSONPath = path.join(pluginContext.outputDir, "manifest.json");
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
gameJSONContent.deviceOrientation = orientation;
let engineVersion = this.readData(path.join(pluginContext.projectRoot, "egretProperties.json")).engineVersion
if(!gameJSONContent.thirdEngine)gameJSONContent.thirdEngine={}
gameJSONContent.thirdEngine.egret = engineVersion

fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
let isPublish = pluginContext.buildConfig.command == "publish" ? true : false;
let configOption = "webpackConf.externals = Object.assign(webpackConf.externals || {\n\t\t"
let configArr: any[] = []
for (var i = 0, len = this.jsFileList.length; i < len; i++) {
let jsFile = this.jsFileList[i];
if(isPublish && jsFile == "main.js"){
jsFile = 'main.min.js'
}
configOption += `"js/${jsFile}":"commonjs js/${jsFile}"`
if (i < len - 1) {
configOption += ",\n\t\t"
} else {
configOption += "\n\t\t"
if (isPublish) {
if (jsFile == "main.js") {
jsFile = 'main.min.js'
} else if (jsFile == "default.thm.js") {
jsFile = "default.thm.min.js"
}
}
configArr.push(JSON.stringify({
module_name: `./js/${jsFile}`,
module_path: `./js/${jsFile}`,
module_from: `engine/js/${jsFile}`,
}, null, "\t"))
}
configOption += "})"
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configOption + '\n\t\t\/\/----auto option end----';

const webpackConfigPath = path.join(pluginContext.outputDir, '../config', "webpack.config.js");
let configJSContent = fs.readFileSync(webpackConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(webpackConfigPath, configJSContent);
const replaceConfigStr = '\/\/----auto option start----\n\t\t' + configArr.toString() + '\n\t\t\/\/----auto option end----';
const minigameConfigPath = path.join(pluginContext.outputDir,"../", "minigame.config.js");
if(!fs.existsSync(minigameConfigPath)){
//5.2.28版本,vivo更新了项目结构,老项目需要升级
fs.writeFileSync(path.join(pluginContext.outputDir,"../","vivo更新了项目结构,请重新创建vivo小游戏项目.js"), "vivo更新了项目结构,请重新创建vivo小游戏项目");
}else{
let configJSContent = fs.readFileSync(minigameConfigPath, { encoding: "utf8" });
configJSContent = configJSContent.replace(reg, replaceConfigStr);
fs.writeFileSync(minigameConfigPath, configJSContent);
}
}
readData(filePath: string): any {
return JSON.parse(fs.readFileSync(filePath, { encoding: "utf8" }));
}
}
4 changes: 2 additions & 2 deletions ecs/demo/egretProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"path": "../libsrc"
}
],
"engineVersion": "5.2.27",
"compilerVersion": "5.2.27"
"engineVersion": "5.2.28",
"compilerVersion": "5.2.28"
}
4 changes: 4 additions & 0 deletions ecs/demo/scripts/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ declare module 'built-in' {
* 其他传递的消息参数
*/
info?:any
/**
* use wechat engine plugin
*/
useWxPlugin?: boolean
}

/**
Expand Down
7 changes: 5 additions & 2 deletions ecs/demo/scripts/config.vivogame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
Expand All @@ -28,11 +28,14 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new CleanPlugin({ matchers: ["../engine", "resource"] }),
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new VivogamePlugin(),
new UglifyPlugin([{
sources: ["resource/default.thm.js"],
target: "default.thm.min.js"
}, {
sources: ["main.js"],
target: "main.min.js"
}
Expand Down
Loading

0 comments on commit c13aad4

Please sign in to comment.