-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (24 loc) · 657 Bytes
/
index.js
File metadata and controls
27 lines (24 loc) · 657 Bytes
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
import fs from 'node:fs/promises'
import path from 'node:path'
import { parseArgs } from 'node:util'
const { values } = parseArgs({
options: {
extractor: {
type: 'string',
},
},
})
for (const appName of values.extractor
? [values.extractor]
: ['babel', 'eslint', 'prettier', 'stylelint', 'tslint']) {
const { extractSchema } = await import(
path.join(process.cwd(), `lib/extractors/${appName}.js`)
)
console.log(`Extracting for ${appName}...`)
const schema = await extractSchema()
await fs.mkdir('schemas', { recursive: true })
await fs.writeFile(
`schemas/partial-${appName}.schema.json`,
JSON.stringify(schema, null, '\t'),
)
}