Skip to content

Latest commit

聽

History

History
83 lines (54 loc) 路 2.82 KB

contributing.md

File metadata and controls

83 lines (54 loc) 路 2.82 KB

Contributing Guide

We're glad you want to contribute!

Local development

You can use the command yarn watch to test the VTEX Toolbelt locally. It creates a symlink named vtex-test, with which you can test your code as you develop.

To be able to use it you'll have to add $HOME/.vtex/dev/bin to your PATH environment variable. This may differ across different OSs, but follow this steps:

  1. Open the ~/.bashrc file (or the correponding shell configuration file).
  2. On the end of the file, add the line: export PATH=$PATH:$HOME/.vtex/dev/bin .
  3. Save it.
  4. Run the command source ~/.bashrc (or corresponding file).

That's it! Now you're able to run yarn watch and, on another terminal session, use the command vtex-test as an alias to what you're developing.

Building the binaries locally and testing them

You can build the binaries and test it locally. You can run the commands:

yarn build && yarn oclif-dev pack

A folder named dist will be created with all the binaries for different OS. The command below enable to use the binaries for MacOS:

tar -xzf /Users/fila/Code/vtex/toolbelt/dist/vtex-v4.3.0/vtex-v4.3.0-darwin-x64.tar.gz -C ~/.local/vtex # or copy it to any other folder you want

Now, you can use the binaries in a VTEX IO App as:

~/.local/vtex/vtex/bin/vtex --version # or any other command

Building the tgz locally and testing it as a global installation for npm or yarn

You can simulate a global installation for npm or yarn with your local changes. To do so, follow the following steps:

  1. Make sure you don't have vtex in your environment. Running which vtex should return vtex not found. You can also uninstall it with:
yarn global remove vtex  
# or (depending on your installation)
npm -g un vtex
  1. Build the project locally and create a .tgz file:
yarn install
yarn build
npm pack
  1. Install it globally using your the consumer you want to test:
yarn global add file:$(pwd)/vtex-4.3.2-beta.15.tgz 
# or
npm -g install ./vtex-4.3.2-beta.15.tgz

Don't forget to clean it up after testing it

Adding commands

The VTEX CLI uses Ocliff under the hood, making it very easy to add or improve commands. Follow this guide to learn how to develop on this project.

Git workflow

We adhere to a strict pull request review workflow. Please refrain from committing any "serious" changes directly to master. Small fixes are ok. ;)

  1. Create a branch from master. (e.g. git checkout -b feature/super-awesome-thing)
  2. Submit a Pull Request.
  3. Wait for comments from reviewers, discuss and fix any issues.
  4. Wait for a 馃専 LGTM 馃専.
  5. Merge to master, delete your branch and release to npm.

Please do not leave any unpublished code in master!