
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@hubspot/cli-lib
Advanced tools
: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.
HubSpot's cli-lib aims to provide useful ways of interacting with HubSpot's public APIs.
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.
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.
See Api Documentation for details.
npm i --global @hubspot/clinpm i --save @hubspot/cli-libThe 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.
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);
});
git clone https://github.com/HubSpot/hubspot-cli.git
npm i
cd hubspot-cli/packages/cli-lib
Licensed under Apache License, Version 2.0
FAQs
Library for creating scripts for working with HubSpot
The npm package @hubspot/cli-lib receives a total of 567 weekly downloads. As such, @hubspot/cli-lib popularity was classified as not popular.
We found that @hubspot/cli-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 28 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.