Skip to content

Commit

Permalink
chore: add script to preview all examples
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ma committed Jan 11, 2025
1 parent c7bc7c3 commit 318abf4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .scripts/run-all-examples.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { fork } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { sleep } from '@ircam/sc-utils';

// run all examples for 2 seconds
const list = fs.readdirSync('examples').filter(filename => filename.endsWith('.js'));
const testDuration = 2;

for (let i = 0; i < list.length; i++) {
const example = list[i];
console.log(`
-----------------------------------------------------------------
- ${example}
-----------------------------------------------------------------
`);

const proc = fork(path.join('examples', example));
await sleep(testDuration);
proc.kill('SIGKILL');
}

0 comments on commit 318abf4

Please sign in to comment.