Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 2.88 KB

CONTRIBUTION.md

File metadata and controls

86 lines (61 loc) · 2.88 KB

Contributing to gitversion

Nice of you to join te gitversion repository. In order to get started I'd like to explain the basic setups of the repo

You can read about the way gitversion works at the documentation site.

Getting started

Read Repo setup to get yourself familiar with the key concepts

clone/fork

Install the packages by executing yarn in the repository root:

$ yarn 

Verify if everything works as expected:

$ yarn gitversion check
$ yarn gitversion bump
$ yarn gitversion pack 
$ yarn gitversion publish --dry-run
$ yarn gitversion reset

Repo setup

The repository setup has the following key elements:

Yarn

The repository is a yarn berry workspace setup (monorepo). This means we use yarn to manage dependencies. Yarn berry operates in pnp mode so we never have any heavy node_module folders.

We also use yarn constraints for consistency of packages dependencies and generation of mandatory fields. Please read into this concept if you are not familiar with it.

Typescript

All source code in the repo is typescript. The only exception for this are (small) configuration files.

There should never be any need to have any javascript available during development time. The only time we have javascript is during the pack command of the actual production package. You can see this in action in workspaces/packages/gitversion/package.json where we have basically this:

"scripts": {
  "prepack": "tsc --noEmit false", // Execute typescript with the option to emit teh output before we pack
  "postpack": "rm -rf lib"         // Remove the generated files to cleanup the workspace
}

And we use this to be able to use gitversion itself in typescript mode:

"bin": "bin/index-typescript.js",
"main": "src/index.ts",
"types": "src/index.ts",
"publishConfig": {
    "main": "./lib/index.js",
    "types": "./lib/index.d.ts",
    "bin": "bin/index.js"
},

Gitversion

Of course we use gitversion itself in the repo. We use it in the default mode and execute it with the above helpers in combination with ts-node

Jest

Jest is used for unit testing. We basically have the following config defaults:

source-file.ts
source-file._test_.ts

This way your test file is always directly located next to your source file.

Test files are not included in the generated package

Eslint

We use eslint with the default @cp-utils/eslint config rules to keep our code styling consistent