feat: build

This commit is contained in:
chashaobao
2025-08-17 13:44:41 +08:00
parent 34f9c8d0e6
commit 6a2c94c7cf
9 changed files with 6093 additions and 12879 deletions

View File

@ -12,6 +12,20 @@ const MockPlugin: PluginItem = [
}
];
const CIPluginOpt = () => {
const brand = process.env.BRAND as 'prod' | 'dev'; // 取环境变量
const map = {
prod: { appid: 'wxf0724a83f8e377d2', privateKeyPath: 'keys/private.wxf0724a83f8e377d2.key' },
dev: { appid: 'wx2d56597fd541f1a6', privateKeyPath: 'keys/private.wx2d56597fd541f1a6.key' },
};
return {
weapp: map[brand] || map.prod,
version: process.env.VERSION || '1.0.0',
desc: `build for ${brand}`,
};
};
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
export default defineConfig(async (merge, _env: ConfigEnv) => {
const baseConfig: UserConfigExport = {
@ -25,13 +39,15 @@ export default defineConfig(async (merge, _env: ConfigEnv) => {
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
outputRoot: process.env.OUTPUT_ROOT || 'dist',
plugins: [['@tarojs/plugin-mini-ci', CIPluginOpt()], '@tarojs/plugin-html'],
// plugins: ['@tarojs/plugin-html', MockPlugin],
defineConstants: {
'process.env.BRAND': JSON.stringify(process.env.BRAND),
},
copy: {
patterns: [
{from: 'project.config.dev.json',to: 'dist-dev/project.config.json'},
],
options: {
}