feat: implement gas and delivery admin systems
This commit is contained in:
16
frontend/delivery_admin/scripts/sync-backend-contract.mjs
Normal file
16
frontend/delivery_admin/scripts/sync-backend-contract.mjs
Normal file
@@ -0,0 +1,16 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const backend = resolve(root, '../../backend/api');
|
||||
const output = resolve(root, 'src/contracts/delivery-resources.json');
|
||||
const contract = execFileSync('go', ['run', './cmd/cli', 'delivery-resource-contract'], {
|
||||
cwd: backend,
|
||||
encoding: 'utf8',
|
||||
});
|
||||
JSON.parse(contract);
|
||||
mkdirSync(dirname(output), { recursive: true });
|
||||
writeFileSync(output, `${contract.trim()}\n`);
|
||||
console.log(`已同步后端资源契约:${output}`);
|
||||
Reference in New Issue
Block a user