-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.madrun.js
More file actions
29 lines (25 loc) · 1.14 KB
/
.madrun.js
File metadata and controls
29 lines (25 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {readFile, writeFile} from 'node:fs/promises';
import {unzipSync} from 'node:zlib';
import {run} from 'madrun';
import {tryToCatch} from 'try-to-catch';
export default {
'lint': () => 'putout .',
'fix:lint': () => run('lint', '--fix'),
'test': () => `tape 'test/**/*.js' '{lib,bin}/**/*.spec.{js,mjs}'`,
'watch:test': async () => await run('watcher', `"${await run('test')}"`),
'watch:tape': () => 'nodemon -w test -w lib --exec tape',
'watch:lint': async () => await run('watcher', await run('lint')),
'watcher': () => 'nodemon -w test -w lib -w bin --exec',
'coverage': async () => `c8 ${await run('test')}`,
'precoverage': async () => await run('extract'),
'report': () => 'c8 report --reporter=lcov',
'wisdom': () => run(['lint', 'coverage']),
'extract': async () => {
const [error] = await tryToCatch(readFile, './dictionary/stems.json');
if (!error)
return 'tape';
const packed = await readFile('./dictionary/stems.json.gz');
await writeFile('./dictionary/stems.json', unzipSync(packed));
return 'echo "✅ extract"';
},
};