We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b39d1ff commit 66bbb37Copy full SHA for 66bbb37
timestamp.sh
@@ -1,7 +1,13 @@
1
-# Timestamp a git/npm project in node JS
2
-echo "export const versionInfo = {"
+#!/bin/bash
+
3
+echo "export default {"
4
date -u '+buildTime: "%Y-%m-%dT%H:%M:%SZ",'
5
git log | grep commit | head -1 | sed -e 's/ /: "/' | sed -e 's/$/",/'
-echo npmInfo:
6
-npm version
7
-echo "};"
+echo " npmInfo: {"
+ npm version | sed 's/\x1b\[[0-9;:]*[mG]//g' | grep -v '^{' | while read line; do
8
+ key=$(echo "$line" | cut -d ':' -f 1 | tr -d ' ')
9
+ value=$(echo "$line" | cut -d ':' -f 2- | tr -d ' ')
10
+ echo " \"${key}\": \"${value}\","
11
+ done
12
+echo " }"
13
+echo "};"
0 commit comments