Mainnet
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
const env = { ...process.env, WIKIDECK_NETWORK: 'testnet', WIKIDECK_GENESIS_TIME: '1792411200',
|
||||
VITE_WIKIDECK_NETWORK: 'testnet', VITE_WIKIDECK_GENESIS_TIME: '1792411200' };
|
||||
const children = [
|
||||
spawn(process.execPath, ['--import', 'tsx', 'server/index.ts'], { env, stdio: 'inherit', shell: false }),
|
||||
spawn(process.execPath, ['node_modules/vite/bin/vite.js', '--host', '127.0.0.1'], { env, stdio: 'inherit', shell: false }),
|
||||
];
|
||||
let stopping = false;
|
||||
const stop = code => {
|
||||
if (stopping) return;
|
||||
stopping = true;
|
||||
for (const child of children) if (child.exitCode === null) child.kill('SIGTERM');
|
||||
process.exitCode = code;
|
||||
};
|
||||
for (const child of children) {
|
||||
child.once('error', () => stop(1));
|
||||
child.once('exit', code => stop(code ?? 1));
|
||||
}
|
||||
for (const signal of ['SIGINT', 'SIGTERM']) process.once(signal, () => stop(0));
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
const env = { ...process.env, WIKIDECK_NETWORK: 'testnet', WIKIDECK_GENESIS_TIME: '1792411200' };
|
||||
const child = spawn(process.execPath, ['--import', 'tsx', 'server/testnet/miner.ts', ...process.argv.slice(2)], {
|
||||
env, stdio: 'inherit', shell: false,
|
||||
});
|
||||
child.once('error', () => { process.exitCode = 1; });
|
||||
child.once('exit', (code, signal) => {
|
||||
process.exitCode = code ?? (signal ? 1 : 0);
|
||||
});
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
import { readdirSync } from 'node:fs';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const testDirectory = fileURLToPath(new URL('../tests/', import.meta.url));
|
||||
const files = readdirSync(testDirectory)
|
||||
.filter(name => name.endsWith('.test.ts'))
|
||||
.sort()
|
||||
.map(name => join(testDirectory, name));
|
||||
if (!files.length) throw new Error('No test files found.');
|
||||
|
||||
const result = spawnSync(process.execPath, ['--import', 'tsx', '--test', ...files], {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, WIKIDECK_NETWORK: 'testnet', WIKIDECK_GENESIS_TIME: '1792411200' },
|
||||
});
|
||||
if (result.error) throw result.error;
|
||||
process.exitCode = result.status ?? 1;
|
||||
Reference in New Issue
Block a user