0.0.22 • Published 4 months ago

@traf/core v0.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

traf 🚀

Avoid unnecessary builds, tests, lint and more in your monorepo CI. Optimize your development process by intelligently finding affected dependencies and selectively triggering builds and tests only when needed.

Monorepo support

This lib is designed to work with any monorepo, supported by the following packages:

If you want to add support for another monorepo tool, please open an issue.

@traf/core

A library that finds affected projects in a monorepo, based on the changed lines in the current branch.

Installation

npm install @traf/core

Usage

import { trueAffected } = from '@traf/core';

const affected = await trueAffected({
  rootTsConfig: 'tsconfig.base.json',
  projects: [
    {
      name: 'proj1',
      sourceRoot: '<project source>',
      tsConfig: '<project source>/tsconfig.json',
    },
    // ...
  ],
})

Options

OptionTypeDescriptionDefault
rootTsConfigstringThe path to the root tsconfig file
projectsProject[]An array of projects to check
cwdstringThe current working directory
basestringThe base branch to compare againstorigin/main
include(string \| Regexp)[]Glob patterns to include (relative to projects' source root)spec & test files

rootTsConfig - The path to the root tsconfig file, should include the paths prop with all projects mapping so ts-morph can find the references.

Project

OptionTypeDescription
namestringThe project name
sourceRootstringThe project source root
tsConfigstringThe project tsconfig file (should only include the project files)
implicitDependenciesstring[]An array of implicit dependencies

How it works?

The algorithm is based on the following steps:

  1. Using git to find all changed lines in the current branch.
  2. Using ts-morph to find the changed element (function, class, const etc..) per line.
  3. Using ts-morph findReferences to find all references to the changed element recursively.
  4. For each reference, find the project that contains the reference and add it to the affected projects list.
0.0.22

4 months ago

0.0.20

5 months ago

0.0.21

5 months ago

0.0.18

5 months ago

0.0.19

5 months ago

0.0.17

5 months ago

0.0.16

5 months ago

0.0.10

10 months ago

0.0.11

9 months ago

0.0.12

7 months ago

0.0.13

6 months ago

0.0.14

6 months ago

0.0.15

6 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago