commit15
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';import {spawnSync} from 'node:child_process';import {pathToFileURL} from 'node:url';
|
||||
const state=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json','utf8'));const tag=process.argv[2];if(!/^[a-f0-9]{12}$/.test(tag||'')||state.port!==55439)throw Error('Wrong QA tag');
|
||||
const root=path.join(state.root,'private','stock-receipt-'+tag),app=path.join(root,'app'),source=path.resolve('../compras');const owned=JSON.parse(fs.readFileSync(path.join(root,'state.json'),'utf8'));if(path.resolve(owned.app)!==path.resolve(app)||owned.database!=='compras_receipts_test_'+tag)throw Error('Wrong private QA app');
|
||||
const hash=p=>crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');const inputs=['resources/js/pages/stock/returns.tsx','resources/js/pages/stock/request.tsx','resources/js/pages/stock/operations.tsx'];for(const p of inputs)if(hash(path.join(source,p))!==hash(path.join(app,p)))throw Error('UI copy changed since test staging');
|
||||
for(const f of ['tsconfig.json','package.json'])fs.copyFileSync(path.join(source,f),path.join(app,f));
|
||||
if(!fs.existsSync(path.join(app,'node_modules')))fs.symlinkSync(path.join(source,'node_modules'),path.join(app,'node_modules'),'junction');
|
||||
fs.writeFileSync(path.join(app,'tsconfig.return-ui.json'),JSON.stringify({extends:'./tsconfig.json',compilerOptions:{noEmit:true,incremental:false},include:inputs,exclude:[]},null,2));
|
||||
const types=spawnSync(process.execPath,[path.join(source,'node_modules/typescript/bin/tsc'),'-p',path.join(app,'tsconfig.return-ui.json')],{cwd:app,encoding:'utf8',windowsHide:true});fs.writeFileSync(path.join(root,'return-ui-types.txt'),(types.stdout||'')+(types.stderr||''));
|
||||
const {build}=await import(pathToFileURL(path.join(source,'node_modules/vite-plus/dist/index.js')));
|
||||
await build({root:app,configFile:false,cacheDir:path.join(root,'vite-return-cache'),resolve:{alias:{'@':path.join(app,'resources/js')}},build:{outDir:path.join(root,'return-ui-bundle'),emptyOutDir:false,lib:{entry:Object.fromEntries(inputs.map(p=>[path.basename(p,'.tsx'),path.join(app,p)])),formats:['es']},rollupOptions:{external:['react','react/jsx-runtime','@inertiajs/react']}}});
|
||||
const code=fs.readFileSync(path.join(app,inputs[0]),'utf8');if(!code.includes('name="declared_unused" required')||!code.includes('name="received_in_warehouse" required')||!code.includes('defaultValue="" required'))throw Error('Explicit declaration/receiving/selection controls missing');
|
||||
const report={kind:'isolated_changed_entry_browser_bundle_and_types',inputs_sha256:Object.fromEntries(inputs.map(p=>[p,hash(path.join(app,p))])),entry_bundle_passed:true,type_check_exit:types.status,type_output_sha256:hash(path.join(root,'return-ui-types.txt')),explicit_source_selection:true,unused_declaration_required_in_source:true,independent_receiving_declaration_required_in_source:true,live_or_demo_build_touched:false,full_application_build:false,browser_interactions_tested:false,visual_review:false};
|
||||
fs.writeFileSync('docs/proofs/native-return-ui-20261102.json',JSON.stringify(report,null,2)+'\n');console.log(JSON.stringify(report,null,2));if(types.status!==0){console.log((types.stdout||'')+(types.stderr||''));process.exitCode=1;}
|
||||
Reference in New Issue
Block a user