1 | #! /usr/bin/env node
|
2 | "use strict";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
9 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
10 | return new (P || (P = Promise))(function (resolve, reject) {
|
11 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
14 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
15 | });
|
16 | };
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | const fs = require("fs-extra");
|
19 | const path = require("path");
|
20 | const gitInfo_1 = require("../lib/internal/env/gitInfo");
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function main() {
|
26 | return __awaiter(this, void 0, void 0, function* () {
|
27 | try {
|
28 | const cwd = process.cwd();
|
29 | const gitInfoName = "git-info.json";
|
30 | const gitInfoPath = path.join(cwd, gitInfoName);
|
31 | const gitInfo = yield gitInfo_1.obtainGitInfo(cwd);
|
32 | yield fs.writeJson(gitInfoPath, gitInfo, { spaces: 2, encoding: "utf8" });
|
33 | console.info(`Successfully wrote git information to '${gitInfoPath}'`);
|
34 | process.exit(0);
|
35 | }
|
36 | catch (e) {
|
37 | console.error(`Failed to generate Git information: ${e.message}`);
|
38 | process.exit(1);
|
39 | }
|
40 | throw new Error("Should never get here, process.exit() called above");
|
41 | });
|
42 | }
|
43 | main()
|
44 | .catch((err) => {
|
45 | console.error(`Unhandled exception: ${err.message}`);
|
46 | process.exit(101);
|
47 | });
|
48 |
|
\ | No newline at end of file |