feat(taobao): add native mini program with shared backend
Preserve H5 flows while adding Taobao identity, native capture, reports and isolated local development. Fix canceled province selection and expired-session logout. Record passing local regressions, two pre-existing H5 assertion failures and pending platform validation.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
const fs = require('node:fs'), path = require('node:path'), crypto = require('node:crypto');
|
||||
const root = path.resolve(__dirname, '..'), check = process.argv.includes('--check');
|
||||
const files = ['skin-score.js', 'report-ui.js', 'report-copy.js'];
|
||||
const manifest = {};
|
||||
for (const name of files) {
|
||||
const source = fs.readFileSync(path.join(root, '../h5/js', name));
|
||||
const dest = path.join(root, 'vendor', name);
|
||||
// Git may convert line endings on Windows; manifest hashes stay portable.
|
||||
manifest[name] = crypto.createHash('sha256').update(source.toString('utf8').replace(/\r\n/g, '\n')).digest('hex');
|
||||
if (check) {
|
||||
if (!fs.existsSync(dest) || !source.equals(fs.readFileSync(dest))) throw Error('Shared logic drift: run npm run sync:shared (' + name + ')');
|
||||
} else { fs.mkdirSync(path.dirname(dest), { recursive: true }); fs.writeFileSync(dest, source); }
|
||||
}
|
||||
const dest = path.join(root, 'vendor/manifest.json'), expected = JSON.stringify(manifest, null, 2) + '\n';
|
||||
if (check) { if (fs.readFileSync(dest, 'utf8') !== expected) throw Error('Shared manifest drift'); }
|
||||
else fs.writeFileSync(dest, expected);
|
||||
console.log(check ? 'PASS: scoring, report UI and copy match H5 byte for byte' : 'Synced shared logic from H5 (source files unchanged)');
|
||||
Reference in New Issue
Block a user