From 7560642d913c8c9dfc419697a2d659e8639aa01f Mon Sep 17 00:00:00 2001 From: timea-solid <4144203+timea-solid@users.noreply.github.com> Date: Tue, 19 Aug 2025 16:37:41 +0200 Subject: [PATCH] imporved timestamp bash --- timestamp.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/timestamp.sh b/timestamp.sh index 408b864c..dc7121eb 100755 --- a/timestamp.sh +++ b/timestamp.sh @@ -1,7 +1,13 @@ -# Timestamp a git/npm project in node JS +#!/bin/bash + echo "export default {" date -u '+buildTime: "%Y-%m-%dT%H:%M:%SZ",' git log | grep commit | head -1 | sed -e 's/ /: "/' | sed -e 's/$/",/' -echo npmInfo: -npm version -echo "};" +echo " npmInfo: {" + npm version | sed 's/\x1b\[[0-9;:]*[mG]//g' | grep -v '^{' | while read line; do + key=$(echo "$line" | cut -d ':' -f 1 | tr -d ' ') + value=$(echo "$line" | cut -d ':' -f 2- | tr -d ' ') + echo " \"${key}\": \"${value}\"," + done +echo " }" +echo "};" \ No newline at end of file