Skip to content

Commit 7d68d29

Browse files
authored
Remove dotenv dependency (#290)
Removes the docusaurus dotenv dependency (`docusaurus2-dotenv`). With this, a new mechanism to inject the current version is introduced. It is now directly imported from javascript file which is generated by build.sh
1 parent 4153184 commit 7d68d29

File tree

8 files changed

+135
-4002
lines changed

8 files changed

+135
-4002
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ build
44
.env
55
google7cffb0370fcac18c.html
66
.yalc
7-
yalc.lock
7+
yalc.lock

build.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@
44
# Add versions to frontpage
55
#
66

7+
JS_FILE="./static/current-version.js"
8+
79
function next() {
10+
printf "\n" >> "$JS_FILE"
11+
812
NEXTVERSIONCANDIDATE=$(curl --silent "https://api.github.com/repos/eclipsesource/jsonforms/tags" | grep '"name":' | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
9-
if [[ ${NEXTVERSIONCANDIDATE:0:1} == "v" ]] && [[ $NEXTVERSIONCANDIDATE != $CURRENTVERSION ]] ; then NEXTVERSION="${NEXTVERSIONCANDIDATE:1}"; fi
10-
echo -e "NEXTVERSION = $NEXTVERSION" >> .env
13+
if [[ ${NEXTVERSIONCANDIDATE:0:1} == "v" ]] && [[ $NEXTVERSIONCANDIDATE != $CURRENTVERSION ]]; then
14+
NEXTVERSION="${NEXTVERSIONCANDIDATE:1}"
15+
fi
16+
printf "export const nextVersion = '$NEXTVERSION';" >> "$JS_FILE"
1117
}
1218

1319
function current() {
1420
CURRENTVERSION=$(curl --silent "https://api.github.com/repos/eclipsesource/jsonforms/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
15-
echo -e "CURRENTVERSION = $CURRENTVERSION" >> .env
21+
printf "export const currentVersion = '$CURRENTVERSION';" >> "$JS_FILE"
1622
}
1723

1824
WITH_NEXT=$1
1925

20-
rm -f .env
26+
rm -f "$JS_FILE"
27+
2128
if [[ $WITH_NEXT = "next" ]]; then
2229
current
2330
next
2431
else
2532
current
2633
fi
34+
35+
printf "\n" >> "$JS_FILE"

content/pages/assets/index.module.css

+9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
filter: invert(1);
4141
}
4242

43+
.versionwrapper {
44+
margin-bottom: 20px;
45+
}
46+
47+
.version, .nextversion {
48+
height: 25px;
49+
margin-bottom: 0;
50+
}
51+
4352
.home h2 {
4453
text-align: center;
4554
padding-top: 20px;

docusaurus.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ module.exports = {
130130
],
131131
plugins: [
132132
path.resolve(__dirname, './src/custom-webpack'),
133-
'docusaurus2-dotenv',
134133
[
135134
'@docusaurus/plugin-content-pages',
136135
{

0 commit comments

Comments
 (0)