nomadro/apps/miniprogram/tt/scripts/post-copy-size-plugin.js
eric 1d3e513ae2 Ship Douyin tt/ miniprogram: offline reader, clipboard privacy, README.
Add apps/miniprogram/tt as a standalone Douyin app with official usePrivacyCheck + tt.showModal/setClipboardData flow, single-chapter offline reader, and document console privacy setup for clipboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 15:17:52 +08:00

39 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 构建结束后:wipe 旧静态资源、去掉 .map、校验抖音分包体积。
* webpack: afterEmit;vite: closeBundle(见 config/index.ts)。
*/
const path = require('path')
const { execSync } = require('child_process')
function runPostCopySize(cwd = path.resolve(__dirname, '..')) {
try {
execSync('node ./scripts/copy-static.mjs', { cwd, stdio: 'inherit' })
execSync('node ./scripts/validate-size.mjs', { cwd, stdio: 'inherit' })
} catch (e) {
console.warn('[NomadroPostCopySize]', e && e.message ? e.message : e)
}
}
/** webpack plugin — 用 afterEmit(与伞仓 weapp 一致;done 在 Taro watch 下常不打日志) */
class NomadroPostCopySize {
apply(compiler) {
compiler.hooks.afterEmit.tap('NomadroPostCopySize', () => {
runPostCopySize(path.resolve(__dirname, '..'))
})
}
}
/** vite plugin */
function vitePostCopySizePlugin() {
return {
name: 'nomadro-post-copy-size',
closeBundle() {
runPostCopySize(path.resolve(__dirname, '..'))
},
}
}
module.exports = NomadroPostCopySize
module.exports.runPostCopySize = runPostCopySize
module.exports.vitePostCopySizePlugin = vitePostCopySizePlugin