Skip to content

Latest commit

 

History

History
222 lines (145 loc) · 6.16 KB

CONTRIBUTING.md

File metadata and controls

222 lines (145 loc) · 6.16 KB

Contributing to sf-git-merge-driver

We encourage the developer community to contribute to this repository. This guide has instructions to install, build, test and contribute to the framework.

Requirements

Installation

1) Download the repository

git clone git@github.com:scolladon/sf-git-merge-driver.git

2) Install Dependencies

This will install all the tools needed to contribute

npm install

3) Build application

npm pack

Rebuild every time you made a change in the source and you need to test locally

Testing

Unit Testing sgd

When developing, use jest unit testing to provide test coverage for new functionality. To run the jest tests use the following command from the root directory:

# just run test
npm run test:unit

To execute a particular test, use the following command:

npm run test:unit -- <path_to_test>

NUT Testing sgd

When developing, use mocha testing to provide NUT functional test. To run the mocha tests use the following command from the root directory:

# run test
npm run test:nut

E2E Testing

WIP

Editor Configurations

Configure your editor to use our lint and code style rules.

Code formatting

Biome Format, lint, and more in a fraction of a second.

Code linting

Biome Format, lint, and more in a fraction of a second.

Commit linting

This repository uses Commitlint to check our commit convention. Pre-commit git hook using husky and pull request check both the commit convention for each commit in a branch.

You can use an interactive command line to help you create supported commit message

npm run commit

PR linting

When a PR is ready for merge we use the PR name to create the squash and merge commit message. We use the commit convention to auto-generate the content and the type of each release It needs to follow our commit lint convention and it will be check at the PR level

Git Workflow

The process of submitting a pull request is straightforward and generally follows the same pattern each time:

  1. Fork the repo
  2. Create a feature branch
  3. Make your changes
  4. Rebase
  5. Check your submission
  6. Create a pull request
  7. Update the pull request

Fork the repo

Fork the scolladon/sf-git-merge-driver repo. Clone your fork in your local workspace and configure your remote repository settings.

git clone git@github.com:<YOUR-USERNAME>/sf-git-merge-driver.git
cd sf-git-merge-driver
git remote add upstream git@github.com:scolladon/sf-git-merge-driver.git

Create a feature branch

git checkout main
git pull origin main
git checkout -b feature/<name-of-the-feature>

Make your changes

Change the files, build, test, lint and commit your code using the following command:

git add <path/to/file/to/commit>
git commit ...
git push origin feature/<name-of-the-feature>

Commit your changes using a descriptive commit message

The above commands will commit the files into your feature branch. You can keep pushing new changes into the same branch until you are ready to create a pull request.

Rebase

Sometimes your feature branch will get stale on the main branch, and it will must a rebase. Do not use the github UI rebase to keep your commits signed. The following steps can help:

git checkout main
git pull upstream main
git checkout feature/<name-of-the-feature>
git rebase upstream/main

note: If no conflicts arise, these commands will apply your changes on top of the main branch. Resolve any conflicts.

Check your submission

Lint your changes

npm run lint

The above command may display lint issues not related to your changes. The recommended way to avoid lint issues is to configure your editor to warn you in real time as you edit the file.

the plugin lint all those things :

  • typescript files
  • folder structure
  • plugin parameters
  • plugin output
  • dependencies
  • dead code / configuration

Fixing all existing lint issues is a tedious task so please pitch in by fixing the ones related to the files you make changes to!

Run tests

Test your change by running the unit tests and integration tests. Instructions here.

Create a pull request

If you've never created a pull request before, follow these instructions. Pull request samples here

Update the pull request

git fetch origin
git rebase origin/${base_branch}

# Then force push it
git push origin ${feature_branch} --force-with-lease

note: If your pull request needs more changes, keep working on your feature branch as described above.

CI validates prettifying, linting and tests

Collaborate on the pull request

We use Conventional Comments to ensure every comment expresses the intention and is easy to understand. Pull Request comments are not enforced, it is more a way to help the reviewers and contributors to collaborate on the pull request.

CLI parameters convention

The plugins uses sf cli parameters convention to define parameters for the CLI.

Testing the plugin from a pull request

To test SGD as a Salesforce CLI plugin from a pending pull request:

  1. locate the comment with the beta version published in the pull request
  2. install the beta version sf plugins install sf-git-merge-driver@<beta-channel>
  3. test the plugin!