From 2c53fd17c4578dc0983f456ce2022022fbc111b8 Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Wed, 10 Aug 2022 10:23:20 +0200 Subject: [PATCH 1/4] feat: add script to check if release is ok --- package.json | 2 +- scripts/check-release.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/check-release.sh diff --git a/package.json b/package.json index 64320bc..17ec3bf 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ ], "scripts": { "preversion": "rm -rf build && npm run build", - "prepare": "npm run build", + "prepare": "npm run build && ./scripts/check-release.sh", "build": "npm run build:ts && npm run build:web", "lint": "eslint ./src", "build:ts": "tsc", diff --git a/scripts/check-release.sh b/scripts/check-release.sh new file mode 100755 index 0000000..9a25232 --- /dev/null +++ b/scripts/check-release.sh @@ -0,0 +1,11 @@ + +# Get the main field from package.json +FILE=$(cat ./package.json | grep main | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') + +# test the path to see if the file exists +if test -f "$FILE"; then + echo "Release is OK" +else + echo "Release is NOT ok because the file specified as main in package.json at path ${FILE} does not exist" + exit 1 +fi \ No newline at end of file From 19a3ba734c824199e75538b8eb39956027fd7eb0 Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Wed, 10 Aug 2022 10:48:05 +0200 Subject: [PATCH 2/4] Update scripts/check-release.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gastón Fournier --- scripts/check-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-release.sh b/scripts/check-release.sh index 9a25232..474317c 100755 --- a/scripts/check-release.sh +++ b/scripts/check-release.sh @@ -1,6 +1,6 @@ # Get the main field from package.json -FILE=$(cat ./package.json | grep main | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') +FILE=$(grep '"main"' package.json | sed 's/.*:\s*"\(.*\)".*/\1/') # test the path to see if the file exists if test -f "$FILE"; then From efb16054b7bb13957165c18d3987aaf32c7ea7a6 Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Wed, 10 Aug 2022 10:51:29 +0200 Subject: [PATCH 3/4] fix: revert getter --- scripts/check-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-release.sh b/scripts/check-release.sh index 474317c..9a25232 100755 --- a/scripts/check-release.sh +++ b/scripts/check-release.sh @@ -1,6 +1,6 @@ # Get the main field from package.json -FILE=$(grep '"main"' package.json | sed 's/.*:\s*"\(.*\)".*/\1/') +FILE=$(cat ./package.json | grep main | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') # test the path to see if the file exists if test -f "$FILE"; then From c58593ef0815ee1f6cae96c49a7fdb1c65da68c1 Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Wed, 10 Aug 2022 11:02:28 +0200 Subject: [PATCH 4/4] fix: change field getter --- scripts/check-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-release.sh b/scripts/check-release.sh index 9a25232..8c4205f 100755 --- a/scripts/check-release.sh +++ b/scripts/check-release.sh @@ -1,6 +1,6 @@ # Get the main field from package.json -FILE=$(cat ./package.json | grep main | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') +FILE=$(grep '"main"' ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') # test the path to see if the file exists if test -f "$FILE"; then