1.5.5 • Published 5 years ago

npm-node-utils v1.5.5

Weekly downloads
8
License
ISC
Repository
github
Last release
5 years ago

npm-node-utils

A little utility to get info about installed and remote npm packages.

Functions

getGlobalDir(options) ⇒ string

Kind: global function

ParamType
optionsObject

Properties

NameTypeDefaultDescription
clientstring"yarn"npm or yarn

Example

getGlobalDir();

// returns
'/Users/foo/.config/yarn/global'

getGlobalPackagePath(options) ⇒ string

Kind: global function

ParamType
optionsObject

Properties

NameTypeDefaultDescription
namestringPackage name.
clientstring"yarn"npm or yarn

Example

getGlobalPackagePath({ name: 'jest' });

// returns
'/Users/foo/.config/yarn/global/node_modules/jest'

getGlobalPackages(options) ⇒ Array.string | Array.Object

Kind: global function

ParamType
optionsObject

Properties

NameTypeDefaultDescription
scopestringGet packages by @scope.
filterfunctionA custom filter callback.
extendedbooleanGet extended info, such as name, version and description.
clientstring"yarn"Preferred client, npm or yarn.

Example

getGlobalPackages();

// returns
['jest', 'vue-cli']

Example

getGlobalPackages({ extended: true });

// returns
[
  {
    name: 'jest',
    version: '23.6.0',
    description: 'Delightful JavaScript Testing'.
  },
  {
    name: 'vue-cli',
    version: '2.9.6',
    description: 'A simple CLI for scaffolding Vue.js projects.'
  }
]

checkIfPackageIsGloballyInstalled(options) ⇒ Boolean | Object

Kind: global function

ParamType
optionsObject

Properties

NameTypeDefaultDescription
extendedbooleanGet extended info, such as name, version and description.
clientstring"yarn"Preferred client, npm or yarn.

Example

checkIfPackageIsGloballyInstalled({ name: 'vue-cli' });

// returns true

Example

getGlobalPackages({
  extended: true,
  name: 'vue-cli'
});

// returns
{
  name: 'vue-cli',
  version: '2.9.6',
  description: 'A simple CLI for scaffolding Vue.js projects.'
}

getRemotePackageInfo(options) ⇒ Object

Kind: global function

ParamType
optionsObject

Properties

NameTypeDefaultDescription
namestringPackage name.
keystringRequest specific key, example: version.
clientstring"yarn"Preferred client, npm or yarn.

Example

getRemotePackageInfo({
  name: 'vue-cli',
  key: 'version'
})

//returns
'2.9.6'

Example

getRemotePackageInfo( name: 'vue-cli' })

//returns
{
  name: 'vue-cli',
  version: '2.9.6',
  description: 'A simple CLI for scaffolding Vue.js projects.'
}

getRemotePackages(options) ⇒ Promise.Array.Object

Kind: global function

ParamTypeDescription
optionsObjectRead here for params documentation https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search

Example

getRemotePackages({ search: 'react' }).then((response) => {
  console.log(response);
})

// returns
[
  {
    name: 'react',
    version: '16.6.0',
    description: 'React is a JavaScript library for building user interfaces.'.
  },
  {
    name: 'react-router',
    version: '4.3.1',
    description: 'Declarative routing for React'.
  },
  ...
]
1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago