merge(custom): merge

This commit is contained in:
lukaijie
2025-08-04 13:19:29 +08:00
parent 1097ffff3e
commit e71a4a5e6f
4 changed files with 83 additions and 179 deletions

View File

@@ -46,22 +46,6 @@ if (process.env.TARO_ENV == 'alipay') {
copyPatterns.push({ from: 'mini.project.json', to: `${DIST_PATH}/mini.project.json` })
}
const AutoI18nOptions = {
rewriteConfig: false, // 是否重写配置js 小程序需要魔改配置文件,所以不要重新生成,以现在的为准
excludedPath: [
path.resolve(__dirname, './../src/lang/index.js'),
path.resolve(__dirname, './../src/lang/consts.js')
],
globalPath: path.resolve(__dirname, './../src/subpages/i18n/lang'),
targetLangList: ['en', 'zh-tw'], // 目标语言
originLang: 'zh-cn', // 源语言
translator: new YoudaoTranslator({
appId: process.env.APP_I18N_APP_ID,
appKey: process.env.APP_I18N_APP_KEY
}),
includePath: [/src/] // 仅扫描 src 目录
}
const config = {
projectName: pkg.name,
date: '2025-04-22',

View File

@@ -1,66 +1,66 @@
{
"miniprogramRoot": "dist/",
"projectname": "ecshopx-vshop",
"description": "weshop for platform",
"appid":"wx1e25e45145b70faa",
"setting": {
"urlCheck": false,
"es6": false,
"enhance": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": false,
"uploadWithSourceMap": false,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath":"wx1e25e45145b70faa"
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"minifyWXML": true,
"ignoreUploadUnusedFiles": false,
"ignoreDevUnusedFiles": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"list": []
}
}
"miniprogramRoot": "dist/",
"projectname": "ecshopx-vshop",
"description": "weshop for platform",
"appid": "wx27fc041381fe1e0d",
"setting": {
"urlCheck": false,
"es6": false,
"enhance": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": false,
"uploadWithSourceMap": false,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"minifyWXML": true,
"ignoreUploadUnusedFiles": false,
"ignoreDevUnusedFiles": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"plugin": {
"list": []
},
"game": {
"list": []
},
"miniprogram": {
"list": []
}
}
}

6
run.sh
View File

@@ -75,9 +75,9 @@ then
# exit
# fi
PROJECT_FILE_PATH='./project.config.json'
oldappid=$(cat ${PROJECT_FILE_PATH} | sed 's/,/\n/g' | grep "appid" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g')
sed -i "" "s#${oldappid}#\"${appid}\"#g" ${PROJECT_FILE_PATH}
# PROJECT_FILE_PATH='./project.config.json'
# oldappid=$(cat ${PROJECT_FILE_PATH} | sed 's/,/\n/g' | grep "appid" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g')
# sed -i "" "s#${oldappid}#\"${appid}\"#g" ${PROJECT_FILE_PATH}
echo '{
"extEnable": true,

View File

@@ -1,101 +1,21 @@
const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null // 手机端点击投诉可以在平台看到日志
const noop = () => {}
const levels = {
DEBUG: 'debug', // 开发和调试阶段使用
INFO: 'info', // 记录程序正常运行情况
WARN: 'warn', // 记录程序运行出现的潜在问题
ERROR: 'error' // 程序运行过程出现严重错误
const debug = (...args) => {
let cArgs = []
args.forEach((item) => {
const cItem =
typeof item !== 'object' ? ['%c' + item, 'color: #3e76f6; font-weight: normal;'] : item
cArgs = cArgs.concat(cItem)
})
console.groupCollapsed(...cArgs)
console.trace(...args)
console.groupEnd()
}
const prefixes = {
DEBUG: '[DEBUG]',
INFO: '[INFO]',
WARN: '[WARN]',
ERROR: '[ERROR]'
const log = {
...console,
debug: process.env.NODE_ENV === 'development' ? debug : noop
}
class Logger {
constructor(level = levels.INFO) {
this.level = level
}
setLevel(level) {
this.level = level
}
log(level, ...args) {
if (this.shouldLog(level)) {
const timestamp = new Date().toLocaleString()
const prefix = prefixes[level.toUpperCase()] || ''
const logMessage = `[${timestamp}] ${prefix} ${args.join(' ')}`
console.log(logMessage)
this.sendToRealtimeLog(level, ...args)
}
}
debug(...args) {
this.log(levels.DEBUG, ...args)
}
info(...args) {
this.log(levels.INFO, ...args)
}
warn(...args) {
this.log(levels.WARN, ...args)
}
error(...args) {
this.log(levels.ERROR, ...args)
}
shouldLog(level) {
const levelOrder = [levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR]
return levelOrder.indexOf(level) >= levelOrder.indexOf(this.level)
}
sendToRealtimeLog(level, ...args) {
if (!log) {
return
}
switch (level) {
case levels.INFO:
log.info.apply(log, args)
break
case levels.WARN:
log.warn.apply(log, args)
break
case levels.ERROR:
log.error.apply(log, args)
break
default:
log.debug ? log.debug.apply(log, args) : log.info.apply(log, args)
break
}
}
setFilterMsg(msg) {
if (!log || !log.setFilterMsg) {
return
}
if (typeof msg !== 'string') {
return
}
log.setFilterMsg(msg)
}
addFilterMsg(msg) {
if (!log || !log.addFilterMsg) {
return
}
if (typeof msg !== 'string') {
return
}
log.addFilterMsg(msg)
}
}
const logger = new Logger(levels.DEBUG) // 默认日志级别为 DEBUG
export default logger
export { levels }
export default log