kibana/x-pack/tasks/helpers/git_info.ts
Spencer ef6727cc52
[7.x] Update gulp related packages (major) (#46665 and #47421) (#47409)
* Update gulp related packages (major) (#46665)

* Update gulp related packages

* ts-ify and gulp4-ify x-pack tasks, remove unused canvas tasks

* remove unnecessary gulp.TaskFunction usage

* fix old references

* update renovate config

* move constants into helpers directory

* typo

* compact tasks a bit, remove unnecessary paths

* fix build directories

* deprecate testonly task

* rather than justifying an unjustifiable ts-ignore, ts-ify the imported module

* update renovate config

* update browser download tests to mock axios

* add root index.d.ts to tsconfig

* export BrowserType

* remove unnecessary `@ts-ignore`

* use consistent casing

* correct import for createAutoJUnitReporter

* Update gulp related packages (#47421)

(cherry picked from commit 35751f9828)
2019-10-06 22:49:28 -07:00

28 lines
805 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import path from 'path';
// @ts-ignore barely used, untyped module
import simpleGit from 'simple-git';
const gitDir = path.resolve(__dirname, '..', '..');
export async function gitInfo() {
const git = simpleGit(gitDir);
return new Promise<{ number: number; sha: string }>((resolve, reject) => {
git.log((err: undefined | Error, log: { total: number; latest: { hash: string } }) => {
if (err) {
reject(err);
} else {
resolve({
number: log.total,
sha: log.latest.hash,
});
}
});
});
}