diff --git a/.github/images/logo.svg b/.github/images/logo.svg
index 8e0d8de..ae3c55c 100644
--- a/.github/images/logo.svg
+++ b/.github/images/logo.svg
@@ -12,4 +12,4 @@
-
\ No newline at end of file
+
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..aaa48c8
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,44 @@
+default_install_hook_types:
+ - pre-commit
+ - pre-push
+ - commit-msg
+default_stages:
+ - pre-commit
+ - pre-push
+repos:
+ - hooks:
+ - id: check-hooks-apply
+ - id: check-useless-excludes
+ repo: meta
+ - hooks:
+ - args:
+ - --allow-multiple-documents
+ id: check-yaml
+ types: ["yaml"]
+ - id: check-merge-conflict
+ - id: check-added-large-files
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ - hooks:
+ - id: yamllint
+ args: [--strict, -c=.yamllint]
+ exclude: "(.github|tests|.woodpecker|pnpm-lock.yaml)/.*"
+ repo: https://github.com/adrienverge/yamllint.git
+ rev: v1.37.1
+ - hooks:
+ - id: validate-eslint
+ repo: https://github.com/jordanopensource/pre-commit-hooks
+ rev: v0.4.5
+ - hooks:
+ - id: gitleaks
+ name: detect hardcoded secrets
+ repo: https://github.com/zricethezav/gitleaks
+ rev: v8.26.0
+ - hooks:
+ - id: commitizen
+ stages:
+ - commit-msg
+ repo: https://github.com/commitizen-tools/commitizen
+ rev: v4.7.1
diff --git a/.woodpecker/build-latest-image.yaml b/.woodpecker/build-latest-image.yaml
index bb24e91..7fb8c4d 100644
--- a/.woodpecker/build-latest-image.yaml
+++ b/.woodpecker/build-latest-image.yaml
@@ -5,28 +5,10 @@ when:
- event: [pull_request]
# Only run when PR targets development or other branches (not main)
evaluate: 'CI_COMMIT_TARGET_BRANCH != "main"'
- # Build the source branch
- branch:
- exclude: [main]
- - event: [pull_request]
- # Also build latest image when development branch creates PR to main
- evaluate: 'CI_COMMIT_TARGET_BRANCH == "main" && CI_COMMIT_BRANCH == "development"'
- branch: [development]
variables:
- &docker_repo "josaorg/contributions-web"
- &slack_channel "builds"
- # Docker build arguments template
- - &build_args_template
- CI_COMMIT_SHA: ${CI_COMMIT_SHA}
- CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}
- CI_BUILD_LINK: ${CI_BUILD_LINK}
- CI_COMMIT_LINK: ${CI_COMMIT_LINK}
- CI_REPO_LINK: ${CI_REPO_LINK}
- CI_BUILD_FINISHED: ${CI_BUILD_FINISHED}
- CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
- MATOMO_SITE_ID: "11"
- TARGET_ENV: production
# Success message template
- &success_message >
✅ *SUCCESS* - Latest Build #{{ build.number }}
@@ -52,10 +34,11 @@ variables:
steps:
# Security check - scan for secrets/credentials
- - name: check-for-leaks
- image: zricethezav/gitleaks:v8.18.4
- commands:
- - gitleaks detect --source . --verbose
+ - name: run-pre-commit-hooks
+ image: josaorg/pre-commit-runner
+ settings:
+ args: "--all-files"
+ skip: "end-of-file-fixer, yamllint"
# Build latest image (development and other branches)
- name: build-latest-image
@@ -71,13 +54,20 @@ steps:
password:
from_secret: DOCKER_HUB_PASSWORD
build_args:
- {
- CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80,
- MATOMO_SITE_ID: "11",
- TARGET_ENV: production,
- }
+ CI_REPO: "${CI_REPO}"
+ CI_REPO_NAME: "${CI_REPO_NAME}"
+ CI_REPO_URL: "${CI_REPO_URL}"
+ CI_COMMIT_SHA: "${CI_COMMIT_SHA}"
+ CI_COMMIT_REF: "${CI_COMMIT_REF}"
+ CI_PIPELINE_URL: "${CI_PIPELINE_URL}"
+ CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}"
+ CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}"
+ CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}"
+ CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
+ MATOMO_SITE_ID: "11"
+ TARGET_ENV: production
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
# Slack notification for latest build success
- name: notify-slack-latest-success
@@ -90,7 +80,7 @@ steps:
when:
- status: success
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
- build-latest-image
# Slack notification for latest build failure
@@ -104,5 +94,5 @@ steps:
when:
- status: failure
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
- build-latest-image
diff --git a/.woodpecker/build-stable-image.yaml b/.woodpecker/build-stable-image.yaml
index a65f8a0..84c6ece 100644
--- a/.woodpecker/build-stable-image.yaml
+++ b/.woodpecker/build-stable-image.yaml
@@ -11,14 +11,6 @@ when:
variables:
- &docker_repo "josaorg/contributions-web"
- &slack_channel "builds"
- # Docker build arguments template
- - &build_args_template
- CI_COMMIT_SHA: ${CI_COMMIT_SHA}
- CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}
- CI_BUILD_LINK: ${CI_BUILD_LINK}
- CI_COMMIT_LINK: ${CI_COMMIT_LINK}
- CI_REPO_LINK: ${CI_REPO_LINK}
- CI_BUILD_FINISHED: ${CI_BUILD_FINISHED}
# Success message template
- &success_message >
✅ *SUCCESS* - Stable Build #{{ build.number }}
@@ -43,11 +35,11 @@ variables:
• <{{ build.link }}|View Build>
steps:
- # Security check - scan for secrets/credentials
- - name: check-for-leaks
- image: zricethezav/gitleaks:v8.18.4
- commands:
- - gitleaks detect --source . --verbose
+ - name: run-pre-commit-hooks
+ image: josaorg/pre-commit-runner
+ settings:
+ args: "--all-files"
+ skip: "end-of-file-fixer, yamllint"
# Build stable image (main branch only)
- name: build-stable-image
@@ -63,13 +55,20 @@ steps:
password:
from_secret: DOCKER_HUB_PASSWORD
build_args:
- {
- CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80,
- MATOMO_SITE_ID: "11",
- TARGET_ENV: production,
- }
+ CI_REPO: "${CI_REPO}"
+ CI_REPO_NAME: "${CI_REPO_NAME}"
+ CI_REPO_URL: "${CI_REPO_URL}"
+ CI_COMMIT_SHA: "${CI_COMMIT_SHA}"
+ CI_COMMIT_REF: "${CI_COMMIT_REF}"
+ CI_PIPELINE_URL: "${CI_PIPELINE_URL}"
+ CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}"
+ CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}"
+ CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}"
+ CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
+ MATOMO_SITE_ID: "11"
+ TARGET_ENV: production
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
# Slack notification for stable build success
- name: notify-slack-stable-success
@@ -82,7 +81,7 @@ steps:
when:
- status: success
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
- build-stable-image
# Slack notification for stable build failure
@@ -96,5 +95,5 @@ steps:
when:
- status: failure
depends_on:
- - check-for-leaks
+ - run-pre-commit-hooks
- build-stable-image
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bf5fe6c..c6473bb 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,9 +6,9 @@ To ensure a smooth and collaborative process, please take a moment to review thi
## Code or Documentation Contributions
1. [Fork this repository](https://github.com/jordanopensource/contributions-web/fork).
-2. Clone the forked repository to your local machine with this command:
+2. Clone the forked repository to your local machine with this command:
`git clone https://github.com//contributions-web.git`
-3. Switch to `development` branch with this command: `git checkout development`.
+3. Switch to `development` branch with this command: `git checkout development`.
**If your contribution is a documentation, jump to step 7 below**.
4. (**_You can ignore this step if you're using docker compose_**) Create a `.env` file and copy the content of [`.env.sample`](https://github.com/jordanopensource/contributions-web/blob/development/.env.sample) file into it,
then add the value(s) of environment variable(s).
@@ -16,18 +16,18 @@ You can use the current running API URL as the value to `CONTRIBUTIONS_API_URL`
`CONTRIBUTIONS_API_URL=https://contributions.api.prod.josa.ngo/`
5. [Run the project locally](https://github.com/jordanopensource/contributions-web/blob/main/CONTRIBUTING.md#running-the-project-locally).
-6. Check current [issues](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest),
-and if you're a beginner, you can [filter issues with `good first issues` label](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest+label%3A%22good+first+issue%22).
-If you decide to work on one of the issue, write a comment on the issue asking to be assigned to it.
+6. Check current [issues](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest),
+and if you're a beginner, you can [filter issues with `good first issues` label](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest+label%3A%22good+first+issue%22).
+If you decide to work on one of the issue, write a comment on the issue asking to be assigned to it.
_Do not work on issues that you're not assigned to in order to avoid duplicate work_.
-7. Create a new branch from `development` branch for the task that you want to work on:
- `git checkout -b /branch-title`
+7. Create a new branch from `development` branch for the task that you want to work on:
+ `git checkout -b /branch-title`
- ``: The prefix should be one of the following:
- `feat` for new features
- `fix` for bug fixes
- `task` for other general tasks
- `docs` for documentation
- - `branch-title` should be short and concise and written in kebab-case (separate each word with '-')
+ - `branch-title` should be short and concise and written in kebab-case (separate each word with '-')
**Example**:
```sh
git checkout development && git pull # pull the latest changes from development branch
@@ -35,7 +35,7 @@ _Do not work on issues that you're not assigned to in order to avoid duplicate w
git checkout -b fix/type # create new branch
```
-8. Write descriptive and concise commit messages
+8. Write descriptive and concise commit messages
Follow these guidelines when writing commit messages:
- Limit the first line of the commit message to 72 characters or less.
- Use the imperative mood and present tense in the subject line, e.g. "Fix typo in the homepage" instead of "Fixed typo...".
@@ -48,7 +48,7 @@ _Do not work on issues that you're not assigned to in order to avoid duplicate w
#### Using Docker
Make sure that [docker](https://docs.docker.com/engine/install/) is installed on your system
-and then run the project locally using [docker compose](https://github.com/jordanopensource/contributions-web/blob/development/docker-compose.yaml) with this command:
+and then run the project locally using [docker compose](https://github.com/jordanopensource/contributions-web/blob/development/docker-compose.yaml) with this command:
`docker compose up`.
#### Using Node:
diff --git a/Dockerfile b/Dockerfile
index e88352e..5da8272 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-ARG CONTRIBUTIONS_API_URL=https://contributions.api.dev.josa.ngo HOST=0.0.0.0 PORT=3000 USER=node MATOMO_SITE_ID=11 TARGET_ENV DRONE_COMMIT_SHA=${DRONE_COMMIT_SHA} DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG='false'
+ARG CONTRIBUTIONS_API_URL=https://contributions.api.dev.josa.ngo HOST=0.0.0.0 PORT=3000 USER=node MATOMO_SITE_ID=11 TARGET_ENV CI_REPO CI_REPO_NAME CI_REPO_URL CI_COMMIT_SHA CI_COMMIT_REF CI_PIPELINE_URL CI_PIPELINE_CREATED CI_PREV_PIPELINE_URL CI_PIPELINE_NUMBER DEBUG='false'
###########
# BUILDER #
@@ -10,12 +10,14 @@ ARG HOST
ARG PORT
ARG MATOMO_SITE_ID
ARG TARGET_ENV
-ARG DRONE_COMMIT_SHA
-ARG DRONE_BUILD_NUMBER
-ARG DRONE_BUILD_LINK
-ARG DRONE_COMMIT_LINK
-ARG DRONE_REPO_LINK
-ARG DRONE_BUILD_FINISHED
+ARG CI_REPO
+ARG CI_REPO_NAME
+ARG CI_REPO_URL
+ARG CI_COMMIT_SHA
+ARG CI_COMMIT_REF
+ARG CI_PIPELINE_URL
+ARG CI_PIPELINE_CREATED
+ARG CI_PIPELINE_NUMBER
ARG DEBUG
# copy build context and install dependencies
@@ -24,7 +26,7 @@ COPY . .
RUN npm install
# Inject the enviromental variables
-ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} DRONE_COMMIT_SHA=$DRONE_COMMIT_SHA DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG=${DEBUG}
+ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} NUXT_PUBLIC_CI_BUILD_NUMBER=${CI_PIPELINE_NUMBER} NUXT_PUBLIC_CI_BUILD_LINK=${CI_PIPELINE_URL} NUXT_PUBLIC_BUILD_REPO_LINK=${CI_REPO_URL} NUXT_PUBLIC_CI_COMMIT_SHA=${CI_COMMIT_SHA} NUXT_PUBLIC_CI_COMMIT_LINK=${CI_COMMIT_REF} NUXT_PUBLIC_BUILD_TIMESTAMP=${CI_PIPELINE_CREATED} DEBUG=${DEBUG}
# build NuxtJS project
RUN npm run build:modern
@@ -40,12 +42,14 @@ ARG PORT
ARG USER
ARG MATOMO_SITE_ID
ARG TARGET_ENV
-ARG DRONE_COMMIT_SHA
-ARG DRONE_BUILD_NUMBER
-ARG DRONE_BUILD_LINK
-ARG DRONE_COMMIT_LINK
-ARG DRONE_REPO_LINK
-ARG DRONE_BUILD_FINISHED
+ARG CI_REPO
+ARG CI_REPO_NAME
+ARG CI_REPO_URL
+ARG CI_COMMIT_SHA
+ARG CI_COMMIT_REF
+ARG CI_PIPELINE_URL
+ARG CI_PIPELINE_CREATED
+ARG CI_PIPELINE_NUMBER
ARG DEBUG
# copy builder output to project workdir
@@ -56,7 +60,7 @@ COPY --from=builder --chown=${USER}:${USER} /workspace/node_modules /app/node_mo
COPY --from=builder --chown=${USER}:${USER} /workspace/package.json /app/
# Inject the enviromental variables
-ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} DRONE_COMMIT_SHA=$DRONE_COMMIT_SHA DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG=${DEBUG}
+ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} NUXT_PUBLIC_CI_BUILD_NUMBER=${CI_PIPELINE_NUMBER} NUXT_PUBLIC_CI_BUILD_LINK=${CI_PIPELINE_URL} NUXT_PUBLIC_BUILD_REPO_LINK=${CI_REPO_URL} NUXT_PUBLIC_CI_COMMIT_SHA=${CI_COMMIT_SHA} NUXT_PUBLIC_CI_COMMIT_LINK=${CI_COMMIT_REF} NUXT_PUBLIC_BUILD_TIMESTAMP=${CI_PIPELINE_CREATED} DEBUG=${DEBUG}
# set user context
USER ${USER}
diff --git a/assets/images/hero/jordan-commits.svg b/assets/images/hero/jordan-commits.svg
index 44248f2..f116d71 100644
--- a/assets/images/hero/jordan-commits.svg
+++ b/assets/images/hero/jordan-commits.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/assets/images/navbar/bars-solid.svg b/assets/images/navbar/bars-solid.svg
index 4288986..30fe665 100644
--- a/assets/images/navbar/bars-solid.svg
+++ b/assets/images/navbar/bars-solid.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/assets/images/navbar/x-circle.svg b/assets/images/navbar/x-circle.svg
index 0cde8fe..ca04a37 100644
--- a/assets/images/navbar/x-circle.svg
+++ b/assets/images/navbar/x-circle.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docker-compose.yaml b/docker-compose.yaml
index 32c4997..b464f02 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -43,4 +43,3 @@ services:
networks:
contributions-network:
driver: bridge
-