fetch-idl

Fetch Thrift or Proto files from Git Repositories

Usage no npm install needed!

<script type="module">
  import fetchIdl from 'https://cdn.skypack.dev/fetch-idl';
</script>

README

fetch-idl CircleCI codecov npm version

Fetch Thrift or Proto files from Git Repositories

Usage

Install

npm install fetch-idl --save

Call the api

import fetchIdl from 'fetch-idl'

const repos = 'git@github.com:lancewuz/fetch-idl.git';
fetchIdl({ repo, branch: 'master', entryGlob: 'test/idl/!(error|index).thrift', outDir: `temp`, rootDir: '.' });

API

fetchIdl(params: FetchPramas): { commit: string }

fetch IDL files from repository, controlled by the FetchPramas:

interface FetchParams {
  // The repository of idl files
  repo: string;
  // The branch of the repo
  branch: string;
  // The entry file path expressed by Glob
  entryGlob: string;
  // The output directory for idl files
  outDir?: string;
  // The root directory of the entryGlob
  rootDir?: string;
  // The commit id of the repo
  commitId?: string;
}