save code
parent
b0c871484e
commit
e29ebfe7f9
|
@ -1,9 +1,8 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const do_task = require("./single-html/build");
|
||||
|
||||
const outputPrefix = '';
|
||||
const htmlChannel = ['applovin', 'unity', 'appier', 'ironsource', 'mintegral', 'moloco'];
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import do_task from './single-html/build'
|
||||
|
||||
|
||||
// 创建 dist 目录
|
||||
if (!fs.existsSync('dist')) {
|
||||
|
@ -11,7 +10,9 @@ if (!fs.existsSync('dist')) {
|
|||
}
|
||||
|
||||
// 处理 HTML 渠道
|
||||
async function processHtmlChannels() {
|
||||
async function processHtmlChannels(options) {
|
||||
const outputPrefix = options.outputPrefix || '';
|
||||
const htmlChannel = options.htmlChannel || ['applovin', 'unity', 'appier', 'ironsource', 'mintegral', 'moloco'];
|
||||
for (const channelName of htmlChannel) {
|
||||
// 删除所有可能存在的旧文件
|
||||
const filesToDelete = ['mraid_support.js', 'mraid.js', 'mintegral.js', 'moloco.js'];
|
||||
|
@ -115,4 +116,4 @@ async function processHtmlChannels() {
|
|||
}
|
||||
}
|
||||
|
||||
processHtmlChannels();
|
||||
export default processHtmlChannels;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node single-html/build.js",
|
||||
"build:zip": "node zipChannelScript.js",
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import zipChannel from './zipChannelScript.js'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
// 脚本执行之前的操作
|
||||
var iosUrl = "https://apps.apple.com/app/legend-of-mushroom/id6475333787"
|
||||
var androidUrl = "https://play.google.com/store/apps/details?id=com.mxdzzus.google"
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
function removeDist() {
|
||||
const isExists = fs.existsSync(path.join(__dirname, 'dist'))
|
||||
|
@ -59,10 +62,21 @@ function replaceCss() {
|
|||
}
|
||||
|
||||
|
||||
function startScript() {
|
||||
async function startScript() {
|
||||
removeDist()
|
||||
replaceCss()
|
||||
replaceAppStoreUrl()
|
||||
|
||||
const options = {
|
||||
// zip包
|
||||
zipChannel: ['facebook', 'google', 'tiktok', 'vungle', 'liftoff'],
|
||||
// html包
|
||||
htmlChannel: ['applovin', 'unity', 'appier', 'ironsource', 'mintegral', 'moloco'],
|
||||
outputPrefix: ''
|
||||
}
|
||||
|
||||
await zipChannel(Object.assign(options))
|
||||
await htmlChannel(Object.assign(options))
|
||||
console.log('脚本执行完毕')
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// Provides functions for encoding/decoding data to and from base-122.
|
||||
|
||||
let fs = require('fs')
|
||||
, readline = require('readline')
|
||||
;
|
||||
import * as fs from 'fs'
|
||||
import readline from 'readline'
|
||||
|
||||
const kString = 0
|
||||
, kUint8Array = 1
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
const uglify = require("uglify-js")
|
||||
const CleanCSS = require("clean-css")
|
||||
const brotli = require('brotli');
|
||||
const base122 = require("./base122")
|
||||
// 全部改成es6写法
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import uglify from 'uglify-js'
|
||||
import CleanCSS from 'clean-css'
|
||||
import brotli from 'brotli'
|
||||
import base122 from './base122'
|
||||
|
||||
/** 一些配置参数
|
||||
* - [注意] 路径问题.start脚本与web-mobile同层级,因此相对路径需要带上web-mobile;cocos在调用资源时没有web-mobile,需要在最后去掉
|
||||
|
@ -130,4 +131,4 @@ function do_task() {
|
|||
}
|
||||
|
||||
// 导出
|
||||
module.exports = do_task
|
||||
export default do_task
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const archiver = require("archiver");
|
||||
|
||||
const zipChannel = ['facebook', 'google', 'tiktok', 'vungle', 'liftoff'];
|
||||
|
||||
const outputPrefix = '';
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import archiver from 'archiver'
|
||||
|
||||
// 创建 dist 目录
|
||||
if (!fs.existsSync('dist')) {
|
||||
|
@ -12,7 +8,9 @@ if (!fs.existsSync('dist')) {
|
|||
}
|
||||
|
||||
// 1. 将js复制到web-mobile中
|
||||
async function processChannels() {
|
||||
async function processChannels(options) {
|
||||
const zipChannel = options.zipChannel || ['facebook', 'google', 'tiktok', 'vungle', 'liftoff'];
|
||||
const outputPrefix = options.outputPrefix || '';
|
||||
for (const channelName of zipChannel) {
|
||||
// 遍历 networks 目录下的所有js文件,获取 文件名 然后删除 web-mobile 目录下的同名文件
|
||||
const files = fs.readdirSync(path.join('networks'));
|
||||
|
@ -119,4 +117,5 @@ async function processChannels() {
|
|||
}
|
||||
}
|
||||
|
||||
processChannels();
|
||||
|
||||
export default processChannels;
|
Loading…
Reference in New Issue