1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | import fs from 'node:fs/promises'
|
11 | import {resolve} from 'import-meta-resolve'
|
12 | import markdownExtensions from 'markdown-extensions'
|
13 | import {remark} from 'remark'
|
14 | import {args} from 'unified-args'
|
15 |
|
16 |
|
17 | const process_ = JSON.parse(
|
18 | String(
|
19 | await fs.readFile(
|
20 | new URL('package.json', resolve('remark', import.meta.url))
|
21 | )
|
22 | )
|
23 | )
|
24 |
|
25 |
|
26 | const cli = JSON.parse(
|
27 | String(await fs.readFile(new URL('package.json', import.meta.url)))
|
28 | )
|
29 |
|
30 | args({
|
31 | description: cli.description,
|
32 | extensions: markdownExtensions,
|
33 | ignoreName: '.' + process_.name + 'ignore',
|
34 | name: process_.name,
|
35 | packageField: process_.name + 'Config',
|
36 | pluginPrefix: process_.name,
|
37 | processor: remark,
|
38 | rcName: '.' + process_.name + 'rc',
|
39 | version: [
|
40 | process_.name + ': ' + process_.version,
|
41 | cli.name + ': ' + cli.version
|
42 | ].join(', ')
|
43 | })
|