@@ -3,6 +3,7 @@ import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import {spawnSync} from 'node:child_process';
|
||||
import { purchasingHomeOverlay } from './lib/sgf-purchasing-home-overlay.mjs';
|
||||
|
||||
const host=fs.realpathSync(process.argv[2]||'');
|
||||
if(fs.existsSync(path.join(host,'public/hot')))throw Error('Stop the source frontend watcher before freezing a candidate.');
|
||||
@@ -19,9 +20,7 @@ app=replace(app,'{labels[p]}','{list?.catalogue_labels?.[p] ?? labels[p] ?? p}')
|
||||
app=replace(app,'{labels[g.permission]}','{list?.catalogue_labels?.[g.permission] ?? labels[g.permission] ?? g.permission}');
|
||||
fs.writeFileSync(path.join(work,'resources/js/app.jsx'),app);
|
||||
let home=fs.readFileSync(path.join(work,'resources/js/PurchasingHome.jsx'),'utf8');
|
||||
home=replace(home,"const payables=unit!==null&&can('supplier_payables.view',unit);", "const payables=unit!==null&&can('supplier_payables.view',unit);\n const requisitions=unit!==null&&can('purchasing_requisitions.view',unit);");
|
||||
home=replace(home,'<div className="actions">','<div className="actions">{requisitions&&<a href="/purchasing/internal-requisitions">Requisições internas</a>}{budget&&<a href="/purchasing/internal-requisitions/budget-setup">Preparação de centros e dotações</a>}');
|
||||
home=replace(home,'!budget&&!payables&&','!budget&&!payables&&!requisitions&&');
|
||||
home=purchasingHomeOverlay(home);
|
||||
fs.writeFileSync(path.join(work,'resources/js/PurchasingHome.jsx'),home);
|
||||
let config=fs.readFileSync(path.join(work,'vite.config.js'),'utf8');
|
||||
config=replace(config,'defineConfig({',`defineConfig({\n cacheDir: ${JSON.stringify(path.join(work,'vite-cache'))},`);
|
||||
|
||||
Reference in New Issue
Block a user