mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-05-09 10:45:44 +02:00
30 lines
911 B
JavaScript
30 lines
911 B
JavaScript
const { execFileSync } = require('node:child_process');
|
|
const path = require('node:path');
|
|
const fs = require('node:fs');
|
|
|
|
const frontendDir = path.resolve(__dirname, '..');
|
|
const repoRoot = path.resolve(frontendDir, '..');
|
|
const privacyCoreManifest = path.join(repoRoot, 'privacy-core', 'Cargo.toml');
|
|
const outDir = path.join(frontendDir, 'src', 'mesh', 'privacyCoreWasm');
|
|
const wasmPath = path.join(
|
|
repoRoot,
|
|
'privacy-core',
|
|
'target',
|
|
'wasm32-unknown-unknown',
|
|
'release',
|
|
'privacy_core.wasm',
|
|
);
|
|
|
|
function run(bin, args) {
|
|
execFileSync(bin, args, {
|
|
cwd: repoRoot,
|
|
stdio: 'inherit',
|
|
});
|
|
}
|
|
|
|
fs.mkdirSync(outDir, { recursive: true });
|
|
|
|
run('rustup', ['target', 'add', 'wasm32-unknown-unknown']);
|
|
run('cargo', ['build', '--target', 'wasm32-unknown-unknown', '--release', '--manifest-path', privacyCoreManifest]);
|
|
run('wasm-bindgen', ['--target', 'web', '--out-dir', outDir, wasmPath]);
|