UNPKG

@atomist/automation-client

Version:
43 lines 1.88 kB
#! /usr/bin/env node "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 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) : new P(function (resolve) { resolve(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("../internal/env/gitInfo"); const logger_1 = require("../internal/util/logger"); logger_1.LoggingConfig.format = "cli"; /** * 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" }); logger_1.logger.info(`Successfully wrote git information to '${gitInfoPath}'`); process.exit(0); } catch (e) { logger_1.logger.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) => { logger_1.logger.error(`Unhandled exception: ${err.message}`); process.exit(101); }); //# sourceMappingURL=git-info.js.map