Skip to content

Commit

Permalink
Upgrade setup (#199)
Browse files Browse the repository at this point in the history
- Use Bun as test runner
- Use Biome as formatter and linter
- Use typedoc to generate reference docs
- Upgrade dev dependencies
- Remove dependencies
  • Loading branch information
sergiodxa authored Aug 5, 2024
1 parent e8f933e commit 108af97
Show file tree
Hide file tree
Showing 25 changed files with 601 additions and 293 deletions.
54 changes: 0 additions & 54 deletions .eslintrc.cjs

This file was deleted.

20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
reviewers:
- "sergiodxa"
assignees:
- "sergiodxa"

- package-ecosystem: npm
directory: /
schedule:
interval: "weekly"
reviewers:
- "sergiodxa"
assignees:
- "sergiodxa"
30 changes: 18 additions & 12 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
changelog:
categories:
- title: Documentation Changes
labels:
- documentation
- title: New Features
labels:
- enhancement
- title: Bug Fixes
labels:
- bug
- title: Other Changes
labels:
- "*"
- title: New Features
labels:
- enhancement
- title: Documentation Changes
labels:
- documentation
- title: Bug Fixes
labels:
- bug
- title: Example
labels:
- example
- title: Deprecations
labels:
- deprecated
- title: Other Changes
labels:
- "*"
7 changes: 4 additions & 3 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
version:
description: "Semver type of new version (major / minor / patch)"
description: "Type of version to bump"
required: true
type: choice
options:
Expand All @@ -21,8 +21,8 @@ jobs:
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}

- uses: oven-sh/setup-bun@v1
- run: bun install
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile

- uses: actions/setup-node@v4
with:
Expand All @@ -33,4 +33,5 @@ jobs:
git config user.email '[email protected]'
- run: npm version ${{ github.event.inputs.version }}
- run: bun run quality:fix
- run: git push origin main --follow-tags
48 changes: 22 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
name: CI

on:
pull_request:
push:
branches:
- main
on: [push]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build

exports:
name: Verify Exports
typecheck:
name: Typechecker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run test:exports
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run typecheck

typecheck:
name: Typechecker
quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run typecheck
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run quality

test:
name: Unit and Integration Tests
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run test
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun test

lint:
name: Linter
exports:
name: Verify Exports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run lint
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run exports
24 changes: 24 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Enable auto-merge for Dependabot PRs

on:
pull_request:
types: opened

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33 changes: 33 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy Documentation

on:
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "docs"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bunx typedoc
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: "./docs"
- uses: actions/deploy-pages@v4
id: deployment
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:

jobs:
publish-npm:
name: Publish to npm
name: "Publish to npm"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run test:exports
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run exports

- uses: actions/setup-node@v4
with:
Expand Down
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

## Setup

Run `npm install` to install the dependencies.
Run `bun install` to install the dependencies.

Run the tests with `npm run test`.
Run the tests with `bun test`.

Run the linter with `npm run lint`.
Run the code quality checker with `bun run quality`.

Run the typechecker with `npm run typecheck`.
Run the typechecker with `bun run typecheck`.

## Create a Backend

Follow the steps on the [Create a Backend](https://github.com/sergiodxa/remix-i18next#custom-backend) documentation. Create your new backend inside the folder [`src/backends`](https://github.com/sergiodxa/remix-i18next/tree/main/src/backends) and re-export it from the `index.ts` file.
Run the exports checker with `bun run exports`.
44 changes: 44 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"useHookAtTopLevel": "error"
},
"performance": {
"noBarrelFile": "error",
"noReExportAll": "error"
},
"style": {
"noDefaultExport": "error",
"noNegationElse": "error",
"useConst": "off",
"useExportType": "off",
"useImportType": "off"
},
"suspicious": {
"noConsoleLog": "warn",
"noEmptyBlockStatements": "warn",
"noSkippedTests": "error"
}
}
},
"formatter": { "enabled": true },
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
},
"overrides": [
{
"include": ["**/*.md"],
"formatter": { "indentStyle": "tab" }
}
]
}
Binary file modified bun.lockb
Binary file not shown.
Loading

0 comments on commit 108af97

Please sign in to comment.