UNPKG

@atomist/automation-client

Version:

Atomist API for software low-level client

48 lines 1.94 kB
#! /usr/bin/env node "use strict"; /* * Copyright © 2018 Atomist, Inc. * * See LICENSE file. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const fs = require("fs-extra"); const path = require("path"); const gitInfo_1 = require("../lib/internal/env/gitInfo"); /* tslint:disable:no-console */ /** * Generate git-info.json for automation client. */ function main() { return __awaiter(this, void 0, void 0, function* () { try { const cwd = process.cwd(); const gitInfoName = "git-info.json"; const gitInfoPath = path.join(cwd, gitInfoName); const gitInfo = yield gitInfo_1.obtainGitInfo(cwd); yield fs.writeJson(gitInfoPath, gitInfo, { spaces: 2, encoding: "utf8" }); console.info(`Successfully wrote git information to '${gitInfoPath}'`); process.exit(0); } catch (e) { console.error(`Failed to generate Git information: ${e.message}`); process.exit(1); } throw new Error("Should never get here, process.exit() called above"); }); } main() .catch((err) => { console.error(`Unhandled exception: ${err.message}`); process.exit(101); }); //# sourceMappingURL=git-info.js.map