Netlify CLI utilities for configuration and API access
Last updated a year ago by sw-yx .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @netlify/cli-utils 
SYNC missed versions from official npm registry.


netlify-cli's @oclif/command baseclass.

Provides a unified way to load and persist global and site level cli config and authenticated api. Also allows commands to program against a consistent base-class api to enable changes down the road.


const Command = require('@netlify/cli-utils')

class OpenCommand extends Command {
  async run() {
    await this.authenticate()

    const api = this.netlify.api

    // authenticated api

OpenCommand.description = `A description`

OpenCommand.examples = [
  'netlify open:admin',
  'netlify open:site'

OpenCommand.hidden = true

module.exports = OpenCommand


Import the the base class and extend it, the same way you do with @oclif/command.

Commands that extend this base class get access to the same api as @oclif/command plus a few extra properties:


Provides access to configuration stored in the users home folder under ~/.netlify. See global-config.


Provides access to site-level state relative to the process.cwd. (e.g. project/.netlify/config.json) See site-config


An instance of the netlify api client. If access tokens are found in global config, then this client will automatically be authenticated.


get current site context including root, configPath, and id (with getter and setter).


Get the configuration from netlify.[toml/yml].


A method that will log the user in if they are not already logged in. If the user is already logged in, this is a noop.

Dependancy graph

Current Tags

  • 1.1.0                                ...           latest (a year ago)

9 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2017 © taobao.org |