
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
@hubspot/npm-scripts
Advanced tools
A collection of scripts for internal HubSpot npm package development and management.
hubspot-linking)The linking tool helps manage symlinked HubSpot packages in your development environment. It provides an interactive way to link and unlink local copies of @hubspot packages.
It can be used via npx
npx @hubspot/npm-scripts hubspot-linking
Or installed as a part of the project and used in the package.json
{
"dependencies": {
"@hubspot/npm-scripts": "latest"
},
"scripts": {
"local-link": "hubspot-linking"
}
}
yarn link from inside the local copy of any HubSpot package you want to make available for linking~/.config/yarn/link/@hubspot/node_modules/@hubspot directory for currently linked packagesyarn install --force to ensure dependencies are properly resolvedbuildReleaseScript)A utility function that creates a comprehensive npm release script with support for different release tags and semantic versioning.
Create a release script file (e.g., scripts/release.ts):
import { buildReleaseScript } from '@hubspot/npm-scripts';
import path from 'path';
buildReleaseScript({
packageJsonLocation: path.resolve('./package.json'),
buildHandlerOptions: {
repositoryUrl: 'https://github.com/your-org/your-repo',
mainBranch: 'main', // optional, defaults to 'master'
build: async () => {
// Optional custom build function
// If not provided, runs 'yarn build'
},
postLatestRelease: async () => {
// Optional function to run after latest releases
},
},
});
Then add to your package.json:
{
"scripts": {
"release": "tsx ./scripts/release.ts release"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}
# Release a patch version to latest
yarn release -v=patch -t=latest
# Release a minor version to next (beta)
yarn release -v=minor -t=next
# Release an experimental version
yarn release -v=patch -t=experimental
# Dry run (test without publishing)
yarn release -v=patch -t=latest -d
-v, --versionIncrement: SemVer increment type (patch, minor, major, prerelease)-t, --tag: Release tag (latest, next, experimental)-d, --dryRun: Run without actually publishingbuildRepoSyncScript)A utility function that creates a script to sync changes from an internal repository to a target repository (e.g., syncing internal packages to public GitHub).
Create a repo sync script file (e.g., scripts/repo-sync.ts):
import { buildRepoSyncScript } from '@hubspot/npm-scripts';
buildRepoSyncScript({
buildHandlerOptions: {
targetRepositoryOrg: 'https://github.com/your-org',
targetRepositoryName: 'public-repo',
buildCommitMessage: version =>
`Sync changes from internal repo for version ${version}`,
mainBranch: 'main', // optional, defaults to 'master'
excludePatterns: [
// optional, custom patterns to exclude from sync
'internal-only-file.ts',
'tests',
'tests/**',
],
},
});
NOTE: The sync script will always ignore the hs-temp-repo-sync and .git directories
Then add to your package.json:
{
"scripts": {
"repo-sync": "tsx ./scripts/repo-sync.ts repo-sync"
}
}
# Sync changes to target repository
yarn repo-sync -v=1.0.0 --ssh-key=~/.ssh/id_rsa
# Dry run (test without pushing)
yarn repo-sync -v=1.0.0 -d
-v, --version: Version to label the sync branch (required)-d, --dryRun: Run without pushing changes--ssh-key: Path to SSH key for target repository operationsThis script supports a PUBLIC_README.md pattern that allows you to maintain an internal readme file that does not sync to the target repo. The PUBLIC_README.md file will sync into the target repo as README.md.
FAQs
Scripts for working with npm packages in the HubSpot ecosystem
We found that @hubspot/npm-scripts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 40 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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.