'use strict' // Compile only. Never upload, preview, or run the application. const fs=require('fs'),path=require('path'),cp=require('child_process') const root=path.resolve(__dirname,'../..') const result=cp.spawnSync(process.execPath,[require.resolve('@wepy/cli/bin/wepy.js'),'build','--no-cache'],{cwd:root,env:{...process.env,NODE_ENV:'production'},stdio:'inherit'}) if(result.error || result.status!==0)process.exit(result.status || 1) const fix=require('./fix-template-expressions.cjs') let count=0 function walk(dir){for(const e of fs.readdirSync(dir,{withFileTypes:true})){const p=path.join(dir,e.name);if(e.isDirectory())walk(p);else if(p.endsWith('.wxml')){fs.writeFileSync(p,fix(fs.readFileSync(p,'utf8')));count++}}} walk(path.join(root,'weapp')) console.log('Normalized WXML expressions in '+count+' templates')