-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.ts
46 lines (36 loc) · 1.23 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env node
import signale from "signale";
import { Build } from "./src/interfaces/build.interface";
import version from "./src/modules/version";
import message from "./src/modules/message";
import gitUser from "./src/modules/git/user";
import gitBranch from "./src/modules/git/branch";
import gitCommit from "./src/modules/git/commit";
import args from "./src/lib/arguments";
import write from "./src/lib/write";
(async () => {
if (args.verbose) signale.debug(args);
console.log("");
signale.start("Collection Build Information");
// Generate `build` object
const build: Build = {};
build.version = await version();
build.timestamp = new Date().toString();
build.message =
args.message || (args.message === "" ? await message() : null);
build.git = args.noGit
? null
: {
user: await gitUser(args.verbose),
branch: await gitBranch(),
hash: (await gitCommit())?.substr(0, 6),
fullHash: await gitCommit(),
};
// Write Build information to file
await write(build);
console.log("");
signale.success("Saved Build Information");
console.log("");
signale.info(build);
console.log("");
})();