Skip to content

Commit a674e1f

Browse files
Updates
1 parent 87379ab commit a674e1f

22 files changed

+300
-69
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# _just
1+
# Just an Ultimate Site Tool
22
w.i.p.

action.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,19 @@
2121
# SOFTWARE.
2222

2323
name: '_just'
24-
description: 'A GitHub Action to modify and override your Next.js site on GitHub Pages.'
24+
description: 'Just an Ultimate Site Tool. A GitHub Action to modify and override your Next.js site on GitHub Pages (Postprocessor).'
2525
author: 'JustDeveloper1'
2626
branding:
2727
icon: 'edit'
2828
color: 'purple'
2929
runs:
3030
using: 'composite'
3131
steps:
32-
- run: |
33-
bash $GITHUB_ACTION_PATH/src/checks.sh
34-
shell: bash
35-
- run: |
36-
bash $GITHUB_ACTION_PATH/src/prepare_deployment.sh
37-
shell: bash
38-
- run: |
39-
bash $GITHUB_ACTION_PATH/src/create_api_endpoints.sh
40-
shell: bash
41-
- run: |
42-
bash $GITHUB_ACTION_PATH/src/modify_deployment.sh
43-
shell: bash
44-
- run: |
45-
bash $GITHUB_ACTION_PATH/src/override_deployment.sh
46-
shell: bash
47-
- run: |
48-
bash $GITHUB_ACTION_PATH/src/build_map.sh
49-
shell: bash
32+
- name: Checkout code
33+
uses: actions/checkout@v2
34+
- name: Set up Node.js
35+
uses: actions/setup-node@v2
36+
with:
37+
node-version: '14'
38+
- name: Run _just
39+
run: bash $GITHUB_ACTION_PATH/src/run.sh

data/codes.json

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"README": {
3+
" CODES ": {
4+
" OK ": " 0000 - 0099 ",
5+
" CRASH ": " 0100 - 0199 ",
6+
" WARNING ": " 0200 - 0299 "
7+
}
8+
},
9+
"important_dirs": [
10+
{
11+
"code": "0106",
12+
"message": "Your repository has a deploy directory in the root directory. Please remove it.",
13+
"crashed": true,
14+
"link": ""
15+
},
16+
{
17+
"code": "0107",
18+
"message": "Your repository has a _just_data directory in the root directory. Please remove it.",
19+
"crashed": true,
20+
"link": ""
21+
}
22+
],
23+
"index.sh": [
24+
{
25+
"code": "0204",
26+
"message": "Attempt to use \"Just an Ultimate Site Tool\" as a postprocessor in the wrond way. This may not work correctly. Please read the documentation (coming soon).",
27+
"crashed": true,
28+
"link": ""
29+
}
30+
],
31+
"run.sh": [
32+
{
33+
"code": "0108",
34+
"message": "The just.config.js file in the root directory is missing.",
35+
"crashed": true,
36+
"link": ""
37+
},
38+
{
39+
"code": "0109",
40+
"message": "The just.config.js file cannot be parsed.",
41+
"crashed": true,
42+
"link": ""
43+
},
44+
{
45+
"code": "0110",
46+
"message": "Unable to get value of property \"type\" in just.config.js.",
47+
"crashed": true,
48+
"link": ""
49+
},
50+
{
51+
"code": "0111",
52+
"message": "Invalid value of property \"type\" in just.config.js. It must be one of: \"postprocessor\", \"redirect\".",
53+
"crashed": true,
54+
"link": ""
55+
},
56+
{
57+
"code": "0112",
58+
"message": "The just.config.js' \"module.exports\" json cannot be parsed.",
59+
"crashed": true,
60+
"link": ""
61+
}
62+
],
63+
"postprocessor/checks.sh": [
64+
{
65+
"code": "0100",
66+
"message": "( DIRECTORY IS MISSING )",
67+
"crashed": true,
68+
"link": ""
69+
},
70+
{
71+
"code": "0101",
72+
"message": "The _just/404.html file is missing.",
73+
"crashed": true,
74+
"link": ""
75+
},
76+
{
77+
"code": "0200",
78+
"message": "The _just/404.html file is missing. So, the 404 page will be an \"Just an Ultimate Site Tool\" postprocessor's error 404 template page.",
79+
"crashed": false,
80+
"link": ""
81+
}
82+
],
83+
"postprocessor/create_api_endpoints.sh": [
84+
{
85+
"code": "0102",
86+
"message": "Your website has an API directory in the root directory. Please remove it.",
87+
"crashed": true,
88+
"link": ""
89+
}
90+
],
91+
"postprocessor/modify_deployment.sh": [
92+
{
93+
"code": "0103",
94+
"message": "Your website has a _just directory in the root directory. Please remove it.",
95+
"crashed": true,
96+
"link": ""
97+
},
98+
{
99+
"code": "0104",
100+
"message": "Inserting files in _just directory is not allowed.",
101+
"crashed": true,
102+
"link": ""
103+
},
104+
{
105+
"code": "0105",
106+
"message": "Inserting files in _next directory is not allowed..",
107+
"crashed": true,
108+
"link": ""
109+
},
110+
{
111+
"code": "0201",
112+
"message": "( FAILED TO INSERT A FILE )",
113+
"crashed": false,
114+
"link": ""
115+
}
116+
],
117+
"postprocessor/override_deployment.sh": [
118+
{
119+
"code": "0202",
120+
"message": "Your website already has a 404.html file, _just/404.html won't be inserted.",
121+
"crashed": false,
122+
"link": ""
123+
},
124+
{
125+
"code": "0203",
126+
"message": "Your website already has a 404.html file, \"Just an Ultimate Site Tool\" postprocessor's error 404 template page file won't be inserted.",
127+
"crashed": false,
128+
"link": ""
129+
}
130+
]
131+
}

