Adds /api/health, ntfy notify on config save, /admin/analytics charts, and deploy smoke for miniprogram config/API. Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import path from 'path'
|
|
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
|
|
|
|
const target = process.env.TARO_APP_TARGET || process.env.TARO_ENV || 'weapp'
|
|
const outputRoot =
|
|
target === 'tt' ? 'dist/tt' : target === 'xhs' ? 'dist/xhs' : 'dist/weapp'
|
|
|
|
const defaultApi =
|
|
target === 'tt'
|
|
? 'https://dyapi.nomadro.cn'
|
|
: 'https://api.nomadro.cn'
|
|
|
|
export default defineConfig(async (merge) => {
|
|
const baseConfig: UserConfigExport = {
|
|
projectName: 'nomadro-miniprogram',
|
|
date: '2026-3-28',
|
|
designWidth: 750,
|
|
deviceRatio: {
|
|
640: 2.34 / 2,
|
|
750: 1,
|
|
375: 2,
|
|
828: 1.81 / 2,
|
|
},
|
|
sourceRoot: 'src',
|
|
outputRoot,
|
|
plugins: ['@tarojs/plugin-framework-react'],
|
|
defineConstants: {
|
|
TARO_APP_API: JSON.stringify(process.env.TARO_APP_API || defaultApi),
|
|
TARO_APP_COMMUNITY_API: JSON.stringify(
|
|
process.env.TARO_APP_COMMUNITY_API || 'https://nomadweb.nomadro.com/api/v1',
|
|
),
|
|
TARO_APP_GATEWAY: JSON.stringify(
|
|
process.env.TARO_APP_GATEWAY || process.env.TARO_APP_API || defaultApi,
|
|
),
|
|
TARO_APP_TARGET: JSON.stringify(target),
|
|
},
|
|
copy: {
|
|
patterns: [{ from: 'src/assets/', to: 'assets/' }],
|
|
options: {},
|
|
},
|
|
framework: 'react',
|
|
compiler: {
|
|
type: 'webpack5',
|
|
prebundle: { enable: false },
|
|
},
|
|
cache: { enable: false },
|
|
alias: {
|
|
'@': path.resolve(__dirname, '..', 'src'),
|
|
},
|
|
mini: {
|
|
postcss: {
|
|
pxtransform: { enable: true, config: {} },
|
|
cssModules: { enable: false },
|
|
},
|
|
},
|
|
h5: {
|
|
publicPath: '/',
|
|
staticDirectory: 'static',
|
|
postcss: {
|
|
autoprefixer: { enable: true },
|
|
cssModules: { enable: false },
|
|
},
|
|
},
|
|
}
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
return merge({}, baseConfig, { logger: { quiet: false, stats: true } })
|
|
}
|
|
return merge({}, baseConfig)
|
|
})
|