2.0.8 • Published 12 months ago

@cli-dang/activity v2.0.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

@cli-dang/activity


Module activity wraps and extends process.exit, process.stderr.write, console.trace&node:util/inspect

Index of Contents



Description


@cli-dang/activity is a module wrapper for:

  • process.stderr.write()
  • process.exit()
  • console.trace()

It gives these methods new functionalities.
Basically, its main usage is to print on the console, errors, inspect variables and exit the process.


Installation


npm install @cli-dang/activity

@cli-dang/activity API


.trace(...data)

import { trace } from '@cli-dang/activity'

await trace([data, {...'string'}])

.trace_options { mute?: boolean, colors?: boolean, depth: number, showHidden: boolean }

api for node:util/inspect options

import { trace_options, trace } from '@cli-dang/activity'
/* we shut down console.trace and we return a node:util.inspect Object */

trace_options.mute = true
console.log(await trace([data, {...'string'}]))

.exit(message, error_type, exit_code, process_exit, mute)

import { exit } from '@cli-dang/activity'

await exit('process will now exit').catch(error=>console.error(error))
// prints to stderr the message and Error.staktrace and exit the process with code 1

.stderr(message, mute)

import { stderr } from '@cli-dang/activity'

await stderr('process had errors').catch(error=>console.error(error))
// prints to stderr the message

JetBrains OSS License


I want to thank JetBrains to grant me the Open Source Software license for all their products. This opportunity gives me strength to keep on going with my studies and personal project.
To learn more about this opportunity, have a look at Licenses for Open Source Development - Community Support.

Thank you