index.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2025 JustDeveloper <https://justdeveloper.is-a.dev/>
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
123
# DO NOT USE THIS. READ THE DOCS (coming soon). USE ACTION.YML.
2-
echo "Warning: Attempt to use _just in a wrond way. This may not work right. Pleace read the docs (coming soon)."
3-
bash $GITHUB_ACTION_PATH/src/checks.sh
4-
bash $GITHUB_ACTION_PATH/src/prepare_deployment.sh
5-
bash $GITHUB_ACTION_PATH/src/create_api_endpoints.sh
6-
bash $GITHUB_ACTION_PATH/src/modify_deployment.sh
7-
bash $GITHUB_ACTION_PATH/src/override_deployment.sh
8-
bash $GITHUB_ACTION_PATH/src/build_map.sh
24+
echo "Warning: Attempt to use the \"Just an Ultimate Site Tool\" as a postprocessor in the wrond way. This may not work correctly. Please read the documentation (coming soon)."
25+
bash $GITHUB_ACTION_PATH/src/postprocessor.sh

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "justdev_just",
3-
"version": "0.0.10",
4-
"description": "w.i.p.",
2+
"name": "just",
3+
"version": "0.0.25",
4+
"description": "Just an Ultimate Site Tool (W.I.P.)",
55
"main": "index.sh",
66
"scripts": {
77
"test": "echo \"https://github.com/JustDeveloper1/_just#readme\" && exit 1",
@@ -28,8 +28,17 @@
2828
"nodejs",
2929
"github",
3030
"pages",
31-
"github",
32-
"pages"
31+
"just",
32+
"ultimate",
33+
"site",
34+
"tool",
35+
"node",
36+
"js",
37+
"javascript",
38+
"next",
39+
"nextjs",
40+
"react",
41+
"reactjs"
3342
],
3443
"author": "JustDeveloper",
3544
"license": "MIT",

src/postprocessor.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2025 JustDeveloper <https://justdeveloper.is-a.dev/>
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
bash $GITHUB_ACTION_PATH/src/postprocessor/checks.sh && \
24+
bash $GITHUB_ACTION_PATH/src/postprocessor/prepare_deployment.sh && \
25+
bash $GITHUB_ACTION_PATH/src/postprocessor/create_api_endpoints.sh && \
26+
bash $GITHUB_ACTION_PATH/src/postprocessor/modify_deployment.sh && \
27+
bash $GITHUB_ACTION_PATH/src/postprocessor/override_deployment.sh && \
28+
bash $GITHUB_ACTION_PATH/src/postprocessor/build_map.sh

src/build_map.sh renamed to src/postprocessor/build_map.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ echo "" > deploy/api/build-manifest.txt
4848
echo "[" > deploy/api/_just_build-manifest
4949
echo "" > deploy/api/_just_build-manifest.txt
5050

