Skip to content

redhat-developer/git-service

Repository files navigation

Quick start

Import library

npm install git-service-node

How to use

Data Model

Gitsource

{
  url: string;
  secretType: SecretType;
  secretContent: any;
  ref?: string
}

Get git Service

Get git service from factory method

 import { getGitService } from 'git-service-node/src'
 const service = getGitService(gitsource, gitprovider);

APIs available

Check if Repo exist

 const resp = service.isRepoReachable();

Get list of branches

 const branchList = service.getRepoBranchList();

Detect build type

 const buildTypes = service.detectBuildType();

Detect Languages list

 const languages = service.getLanguageList();

Get list of files exist in the repo

 const files = service.getRepoFileList();

Detect Dockerfile in the repo

 // This check returns boolean value
 const isPresent = service.isDockerfilePresent();

Get Dockerfile content

 const content = service.getDockerfileContent();

Get Exposed container

 // Get dockerfile parser
 const parser = new DockerFileParser(content);
 // Get exposed container port
 const containerPort = parser.getContainerPort(); 

Available scripts

  • clean - remove coverage data, Jest cache and transpiled files,
  • build - transpile TypeScript to ES6,
  • build:watch - interactive watch mode to automatically transpile source files,
  • lint - lint source files and tests,
  • test - run tests,
  • test:watch - interactive watch mode to automatically re-run tests

Releases

No releases published

Packages

No packages published