bajo 0.2.29 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,12 @@
1
1
  import buildHelper from './lib/build-helper.js'
2
2
  import logger from './lib/logger.js'
3
3
  import print from './lib/print.js'
4
- import fs from 'fs-extra'
5
4
  import deepFreeze from 'deep-freeze-strict'
6
5
  import currentLoc from './helper/current-loc.js'
7
6
  import dayjs from './lib/dayjs.js'
7
+ import fs from 'fs-extra'
8
+ import fastGlob from 'fast-glob'
9
+ import { sprintf } from 'sprintf-js'
8
10
 
9
11
  export default async function () {
10
12
  this.bajo.helper = await buildHelper.call(this, `${currentLoc(import.meta).dir}/helper`)
@@ -20,8 +22,13 @@ export default async function () {
20
22
  setImmediate(() => resolve())
21
23
  })
22
24
  }
23
- this.bajo.helper.freeze(this.bajo.helper, true)
25
+ // commonly used libraries
26
+ this.bajo.helper._ = await import('lodash-es')
27
+ this.bajo.helper.fs = fs
28
+ this.bajo.helper.fastGlob = fastGlob
29
+ this.bajo.helper.sprintf = sprintf
24
30
  // last cleanup
31
+ this.bajo.helper.freeze(this.bajo.helper, true)
25
32
  if (!fs.existsSync(this.bajo.config.dir.data)) {
26
33
  this.bajo.helper.log.warn('Data directory \'%s\' is not set yet!', this.bajo.config.dir.data)
27
34
  }
@@ -1,10 +1,14 @@
1
1
  import util from 'util'
2
+ import { last } from 'lodash-es'
2
3
 
3
4
  const dump = (...args) => {
5
+ const terminate = last(args) === true
6
+ if (terminate) args.pop()
4
7
  for (const arg of args) {
5
8
  const result = util.inspect(arg, false, null, true)
6
9
  console.log(result)
7
10
  }
11
+ if (terminate) process.kill(process.pid, 'SIGINT')
8
12
  }
9
13
 
10
14
  export default dump
package/boot/run-tool.js CHANGED
@@ -16,7 +16,7 @@ async function runTool () {
16
16
  let name = config.tool
17
17
  let toc = false
18
18
  if (!isString(config.tool)) {
19
- const select = await importPkg('bajo-cli:@inquirer/select')
19
+ const select = await importPkg('bajoCli:@inquirer/select')
20
20
  name = await select({
21
21
  message: print.__('Please select tool provider:'),
22
22
  choices: map(tools, t => ({ value: t.ns }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo",
3
- "version": "0.2.29",
3
+ "version": "0.3.1",
4
4
  "description": "A framework to build a giant monstrous app rapidly",
5
5
  "main": "boot/index.js",
6
6
  "scripts": {