UNPKG

996 BJavaScriptView Raw
1#!/usr/bin/env node
2
3/**
4 * @typedef Pack
5 * @property {string} name
6 * @property {string} version
7 * @property {string} description
8 */
9
10import fs from 'node:fs/promises'
11import {resolve} from 'import-meta-resolve'
12import markdownExtensions from 'markdown-extensions'
13import {remark} from 'remark'
14import {args} from 'unified-args'
15
16/** @type {Pack} */
17const process_ = JSON.parse(
18 String(
19 await fs.readFile(
20 new URL('package.json', resolve('remark', import.meta.url))
21 )
22 )
23)
24
25/** @type {Pack} */
26const cli = JSON.parse(
27 String(await fs.readFile(new URL('package.json', import.meta.url)))
28)
29
30args({
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})