From 4cddbc1ffa4ae854d16ec31645ea3bd8ca2f2174 Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:46:00 -0300 Subject: [PATCH 1/6] refactor: Convert `SDK's` section into single file --- SDK's/index.md => SDK's.md | 8 +++++--- SDK's/index.yaml | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) rename SDK's/index.md => SDK's.md (83%) delete mode 100644 SDK's/index.yaml diff --git a/SDK's/index.md b/SDK's.md similarity index 83% rename from SDK's/index.md rename to SDK's.md index 5cf38d1..83d9999 100644 --- a/SDK's/index.md +++ b/SDK's.md @@ -1,3 +1,8 @@ +--- +icon: code +order: 2 +--- + # SDK's A Software Development Kit (SDK) is a set of tools provided by the manufacturer of (usually) a hardware platform, operating system (OS), or programming language. [\[\*\]](https://www.redhat.com/en/topics/cloud-native-apps/what-is-SDK) @@ -8,6 +13,3 @@ A Software Development Kit (SDK) is a set of tools provided by the manufacturer [1]: {{git_home}}/js-sdk [2]: https://www.npmjs.com/package/@hawapi/js-sdk - - - diff --git a/SDK's/index.yaml b/SDK's/index.yaml deleted file mode 100644 index 6f598f1..0000000 --- a/SDK's/index.yaml +++ /dev/null @@ -1,2 +0,0 @@ -icon: code -order: 2 From 50760e881be3dc29b78ce7d8d8a1ce5294f63308 Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:46:23 -0300 Subject: [PATCH 2/6] refactor: Update tiles grid --- index.md | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/index.md b/index.md index 6a2661f..ec25f52 100644 --- a/index.md +++ b/index.md @@ -42,19 +42,18 @@ All this information is available through a RESTful API implemented with [_Java From d428fe8da30ebffae1b7e0cd5fcd5e349072b5c0 Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:46:54 -0300 Subject: [PATCH 3/6] ci: Add build workflow --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d056ac4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +# Only build after new tag. +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + + - name: Setup Node with yarn caching + uses: actions/setup-node@v3 + with: + node-version: "18" + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Build Retype and replace colors + run: yarn build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build + publish_branch: release + enable_jekyll: false + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" From 2fd9f16d8ea24a752a7bddf0eb1d2bf45daf9efd Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:47:30 -0300 Subject: [PATCH 4/6] feat: Add `hawbrary` to header and Update title --- retype.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/retype.yml b/retype.yml index b5b362e..a7ae265 100644 --- a/retype.yml +++ b/retype.yml @@ -10,7 +10,7 @@ branding: background: "#0f0f0f" text: "#ffffff" meta: - title: " | HawAPI" + title: " | HawAPI - A Stranger Things API - Docs" links: - text: Home link: https://hawapi.theproject.id @@ -28,6 +28,10 @@ links: link: https://github.com/HawAPI/feedback/discussions icon: comment-discussion target: blank + - text: Hawbrary + link: https://hawbrary.theproject.id/ + icon: book + target: blank footer: copyright: "© Copyright {{ year }}. All rights reserved." links: @@ -42,7 +46,7 @@ footer: - text: Licenses link: /about/#licenses edit: - repo: "https://github.com/HawAPI/docs/" + repo: "https://github.com/HawAPI/website/" branch: main data: api_version: v1 From eb9d472f47efb013cc17795b84b9e847b2872801 Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:48:06 -0300 Subject: [PATCH 5/6] build: Remove scripts and Bump retype version --- package.json | 7 ++- scripts/build-docs.sh | 65 --------------------------- scripts/clean.sh | 21 --------- scripts/get-sdks.sh | 85 ------------------------------------ scripts/js/update-colors.mjs | 8 +++- 5 files changed, 9 insertions(+), 177 deletions(-) delete mode 100755 scripts/build-docs.sh delete mode 100755 scripts/clean.sh delete mode 100755 scripts/get-sdks.sh diff --git a/package.json b/package.json index 9339ab3..fa4bee1 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "scripts": { - "build": "./scripts/build-docs.sh", + "build": "retype build && node scripts/js/update-colors.mjs", "watch": "retype start", "dev": "retype start", - "get-sdks": "./scripts/get-sdks.sh", - "clean": "./scripts/clean.sh" + "clean": "rm -rf ./build" }, "devDependencies": { - "retypeapp": "^3.1.0" + "retypeapp": "^3.5.0" } } diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh deleted file mode 100755 index 3ca3110..0000000 --- a/scripts/build-docs.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -red=$(tput setaf 1) -green=$(tput setaf 2) -blue=$(tput setaf 4) -cyan=$(tput setaf 6) - -git_raw=https://raw.githubusercontent.com -readme_path=/main/README.md -repositories=( - https://github.com/HawAPI/js-sdk - https://github.com/HawAPI/java-sdk -) - -clean_before=true -skip_sdks=false - -# Check args -for arg in "$@" -do - case $arg in - "-S"|"--skip-sdks") - skip_sdks=true - ;; - "-B"|"--clean-before") - clean_before=false - ;; - "--help") - echo "${blue}Usage: ${green}$0 [option...]" >&2 - echo - echo " ${cyan}-S, --skip-sdks ${green}Skip download of 'sdks'" - echo " ${cyan}-B, --clean-before ${green}Remove 'build/' before build" - echo " ${cyan}-D, --clean-downloads ${green}Remove '.downloads/' before build" - echo - exit 0 - ;; - esac -done - -echo -echo "${blue}Script: ${green}$0" -echo - -## Install requisites -yarn install -yarn add retypeapp --dev - -# Clean - -## Remove 'build/' before build -if $clean_before; then - echo "${cyan}[$0] ${green}Removing 'build/' folder..." - rm -rf build/ -fi - -## Get 'sdks' -if ! $skip_sdks; then - ./scripts/get-sdks.sh --clean-downloads -fi - -# Build -yarn retype build - -# Update website colors -node scripts/js/update-colors.mjs \ No newline at end of file diff --git a/scripts/clean.sh b/scripts/clean.sh deleted file mode 100755 index aebfe8f..0000000 --- a/scripts/clean.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -echo -echo "${blue}Script: ${green}$0" -echo - -rm -rf .downloads/ -rm -rf build/ - -## Move 'index.md' and 'index.yaml' to a tmp directory -mkdir tmp/ -mv SDK\'s/index.md tmp/ -mv SDK\'s/index.yaml tmp/ - -## Remove 'SDK's' and all files. -rm -rf SDK\'s/* - -## Move all files from tmp to 'SDK's' -mv tmp/* SDK\'s/ - -rm -rf tmp/ \ No newline at end of file diff --git a/scripts/get-sdks.sh b/scripts/get-sdks.sh deleted file mode 100755 index 79d28df..0000000 --- a/scripts/get-sdks.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash - -red=$(tput setaf 1) -green=$(tput setaf 2) -blue=$(tput setaf 4) -cyan=$(tput setaf 6) - -git_raw=https://raw.githubusercontent.com -readme_path=/main/README.md -repositories=( - /HawAPI/js-sdk -) - -clean_downloads=false - -# Check args -for arg in "$@" -do - case $arg in - "-D"|"--clean-downloads") - clean_downloads=true - ;; - "--help") - echo "${blue}Usage: ${green}$0 [option...]" >&2 - echo - echo " ${cyan}-D, --clean-downloads ${green}Remove '.downloads/' before build" - echo - exit 0 - ;; - esac -done - -echo -echo "${blue}Script: ${green}$0" -echo - -# Clean - -## Remove '.downloads/' before build -if $clean_downloads; then - echo "${cyan}[$0] ${green}Removing '.downloads/' folder..." - rm -rf .downloads/ -fi - -# Setup - -## Check if '.downloads/' already exist. If not, download all readme files. -if [ -d ".downloads/" ]; then - ## - echo "${cyan}[$0] ${red}Found '.downloads/' directory!" - echo "${cyan}[$0] ${green}Remove current '.downloads/' files? (Y/n)" - read -n1 -s -r yarn_response - - if ! echo "$yarn_response" | grep '^[Yy]\?$'; then - exit 0 - fi - - rm -rf .downloads/ -fi - -## Download all readme files. -echo "${cyan}[$0] ${green}Directory '.downloads/' not found!" -echo -mkdir -p .downloads/ - -for repo in "${repositories[@]}"; do - echo "${cyan}[$0] ${green}Downloading: '$git_raw$repo$readme_path'..." - wget "$git_raw$repo$readme_path" -q --show-progress -O ".downloads/${repo##*/}.md" -done - -## Delete empty files. -## -## Downloading from a 'not found file' returns a empty. -for file in $(find .downloads/ -type f -name '*.md' -empty); -do - if [[ ! -s $file ]]; then - rm -rf $file; - fi; -done - -## Copy all files inside '.downloads/' to 'SDK's/' -for file in .downloads/*.md; do - echo "${cyan}[$0] ${green}Copying: '$file' to 'SDK's/'..." - cp --remove-destination "$file" "SDK's/${file##*/}" -done \ No newline at end of file diff --git a/scripts/js/update-colors.mjs b/scripts/js/update-colors.mjs index 135b323..1acb284 100644 --- a/scripts/js/update-colors.mjs +++ b/scripts/js/update-colors.mjs @@ -5,6 +5,8 @@ import * as fs from "fs"; main(); async function main() { + console.log("[update-colors] Updating colors..."); + const json = fs.readFileSync("./_assets/colors.json", { encoding: "utf8", flag: "r", @@ -12,13 +14,15 @@ async function main() { const colors = new Map(Object.entries(JSON.parse(json))); fs.readFile("./build/resources/css/retype.css", "utf-8", (err, data) => { - if (err) return console.log(err); + if (err) return console.error(err); let result = data; colors.forEach((value, key) => (result = result.replaceAll(key, value))); fs.writeFile("./build/resources/css/retype.css", result, "utf8", (err) => { - if (err) return console.log(err); + if (err) return console.error(err); }); }); + + console.log("[update-colors] Updated colors!"); } From e90a7b8a1658266fbeb84c0d52b140690f537aae Mon Sep 17 00:00:00 2001 From: Lucas Josino Date: Tue, 19 Sep 2023 21:51:19 -0300 Subject: [PATCH 6/6] fix: Wrong edit url --- retype.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retype.yml b/retype.yml index a7ae265..f5777eb 100644 --- a/retype.yml +++ b/retype.yml @@ -46,7 +46,7 @@ footer: - text: Licenses link: /about/#licenses edit: - repo: "https://github.com/HawAPI/website/" + repo: "https://github.com/HawAPI/docs/" branch: main data: api_version: v1