npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hubspot/cli-lib

v9.1.1

Published

Library for creating scripts for working with HubSpot

Downloads

7,427

Readme

Deprecated

:warning: This library is deprecated and is currently being replaced by the new local-dev-lib library. It will remain available for use, but no new functionality will be added to it. Please consider porting to the new local-dev-lib.

Table of Contents

What is CLI-lib for?

HubSpot's cli-lib aims to provide useful ways of interacting with HubSpot's public APIs.

Why use it?

HubSpot's cli-lib can integrate with various task runners and bundlers such as Gulp, Grunt, and Webpack.

Internally, the HubSpot cli-lib is consumed by the HubSpot CLI, the official HubSpot Webpack plugin, and the official HubSpot serverless development runtime.

Scope

The full scope of the cli-lib is quite large. It provides the ability to manage authentication, custom objects, the file manager, files within the Design Manager, serverless functions, HubDB, and more.

API

See Api Documentation for details.

Installation

  • Install Node.js. The LTS version is recommended, however the HubSpot CLI supports any version from 10 and up. Installation details can be found at nodejs.org
  • Install the following modules from NPM:
    • npm i --global @hubspot/cli
    • npm i --save @hubspot/cli-lib

Usage

The easiest way to authenticate is through the use of a hubspot.config.yml file. This can be generated with the HubSpot CLI we installed above. Run hs init to generate this file. If you already have a hubspot.config.yml file, you can ensure you are authenticated by running the hs auth command. Upon doing this, the hubspot.config.yml file will be updated with the access token needed to make API calls.

It is possible to do this programmatically through APIs as well, however all of the functionality within cli-lib assumes the authentication credentials are within a hubspot.config.yml file.

Hello World

Let's get started with a simple example. In this example, we are going to get the contents of the root directory in the Design Manager file system. One important note. For any of the cli-lib functionality to work, you must have your hubspot.config.yml configured and authenticated for whatever account name you specify in the code below. See the usage section above for details.

const {
  getDirectoryContentsByPath,
  getAccountId,
  loadConfig,
} = require('@hubspot/cli-lib/api/fileMapper');

// Loads the hubspot.config.yml file into memory for cli-lib usage
loadConfig();

/**
 *  getAccountId will get the default accountId specified in your hubspot.config.yml file
 *  You can alternatively pass in an account name if you don't want the default account
 *  to be used.
 */
const accountId = getAccountId();
getDirectoryContentsByPath(accountId, '/').then(response => {
  console.log(response);
});

Contributing

Requirements

Clone

git clone https://github.com/HubSpot/hubspot-cli.git

Install Dependencies

npm i

Directory

cd hubspot-cli/packages/cli-lib

Submitting Changes

  1. Create a fork
  2. Apply your changes to the fork
  3. Open a Pull Request

Licensed under Apache License, Version 2.0