-
Notifications
You must be signed in to change notification settings - Fork 0
/
publint.js
30 lines (26 loc) · 891 Bytes
/
publint.js
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
30
// lifted from https://github.com/formkit/formkit/blob/master/scripts/lint.mjs
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
import { execa } from 'execa';
import fs from 'fs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const packagesDir = resolve(__dirname, './packages');
function getPackages() {
const availablePackages = fs.readdirSync(packagesDir);
return availablePackages;
}
async function publint(packages) {
if (!packages) {
const packages = await getPackages();
if (process.argv[2] && packages.includes(process.argv[2])) {
return await publint([process.argv[2]]);
}
return await publint(packages);
}
const pkg = packages.shift();
if (!pkg) return;
await execa('npx', ['publint', `./packages/${pkg}`]).pipeStdout(process.stdout);
publint(packages);
}
publint();