-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bin.js
executable file
·39 lines (31 loc) · 878 Bytes
/
bin.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
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
// builtin
import { resolve, join } from 'node:path'
// get root with imports
import filedirname from 'filedirname'
const [file, dir] = filedirname()
const root = resolve(dir, '..')
const pkgPath = join(root, 'package.json')
// internal
import { readJSON } from './fs.js'
import boundation from './index.js'
import state from './state.js'
import { pwd } from './data.js'
// // Process unhandled rejections
// process.on('unhandledRejection', function unhandledRejection(error) {
// console.error(new Errlop('An unhandled promise failed', error))
// process.exit(-1)
// })
async function main() {
// boundation
const { version } = await readJSON(pkgPath)
console.log(`Boundation v${version} [${root}]`)
// app
console.log(`Running on [${pwd}]`)
// run
await boundation(state)
}
main().catch((err) => {
console.error(err)
process.exit(1)
})