Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ compile: clean ## Compile the spring application
@./mvnw compile

build: clean ## Build website, test and package the spring application
@./scripts/build-website.sh --clean-before
@./scripts/get-website.sh --clean-before
@./mvnw javadoc:javadoc
@./mvnw package --file pom.xml

build-wot: clean ## Build website without test and package the spring application
@./scripts/build-website.sh --clean-before
@./scripts/get-website.sh --clean-before
@./mvnw javadoc:javadoc
@./mvnw package --file pom.xml -Dmaven.test.skip=true -DskipTests

Expand All @@ -64,7 +64,7 @@ clean: ## Clear the spring application
## Website

website-build: ## Build the website
@./scripts/build-website.sh --clean-before
@./scripts/get-website.sh --clean-before

website-clean: ## Remove '.hawapi/' and 'resources/static/'
@./scripts/clean-website.sh --clean-hawapi --clean-static
Expand Down
23 changes: 9 additions & 14 deletions docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@
│   ├── init
│   └── migration
├── docs
├── logs
├── scripts
└── src
├── main
│   ├── java
│   │   └── com
│   │   └── lucasjosino
│   │   └── hawapi
│   │   ├── cache
│   │   │   └── generator
│   │   ├── configs
│   │   │   └── security
│   │   ├── controllers
Expand Down Expand Up @@ -71,6 +68,7 @@
│   │   ├── repositories
│   │   │   ├── auth
│   │   │   ├── base
│   │   │   │   └── impl
│   │   │   ├── specification
│   │   │   └── translation
│   │   ├── resolvers
Expand Down Expand Up @@ -115,9 +113,6 @@
- Terminal (with bash) for [Scripts](../scripts)
- Docker for [Database](../docker/docker-compose.yml)
- Java 8 (1.8) for [Application](../src/main/java/com/lucasjosino/hawapi/HawAPIApplication.java)
- Npm/Yarn
- [Astro (v2.X.X)](https://astro.build/) for [website](https://github.com/HawAPI/website) generation
- [Retype (v3.X.X)](https://retype.com/) for [docs](https://github.com/HawAPI/docs) generation

The HawAPI project build **WILL NOT** run when:

Expand Down Expand Up @@ -180,7 +175,7 @@ git clone https://github.com/HawAPI/HawAPI.git

> **Warning** \
> The application will not run if the database is not active. \
> Check out the [#Docker](#docker) section before.
> Check out the [#Docker](#docker) section before continue.

#### Dev/Test Profiles

Expand Down Expand Up @@ -215,19 +210,19 @@ To use the values on a production mode set these arguments before running the ja
- Command

```
./scripts/build-website.sh --clean-before
./scripts/get-website.sh --clean-before
```

- Makefile

```
make build-website
make get-website
```

> To see all options
>
>```
>./scripts/build-website.sh --help
>./scripts/get-website.sh --help
>```

### Application
Expand All @@ -249,7 +244,7 @@ make run
- Command

```
curl localhost:8080/api/ping
curl http://localhost:8080/api/ping
```

The result should be:
Expand Down Expand Up @@ -283,7 +278,7 @@ By default, two RSA keys (public/private) are located at:
- /src/main/resources/keys/publicRSAKey.pem

> **Warning** \
> Don't se this keys on production mode. **See below**
> Don't use this keys on production mode. **See below**

#### Prod (Production) Profile

Expand Down Expand Up @@ -406,11 +401,11 @@ Targets:
#### Build Website

```
./scripts/build-website.sh --help
./scripts/get-website.sh --help
```

```
Usage: ./scripts/build-website.sh [option...]
Usage: ./scripts/get-website.sh [option...]

-B, --clean-before Remove '.hawapi/' directory before building the website
-H, --clean-hawapi Remove '.hawapi/' directory
Expand Down
17 changes: 9 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.14</version>
<version>2.7.17</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -15,17 +15,17 @@

<name>HawAPI</name>
<description>A Free and Open Source API for Stranger Things.</description>
<url>https://hawapi.theproject.id</url>
<version>1.1.0</version>
<inceptionYear>2022</inceptionYear>
<url>https://hawapi.theproject.id/</url>
<version>1.2.0</version>
<inceptionYear>2023</inceptionYear>

<properties>
<java.version>1.8</java.version>
</properties>

<licenses>
<license>
<name>BSD 3-Clause "New" or "Revised" License</name>
<name>MIT License</name>
<url>https://github.com/HawAPI/HawAPI/blob/main/LICENSE</url>
</license>
</licenses>
Expand Down Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>5.7.5</version>
<version>5.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -138,7 +138,7 @@
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>com.github.java-json-tools</groupId>
Expand All @@ -161,7 +161,7 @@
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.20.0</version>
<version>2.21.1</version>
</dependency>

<!-- Database/Postgres -->
Expand Down Expand Up @@ -213,6 +213,7 @@
<nonFilteredFileExtensions>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>gz</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
Expand Down
65 changes: 21 additions & 44 deletions scripts/build-website.sh → scripts/get-website-sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
org_name="HawAPI"
website_repository="website"
docs_repository="docs"
website_zip="https://github.com/${org_name}/${website_repository}/archive/refs/heads/main.zip"
docs_zip="https://github.com/${org_name}/${docs_repository}/archive/refs/heads/main.zip"
website_zip="https://github.com/${org_name}/${website_repository}/archive/refs/heads/release.zip"
docs_zip="https://github.com/${org_name}/${docs_repository}/archive/refs/heads/release.zip"

red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
Expand All @@ -27,7 +26,7 @@ do
then
echo "${blue}Usage: ${green}$0 [option...]" >&2
echo
echo " ${cyan}-B, --clean-before ${green}Remove '.hawapi/' directory before building the website"
echo " ${cyan}-B, --clean-before ${green}Remove '.hawapi/' directory before download the website"
echo " ${cyan}-H, --clean-hawapi ${green}Remove '.hawapi/' directory"
echo " ${cyan}-D, --clean-downloads ${green}Remove '.downloads/' directory"
echo " ${cyan}-S, --clean-static ${green}Remove 'resources/static/' directory"
Expand All @@ -41,9 +40,9 @@ done

## Remove '.hawapi/' before building website
if $clean_before; then
echo "${cyan}[$0] ${green}Removing '.hawapi/' folder..."
echo "$PWD"
echo "${cyan}[$0] ${green}Removing '.hawapi/' and 'src/main/resources/static/' folders..."
rm -rf .hawapi/
rm -rf src/main/resources/static/
fi

# Check location
Expand All @@ -58,22 +57,9 @@ fi
echo
echo "${blue}Script: ${green}$0"
echo
echo "${cyan}[$0] ${green}See all requisites: https://github.com/HawAPI/HawAPI/blob/main/GETTING-STARTED.md#prerequisites"
echo "${cyan}[$0] ${green}Checking prerequisites for building website..."
echo

# Check all requisites

if ! type yarn; then
## Yarn is required. Ask to install (LOCALLY)
echo "${cyan}[$0] ${red}<Yarn> command not found!"
echo "${cyan}[$0] ${green}Install yarn to build the website"
exit 1
fi

echo
echo "${cyan}[$0] ${green}All requisites found!"

## Check if '.hawapi/website' already exist. If not, create it.
if ! [ -d ".hawapi/website" ]; then
echo "${cyan}[$0] ${green}Directory '.hawapi/website' not found!"
Expand All @@ -82,38 +68,28 @@ if ! [ -d ".hawapi/website" ]; then
if ! [ -d ".downloads/" ]; then
echo "${cyan}[$0] ${green}Directory '.downloads/' not found!"
mkdir -p .downloads/
wget ${website_zip} -O "./.downloads/${website_repository}-main.zip" -q --show-progress
wget ${website_zip} -O "./.downloads/${website_repository}-release.zip" -q --show-progress
echo "${cyan}[$0] Downloading '${org_name}/${website_repository}' from Github..."
wget ${docs_zip} -O "./.downloads/${docs_repository}-main.zip" -q --show-progress
wget ${docs_zip} -O "./.downloads/${docs_repository}-release.zip" -q --show-progress
echo "${cyan}[$0] Downloading '${org_name}/${docs_repository}' from Github..."
fi

echo "${cyan}[$0] ${green}Extracting files into '.hawapi/website'..."
mkdir -p .hawapi/website
unzip -q .downloads/${website_repository}-main.zip -d .hawapi/website/
unzip -q .downloads/${docs_repository}-main.zip -d .hawapi/docs/
mv .hawapi/website/${website_repository}-main/* .hawapi/website/
mv .hawapi/docs/${docs_repository}-main/* .hawapi/website/docs/
rm -rf .hawapi/website/${website_repository}-main/
unzip -q .downloads/${website_repository}-release.zip -d .hawapi/website/
unzip -q .downloads/${docs_repository}-release.zip -d .hawapi/docs/
mv .hawapi/website/${website_repository}-release/* .hawapi/website/
mkdir .hawapi/website/docs/
mv .hawapi/docs/${docs_repository}-release/* .hawapi/website/docs/
rm -rf .hawapi/website/${website_repository}-release/
rm -rf .hawapi/docs/
fi

echo "${cyan}[$0] ${green}Building the website..."
cd .hawapi/website/ || exit 1

## Yarn install into website and docs
cd ./docs && yarn install
cd ../ && yarn install

## Build website and docs
echo
yarn build:all
echo

# Finalization
# Fix wrong 404 location. This will follow the spring boot error path requirement
mv .hawapi/website/error/404/index.html .hawapi/website/error/404.html
rm -rf .hawapi/website/error/404/
fi

## Spring root
cd ../../
# Copy website files into 'static' folder

if [ -d "./src/main/resources/static/" ]; then
echo "${cyan}[$0] ${green}Found files inside 'resources/static/'! Deleting all..."
Expand All @@ -124,8 +100,9 @@ if ! [ -d "./src/main/resources/static/" ]; then
mkdir -p ./src/main/resources/static/
fi

echo "${cyan}[$0] ${green}Moving files from '.hawapi/website/build/' to 'resources/static/'"
mv .hawapi/website/build/* ./src/main/resources/static/
echo "${cyan}[$0] ${green}Moving files from '.hawapi/website/' to 'resources/static/'"
mv .hawapi/website/* ./src/main/resources/static/
rm -rf .hawapi/website

# Clean

Expand Down
40 changes: 0 additions & 40 deletions src/main/java/com/lucasjosino/hawapi/configs/CacheConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public ResponseEntity<List<OverviewTranslationDTO>> findAllOverviewTranslations(
public ResponseEntity<OverviewDTO> findOverview(String language) {
language = defaultIfEmpty(language, responseUtils.getDefaultLanguage());

return ResponseEntity.ok(overviewService.findOverviewBy(language));
HttpHeaders headers = responseUtils.getHeaders(language);
return ResponseEntity.ok().headers(headers).body(overviewService.findOverviewBy(language));
}

/**
Expand Down
Loading