Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix husky #95

Open
wants to merge 12 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion .github/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config: KnipConfig = {
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**", "eslint.config.mjs"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data"],
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data", "husky"],
eslint: true,
};

Expand Down
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!---
<!---
Insert the issue number of the task you are completing if within this repository, or paste the url of the task.

// EXAMPLE
Expand All @@ -9,7 +9,7 @@ Resolves #

<!---
We advise that you give a brief description of your changes, either that it meets
the specification exactly as described or what you had to do outwith the spec to resolve it.
the specification exactly as described or what you had to do outwith the spec to resolve it.
This is not required but again, it is advised.

// EXAMPLE
Expand Down Expand Up @@ -48,4 +48,5 @@ Example: https://github.com/ubiquity/pay.ubq.fi/pull/226#issue-2290493538
-->

How to QA and setup:

- ...
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ jobs:
with:
node-version: 20.10.0

- name: Set up bun
uses: oven-sh/setup-bun@v2

- name: Build
run: |
yarn
yarn build
bun install
bun run build

- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
with:
node-version: "20.10.0"

- name: Set up bun
uses: oven-sh/setup-bun@v2

- name: Install cspell
run: yarn add cspell
run: bun add cspell

- name: Run cspell
run: yarn format:cspell
run: bun run format:cspell
12 changes: 9 additions & 3 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ jobs:
node-version: 20.10.0
- name: Checkout
uses: actions/checkout@v4

- name: Set up bun
uses: oven-sh/setup-bun@v2

- name: Cypress run
uses: cypress-io/github-action@v6
with:
install-command: yarn install
build: yarn run build
start: yarn start
install-command: bun install
build: bun run build
start: bun start
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore

- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ jobs:
with:
node-version: "20.10.0"

- name: Set up bun
uses: oven-sh/setup-bun@v2

- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Jest With Coverage
run: yarn install --immutable --immutable-cache --check-cache && yarn test
run: bun install --immutable --immutable-cache --check-cache && bun run test

- name: Add Jest Report to Summary
if: always()
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# needed to use yarn v4
- name: Enable corepack
run: corepack enable
- name: Set up bun
uses: oven-sh/setup-bun@v2

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Install toolchain
run: yarn install
run: bun install

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn knip --reporter json > knip-results.json
run: bun knip || bun knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/no-empty-strings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Set up bun
uses: oven-sh/setup-bun@v2
- name: Get GitHub App token
if: ${{ env.APP_ID && env.APP_PRIVATE_KEY }}
uses: tibdex/[email protected]
Expand All @@ -25,10 +27,10 @@ jobs:
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
- name: Install Dependencies
run: |
yarn add tsx simple-git
bun add simple-git
- name: Check for Empty Strings
run: |
yarn tsx .github/empty-string-checker.ts
bun .github/empty-string-checker.ts
env:
GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token || secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
Expand Down
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "$1"
bun commitlint --edit "$1"
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
bun lint-staged
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ This template repository includes support for the following:
To test with Cypress Studio UI, run

```shell
yarn cy:open
bun cy:open
```

Otherwise, to simply run the tests through the console, run

```shell
yarn cy:run
bun cy:run
```

### Jest

To start Jest tests, run

```shell
yarn test
bun run test
```

## Sync any repository to latest `ts-template`
Expand Down
Loading