51-
echo "$(cat $GITHUB_ACTION_PATH/src/buildManifest_start.js)" > deploy/_just/static/$BUILD_ID/buildManifest.js
52-
echo "$(cat $GITHUB_ACTION_PATH/src/_justManifest_start.js)" > deploy/_just/static/$BUILD_ID/_justManifest.js
53-
echo "$(cat $GITHUB_ACTION_PATH/src/insert/clearCache.js)" > deploy/_just/static/chunks/$clearCache_name.js
51+
echo "$(cat $GITHUB_ACTION_PATH/src/postprocessor/insert/buildManifest_start.js)" > deploy/_just/static/$BUILD_ID/buildManifest.js
52+
echo "$(cat $GITHUB_ACTION_PATH/src/postprocessor/insert/_justManifest_start.js)" > deploy/_just/static/$BUILD_ID/_justManifest.js
53+
echo "$(cat $GITHUB_ACTION_PATH/src/postprocessor/insert/clearCache.js)" > deploy/_just/static/chunks/$clearCache_name.js
5454
find _just_data -mindepth 1 -print | while read -r path; do
5555
relative_path=${path#_just_data/}
5656
first_line=$(head -n 1 "$path")
@@ -64,7 +64,6 @@ find _just_data -mindepth 1 -print | while read -r path; do
6464
fi
6565
done
6666

67-
# Convert bytes to human-readable format
6867
function human_readable_size {
6968
local size=$1
7069
if [ "$size" -ge 1073741824 ]; then
@@ -135,7 +134,6 @@ find deploy -mindepth 1 -print | while read -r path; do
135134
file_size=$(stat -c%s "$path")
136135
TOTAL_SIZE=$((TOTAL_SIZE + $file_size))
137136

138-
# Output formatting
139137
if [ "$FILE_ID" -eq 1 ]; then
140138
printf "┌ %s | %s\n" "$(human_readable_size $file_size)" "$relative_path"
141139
elif [ "$FILE_ID" -eq "$TOTAL_FILES" ]; then
@@ -144,7 +142,6 @@ find deploy -mindepth 1 -print | while read -r path; do
144142
printf "├ %s | %s\n" "$(human_readable_size $file_size)" "$relative_path"
145143
fi
146144

147-
# Build manifest entry
148145
if [[ "$first_line" != "// _just hide" ||
149146
"$first_line" != "// _just doNotModify+hide" ]]; then
150147
buildManifestJSONString="{\"type\": \"$type\", \"path\": \"$relative_path\", \"size\": {\"bytes\": $file_size, \"string\": \"$(human_readable_size $file_size)\"}}"
@@ -162,10 +159,9 @@ echo -e "End Build Map\n\n"
162159
echo -e "_just/static/$BUILD_ID/buildManifest.js size: $(human_readable_size $manifest_size)\n"
163160
echo -e " Total build size: $(human_readable_size $TOTAL_SIZE)\n\n"
164161
echo -e "----------------\n"
165-
echo "$(cat $GITHUB_ACTION_PATH/src/buildManifest_end.js)" >> deploy/_just/static/$BUILD_ID/buildManifest.js
166-
echo "$(cat $GITHUB_ACTION_PATH/src/_justManifest_end.js)" >> deploy/_just/static/$BUILD_ID/_justManifest.js
162+
echo "$(cat $GITHUB_ACTION_PATH/src/postprocessor/insert/buildManifest_end.js)" >> deploy/_just/static/$BUILD_ID/buildManifest.js
163+
echo "$(cat $GITHUB_ACTION_PATH/src/postprocessor/insert/_justManifest_end.js)" >> deploy/_just/static/$BUILD_ID/_justManifest.js
167164

168-
# Override Pages
169165
for html_file in deploy/*.html; do
170166
sed -i.bak '/^[[:space:]]*<\/body>[[:space:]]*$/d' "$html_file"
171167
sed -i.bak '/^[[:space:]]*<\/html>[[:space:]]*$/d' "$html_file"
@@ -178,7 +174,6 @@ for html_file in deploy/*.html; do
178174
echo "</html>" >> "$html_file"
179175
done
180176

181-
# Add API Endpoints
182177
echo "{}]" >> deploy/api/build-manifest
183178
echo "" >> deploy/api/build-manifest.txt
184179
echo "\"\"]" >> deploy/api/_just_build-manifest
File renamed without changes.

src/create_api_endpoints.sh renamed to src/postprocessor/create_api_endpoints.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
# (fake) API Endpoints
23+
# API Endpoints
2424

25-
# Check
2625
if [ -d "deploy/api" ]; then
2726
echo "Error: Your website have api directory in the root. Please remove it to proceed." >&2
2827
exit 1
2928
fi
3029

3130
mkdir -p deploy/api/
3231

33-
# Get Next.js data and copy it to API Endpoints
3432
BUILD_ID=$(cat .next/BUILD_ID)
3533
echo "$BUILD_ID" > deploy/api/build-id
3634
echo "$BUILD_ID" > deploy/api/build-id.txt

0 commit comments

Comments
 (0)