Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 2.87 KB

CONTRIBUTING.md

File metadata and controls

77 lines (52 loc) · 2.87 KB

Contributing

To contribute, fork this repository and create a new branch. Then create a PR. For more detailed instructions, see this link.

Setup

  • Install the dependencies
yarn
  • Bootstrap lerna

In order to manage multiple npm packages in the same Github repos, we use lerna.

yarn lerna bootstrap
  • To test a command

First, you will need to create a config for the accounts that you want to be able to test using.

Once the config is created, commands can be run by providing a path to the executable file:

yarn hs upload --account [src] [dest]`
  • To test a command when @hubspot/cli is a dependency in another package like cms-theme-boilerplate.

In order to test changes in another npm package that is using @hubspot/cli, yarn link can be used.

cd /path/to/other-npm-package
yarn link @hubspot/cli

Local development with cli-lib

When contributing to hubspot-cli, you may also need to make changes to cli-lib. To use a local version of cli-lib as a dependancy, use yarn link.

  1. Run yarn link in cli-lib to set up a symlink.
  2. Run yarn link @hubspot/cli-lib in hubspot-cli to use the symlinked local package.

To stop using your local cli-lib, you can follow a similar process with yarn unlink.

Testing

Ensure you are on the minimum version of Node supported by the CLI before running any tests, since that is the version of node that the build step uses. To find the minimum, see the engine entry in the cli package.json.

Using nvm to switch between versions will help speed up development.

Tests on the CLI are located in three places:

  • /acceptance-tests/tests
  • /packages/cli/lib/__tests__
  • /packages/cli-lib/lib/__tests__

The acceptance tests are run using yarn test-cli. You will need to do some configuration before being able to run the acceptance tests. See the acceptance-tests folder for more information.

The unit tests are run with yarn test. To run a specific test, use yarn test [unit-test-name]

Before attempting to merge, make sure you have run the following commands:

node -v # v10.24.1
yarn test
yarn test-cli
yarn check-deps # Should output "No dependency issues found"

Merging

To merge, either create, or have a maintainer create a blank branch, and set your PRs base branch to the blank branch. Merge your PR into the blank branch, and ensure that it passes the build. Then merge the new branch into master.

Documentation