@sudoplatform/sudo-common 8.5.0 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/outdated-with-suppression.sh +41 -1
- package/package.json +20 -19
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
+
###
|
|
4
|
+
# This script is duplicated in platform-common. Any updates to this script here should also be adjusted in the platform-common repository.
|
|
5
|
+
###
|
|
6
|
+
|
|
3
7
|
set -e
|
|
4
8
|
d="$(dirname "$0")"
|
|
5
9
|
|
|
@@ -48,6 +52,35 @@ suppression_from_diff_type() {
|
|
|
48
52
|
esac
|
|
49
53
|
}
|
|
50
54
|
|
|
55
|
+
#
|
|
56
|
+
# This function will determine whether a new outdated dependency will cause the script to fail.
|
|
57
|
+
# It compares the publish date of the wanted version and only populates 'new' when the publish date is outside 'stability_days'.
|
|
58
|
+
#
|
|
59
|
+
classify_outdated_dependency() {
|
|
60
|
+
dependency_name=$1
|
|
61
|
+
wanted_version=$2
|
|
62
|
+
# Get the publish date of the version that matches 'wanted', returning YYYY-MM-DD
|
|
63
|
+
publish_date=$(yarn info "$dependency_name" time --json | jq -r '.data | to_entries[] | select(.key == "'"$wanted_version"'") | .value | split("T") | .[0]')
|
|
64
|
+
|
|
65
|
+
# Convert the 'publish_date' variable to epoch
|
|
66
|
+
if [ -z "$CI" ]; then
|
|
67
|
+
# CI_COMMIT_BRANCH is undefined, running locally, use mac environment
|
|
68
|
+
publish_date_epoch=$(date -j -f '%Y-%m-%d' "$publish_date" '+%s')
|
|
69
|
+
else
|
|
70
|
+
# CI_COMMIT_BRANCH is defined, running in CI context, use busybox environment
|
|
71
|
+
publish_date_epoch=$(date -d "$publish_date" +%s)
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Calculate the difference in days
|
|
75
|
+
diff_days=$(((current_epoch - publish_date_epoch) / 86400))
|
|
76
|
+
|
|
77
|
+
# Check if the difference in days is greater than or equal to 3, and set a new outdated dependency if it was not published in the last 3 days
|
|
78
|
+
if [ $diff_days -ge $stability_days ]; then
|
|
79
|
+
# The date is more than 3 days away from the current date, populate 'new' to return fail later
|
|
80
|
+
new=1
|
|
81
|
+
fi
|
|
82
|
+
}
|
|
83
|
+
|
|
51
84
|
# Number of days to suppress if accepting or refreshing and cadence to run if --last specified
|
|
52
85
|
cadence=30
|
|
53
86
|
|
|
@@ -63,6 +96,12 @@ refresh=""
|
|
|
63
96
|
# timestamp is found
|
|
64
97
|
last=""
|
|
65
98
|
|
|
99
|
+
# Define the number of days an outdated dependency exists for before it returns a fail. For example, if this is set to 3, it includes today, yesterday, and the day before.
|
|
100
|
+
stability_days=3
|
|
101
|
+
|
|
102
|
+
# Get the current date in epoch, this is used with stability_days and each outdated dependency's publish date to determine when the script should fail.
|
|
103
|
+
current_epoch=$(date +%s)
|
|
104
|
+
|
|
66
105
|
while [ -n "${1}" ]; do
|
|
67
106
|
case "${1}" in
|
|
68
107
|
--cadence)
|
|
@@ -175,7 +214,8 @@ yarn outdated --json | jq -r -s -c 'map(select(.type == "table").data.body) | .[
|
|
|
175
214
|
"${suppress_outdated}" --suppression "${cadence}" --"${latest_diff_type}" "${package_name}"
|
|
176
215
|
else
|
|
177
216
|
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${outdated_diff_type} outdated]"
|
|
178
|
-
|
|
217
|
+
classify_outdated_dependency "$package_name" "$wanted"
|
|
218
|
+
|
|
179
219
|
fi
|
|
180
220
|
elif [ -n "${accept}${refresh}" ]; then
|
|
181
221
|
echo "${package_name}: current: ${current} wanted: ${wanted} latest: ${latest} [${suppression_type} suppression refreshed]"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-common",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.1",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,10 +51,11 @@
|
|
|
51
51
|
"resolutions": {
|
|
52
52
|
"**/apollo-cache-inmemory": "^1.6.6",
|
|
53
53
|
"**/apollo-client": "^2.6.10",
|
|
54
|
-
"json5": "^1.0.2"
|
|
54
|
+
"json5": "^1.0.2",
|
|
55
|
+
"xml2js": "^0.5.0"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@aws-sdk/client-s3": "3.
|
|
58
|
+
"@aws-sdk/client-s3": "^3.317.0",
|
|
58
59
|
"apollo-client": "^2.6.10",
|
|
59
60
|
"asn1js": "^3.0.5",
|
|
60
61
|
"browser-bunyan": "^1.8.0",
|
|
@@ -68,17 +69,17 @@
|
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@types/jest": "^27.5.2",
|
|
71
|
-
"@types/node": "
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
73
|
-
"@typescript-eslint/parser": "^5.
|
|
72
|
+
"@types/node": "16.18.24",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
|
74
|
+
"@typescript-eslint/parser": "^5.59.0",
|
|
74
75
|
"aws-sdk-mock": "^5.8.0",
|
|
75
|
-
"concurrently": "^
|
|
76
|
-
"eslint": "^8.
|
|
76
|
+
"concurrently": "^8.0.1",
|
|
77
|
+
"eslint": "^8.39.0",
|
|
77
78
|
"eslint-config-prettier": "^8.8.0",
|
|
78
79
|
"eslint-plugin-import": "^2.27.5",
|
|
79
80
|
"eslint-plugin-prettier": "^4.2.1",
|
|
80
81
|
"eslint-plugin-tree-shaking": "^1.10.0",
|
|
81
|
-
"fp-ts": "^2.
|
|
82
|
+
"fp-ts": "^2.14.0",
|
|
82
83
|
"io-ts": "^2.2.20",
|
|
83
84
|
"io-ts-types": "^0.5.19",
|
|
84
85
|
"isomorphic-fetch": "^3.0.0",
|
|
@@ -86,23 +87,23 @@
|
|
|
86
87
|
"jest": "^27.5.1",
|
|
87
88
|
"monocle-ts": "^2.3.13",
|
|
88
89
|
"newtype-ts": "^0.3.5",
|
|
89
|
-
"prettier": "^2.8.
|
|
90
|
-
"rimraf": "^
|
|
90
|
+
"prettier": "^2.8.8",
|
|
91
|
+
"rimraf": "^5.0.0",
|
|
91
92
|
"ts-jest": "^27.1.5",
|
|
92
93
|
"ts-mockito": "^2.6.1",
|
|
93
94
|
"ts-node": "^10.9.1",
|
|
94
|
-
"typedoc": "^0.
|
|
95
|
+
"typedoc": "^0.24.5",
|
|
95
96
|
"typescript": "^4.9.5"
|
|
96
97
|
},
|
|
97
98
|
"outdatedSuppressions": {
|
|
98
99
|
"major": {
|
|
99
|
-
"@types/jest":
|
|
100
|
-
"@types/node":
|
|
101
|
-
"graphql":
|
|
102
|
-
"jest":
|
|
103
|
-
"ts-jest":
|
|
104
|
-
"typescript":
|
|
105
|
-
"json5":
|
|
100
|
+
"@types/jest": 1684846723,
|
|
101
|
+
"@types/node": 1684846723,
|
|
102
|
+
"graphql": 1684846723,
|
|
103
|
+
"jest": 1684846723,
|
|
104
|
+
"ts-jest": 1684846723,
|
|
105
|
+
"typescript": 1684846723,
|
|
106
|
+
"json5": 1684846723
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
}
|