0.1.4 • Published 6 years ago

package-control v0.1.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

package-control

A client for working with package-control in Node.

Build Status Flow typed

Installation

$ npm install package-control

Usage

const PackageControl = require('package-control')

const pc = new PackageControl()

;(async () => {
  const packages = await pc.search('Material')
  console.log(packages)
})()

API

Response

Every available method on the PackageControl object returns an Array of Package objects.

A Package has the following format:

type Package = {
  name: string,
  description: string,
  authors: Array<string>,
  labels: Array<string>,
  unique_installs: number,
  st_versions: Array<number>,
  installs_rank: number,
  trending_rank: ?number,
  first_seen: string,
  last_seen: string,
  last_modified: string,
  is_missing: boolean,
  platforms: Array<'windows' | 'osx' | 'linux'>,
  missing_error?: string,
  highlighted_name?: string,
  highlighted_authors?: Array<string>,
  z_value?: ?number
}

An example:

{
  "authors": ["saadq"],
  "missing_error": "",
  "highlighted_name": "\u0002Materialize\u0003",
  "st_versions": [3],
  "name": "Materialize",
  "highlighted_authors": ["saadq"],
  "unique_installs": 98365,
  "trending_rank": null,
  "relevance": 11.3816524635662,
  "highlighted_description": "Elegant themes for Sublime Text 3",
  "labels": ["theme", "color scheme", "material"],
  "first_seen": "2015-08-04T15:32:39Z",
  "last_modified": "2017-10-17T14:31:52Z",
  "is_missing": false,
  "installs_rank": 136,
  "platforms": ["windows", "osx", "linux"]
}

pc.search(query, opts)

Use a query to search for packages.

paramrequiredtypedescriptionexample
queryyesstringThe query you want to search for.pc.search('react')
opts.labelsnostring | ArrayFilter package results by label.pc.search('material', { labels: ['color scheme', 'theme']})
opts.limitnonumberLimit size of package results.pc.search('material', { limit: 15 })

pc.getThemes(limit)

Get a list of all Package Control themes.

paramrequiredtypedescriptionexample
limitnonumberLimit size of theme results.pc.getThemes(10)

pc.getColorSchemes(limit)

Get a list of all Package Control color schemes.

paramrequiredtypedescriptionexample
limitnonumberLimit size of color scheme results.pc.getColorSchemes(10)

pc.getLanguages(limit)

Get a list of all Package Control syntax languages.

paramrequiredtypedescriptionexample
limitnonumberLimit size of language results.pc.getLanguages(10)
0.1.4

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago