Skip to content

Commit

Permalink
ci: add test checking and docs website
Browse files Browse the repository at this point in the history
  • Loading branch information
SrIzan10 committed Dec 1, 2024
1 parent 4431a0e commit 2b79289
Show file tree
Hide file tree
Showing 6 changed files with 832 additions and 531 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Typedoc to Github Pages

on:
push:
branches:
- main

jobs:
publish:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- uses: actions/setup-node@v2
with:
node-version: '21'
cache: 'npm'

- uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GITHUB_TOKEN }}'

- run: corepack enable yarn
- run: yarn install --prefer-offline

- name: Configure Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Create or switch to typedoc branch
run: |
git checkout typedoc || git checkout -b typedoc
git pull origin typedoc || true
- name: Merge main into typedoc
run: |
git merge origin/main --allow-unrelated-histories -X theirs
- name: Generate Typedoc
run: |
yarn typedoc:gen
curl -O https://gist.githubusercontent.com/j0nl1/7f9b5210c9e6ecbabe322baa16dcb5db/raw/760de77327bf83671cfb6bd4e64181299ba26113/typedoc-fix-cf.mjs
node typedoc-fix-cf.mjs docs
- name: Commit and push changes
run: |
git add .
git diff --staged --quiet || git commit -m "Update typedoc to commit $(git rev-parse --short HEAD)"
git push origin typedoc
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn ci:test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

A zero-dependency (for the forseen future hopefully), typescript-ready, fast, lightweight and, of course, shrimple package to localize your projects.

[docs](https://shrimple.js.org/locales/)

# Getting started

First get your locale files going. A json file is enough:
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest --disable-console-intercept",
"format": "prettier --write ."
"ci:test": "vitest --disable-console-intercept --coverage",
"format": "prettier --write .",
"typedoc:gen": "yarn typedoc:fetchCatppuccin ; typedoc --customCss ./cpnmocha.css --out docs src ; rm ./cpnmocha.css",
"typedoc:fetchCatppuccin": "curl -o ./cpnmocha.css https://gist.githubusercontent.com/SrIzan10/c7d1f0a588f17a8245ff922e6c43118c/raw/498c727033324d175dc2bb14db3032f4de4f9f0b/cpnmocha.css"
},
"exports": {
".": {
Expand All @@ -29,11 +32,13 @@
"package.json"
],
"devDependencies": {
"@vitest/coverage-v8": "^2.1.6",
"prettier": "3.4.1",
"shrimple-locales": "^0.2.0",
"tsup": "^8.0.1",
"typedoc": "^0.27.2",
"typescript": "^5.3.3",
"vitest": "^1.6.0"
"vitest": "^2.1.6"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
9 changes: 9 additions & 0 deletions vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
coverage: {
reporter: ['text'],
},
},
})
Loading

0 comments on commit 2b79289

Please sign in to comment.