@hedia/types 2.1.39 → 2.1.40
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/package.json +1 -1
- package/bump-package-version.sh +0 -80
- package/remove-alpha-tag.sh +0 -15
package/package.json
CHANGED
package/bump-package-version.sh
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# @latest on npm
|
|
2
|
-
latestVersionNPM=$(npm show ./ dist-tags.latest --json)
|
|
3
|
-
echo "Latest dist-tag version on npm: $latestVersionNPM"
|
|
4
|
-
|
|
5
|
-
# Initial package.json version
|
|
6
|
-
packageJSONVersion=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
|
|
7
|
-
echo "Initial package.json version: $packageJSONVersion"
|
|
8
|
-
|
|
9
|
-
npmV=`echo $latestVersionNPM | sed 's/\.//g' | bc`
|
|
10
|
-
pkgV=`echo $packageJSONVersion | sed 's/\.//g' | bc`
|
|
11
|
-
|
|
12
|
-
# Check if the packageJSONVersion is up to date.
|
|
13
|
-
# Otherwise, bump the package.json version, accordingly to the label.
|
|
14
|
-
if [[ $npmV -lt $pkgV ]]; then
|
|
15
|
-
echo "package.json version is up to date"
|
|
16
|
-
else
|
|
17
|
-
# Set package.json to latest NPM version prior to bump version
|
|
18
|
-
sed -i 's/\("version": \)\("[0-9]\+.[0-9]\+.[0-9]\+\)\(\"\)/\1\'$latestVersionNPM'/' package.json
|
|
19
|
-
case "$1" in
|
|
20
|
-
*"major"*)
|
|
21
|
-
echo "Bumping pre-major version"
|
|
22
|
-
echo "$(npm version --no-git-tag-version premajor --preid alpha)"
|
|
23
|
-
;;
|
|
24
|
-
*"minor"*)
|
|
25
|
-
echo "Bumping pre-minor version"
|
|
26
|
-
echo $(npm version --no-git-tag-version preminor --preid alpha)
|
|
27
|
-
;;
|
|
28
|
-
*"patch"*)
|
|
29
|
-
echo "Bumping pre-patch version"
|
|
30
|
-
echo "$(npm version --no-git-tag-version prepatch --preid alpha)"
|
|
31
|
-
;;
|
|
32
|
-
*)
|
|
33
|
-
echo "No [major, minor, patch] label has been set"
|
|
34
|
-
;;
|
|
35
|
-
esac
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Get all published versions on npm.
|
|
39
|
-
allVersionsArray=$(npm show ./ versions)
|
|
40
|
-
# Get the current version from the package.json
|
|
41
|
-
upToDatePackageJSON=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
|
|
42
|
-
|
|
43
|
-
# Identify the latest published alpha (if any) on npm, of the upToDatePackageJSON.
|
|
44
|
-
for i in ${allVersionsArray[@]}
|
|
45
|
-
do
|
|
46
|
-
if [[ $i == *$upToDatePackageJSON* ]]; then
|
|
47
|
-
latestAlphaVersion=$(echo $i)
|
|
48
|
-
fi
|
|
49
|
-
done
|
|
50
|
-
|
|
51
|
-
# Get the alpha counter value of the latest alpha version (for the upToDatePackageJSON version).
|
|
52
|
-
alphaVersionCounter="$(echo "$latestAlphaVersion" | grep -oP '(?:-alpha.)\K\d+')"
|
|
53
|
-
|
|
54
|
-
# Bumping the alphaVersionCounter by 1.
|
|
55
|
-
if [[ "$alphaVersionCounter" != "" ]];
|
|
56
|
-
then
|
|
57
|
-
alphaVersionCounter="$((alphaVersionCounter+1))"
|
|
58
|
-
else
|
|
59
|
-
alphaVersionCounter="0"
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Get the current packageVersion and check if -alpha.X tag has been set (in case of package.json version bump (Open PR))
|
|
63
|
-
packageVersion=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json)
|
|
64
|
-
if [[ "$packageVersion" == *"-alpha"* ]];
|
|
65
|
-
then
|
|
66
|
-
# On open PR
|
|
67
|
-
# Set alpha tag to the correspondent version
|
|
68
|
-
echo "Setting alpha version to $alphaVersionCounter"
|
|
69
|
-
sed -i 's/\("version": "[0-9]\+.[0-9]\+.[0-9]\+\)\(-alpha.\)\([0-9]\)/\1\'-alpha.$alphaVersionCounter'/' package.json
|
|
70
|
-
bumpedPackageVersion=$(sed -nE 's/^\s*"version": "([0-9]+.[0-9]+.[0-9]+).*?",$/\1/p' package.json)
|
|
71
|
-
# Commit changes
|
|
72
|
-
git add package.json
|
|
73
|
-
git commit -m "autobump $bumpedPackageVersion"
|
|
74
|
-
else
|
|
75
|
-
echo "on push"
|
|
76
|
-
# On push commit
|
|
77
|
-
# Set alpha tag to the correspondent version
|
|
78
|
-
echo "Setting alpha version to $alphaVersionCounter"
|
|
79
|
-
sed -i 's/\("version": "\)\([0-9]\+\.[0-9]\+\.[0-9]\+\)\("\)/\1\2\-alpha.'$alphaVersionCounter'\3/' package.json
|
|
80
|
-
fi
|
package/remove-alpha-tag.sh
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
alphaNumber="$(sed -n 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\-alpha\.\)\([0-9]\+\)\("\)\(,\)/\2/p' package.json)"
|
|
2
|
-
|
|
3
|
-
previousCommit="$(git log -1 --pretty=%B)"
|
|
4
|
-
|
|
5
|
-
if [ "$alphaNumber" != "" ];
|
|
6
|
-
then
|
|
7
|
-
sed -i 's/\("version": "[0-9]\+\.[0-9]\+\.[0-9]\+\)\(-alpha\.\)\([0-9]\+\)\("\)/\1\4/' package.json
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
if [[ "$previousCommit" == *"autobump"* ]];
|
|
11
|
-
then
|
|
12
|
-
git add package.json
|
|
13
|
-
git commit --amend --no-edit
|
|
14
|
-
git push
|
|
15
|
-
fi
|