-
Notifications
You must be signed in to change notification settings - Fork 73
/
index.ts
58 lines (55 loc) · 1.66 KB
/
index.ts
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {isTruthy} from './util/util'
function checkCWD() {
try {
process.cwd()
} catch (error: any) {
if (error.code === 'ENOENT') {
process.stderr.write('WARNING: current directory does not exist\n')
}
}
}
function checkNodeVersion() {
if (process.env.OCLIF_DISABLE_ENGINE_WARNING && isTruthy(process.env.OCLIF_DISABLE_ENGINE_WARNING)) return
try {
const semver = require('semver')
const path = require('node:path')
const root = path.join(__dirname, '..')
const pjson = require(path.join(root, 'package.json'))
if (!semver.satisfies(process.versions.node, pjson.engines.node)) {
process.emitWarning(
`Node version must be ${pjson.engines.node} to use this CLI. Current node version: ${process.versions.node}`,
)
}
} catch {
// ignore
}
}
checkCWD()
checkNodeVersion()
export * as Args from './args'
export {Command} from './command'
export {Config, Plugin} from './config'
export * as Errors from './errors'
export {handle} from './errors/handle'
export {execute} from './execute'
export * as Flags from './flags'
export {flush} from './flush'
export {
CommandHelp,
Help,
HelpBase,
type HelpSection,
type HelpSectionKeyValueTable,
type HelpSectionRenderer,
loadHelpClass,
} from './help'
export * as Interfaces from './interfaces'
export {type Hook} from './interfaces/hooks'
export {getLogger} from './logger'
export {run} from './main'
export * as ModuleLoader from './module-loader'
export * as Parser from './parser'
export {Performance} from './performance'
export {type Settings, settings} from './settings'
export {toConfiguredId, toStandardizedId} from './util/ids'
export {ux} from './ux'