codynova / cli-utility

NodeJS utilities and boilerplate for creating CLIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@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

About

NodeJS utilities and boilerplate for creating CLIs

License:MIT License


Languages

Language:JavaScript 50.3%Language:TypeScript 48.8%Language:Shell 0.8%