0.0.3 • Published 2 years ago

@novas/cli-utility v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@novas/cli-utility

NodeJS utilities and boilerplate for creating CLIs

Installation

yarn add @novas/cli-utility got tar semver commander fast-fuzzy inquirer inquirer-autocomplete-prompt

Functions

Modules are exported as both ESM and CJS

  • checkPackageVersion - Takes a package name and returns an object with metadata about the currently installed and latest published versions of the package.
const {
	installedVersion,
	latestVersion,
	isInstalled,
	isLatest,
	isOutdated,
	isExperimental,
} = checkPackageVersion('create-next-app')
  • downloadAndExtractGithub - Takes a Github tree or blob URL including branch name and downloads and extracts the .tar.gz file to the cwd.
try {
	await downloadAndExtractGithub(
		'https://github.com/codynova/eslint-config/tree/master'
	)
	console.log('success!')
} catch (error) {
	console.log(error)
}
  • installDependenciesNpm and installDependenciesYarn - Attempts to install dependencies with NPM or Yarn in the cwd.
try {
	installDependenciesYarn()
	console.log('success!')
} catch (error) {
	console.log(error)
}

Prior Art