Skip to content

Commit 679f91b

Browse files
authored
Merge pull request #22 from soranoo/improve-dx
chore: switch to vitest
2 parents b5e1c2d + a5601f0 commit 679f91b

21 files changed

Lines changed: 10624 additions & 3021 deletions

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [soranoo] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: Lint, Format, and Test
22

33
# Controls when the workflow will run
44
on:
@@ -28,6 +28,14 @@ jobs:
2828
run: npm install
2929

3030
# Runs test using the runners shell
31+
- name: Lint
32+
run: npm run lint
33+
34+
- name: Format
35+
run: npm run fmt
36+
3137
- name: Test
3238
run: npm run test
39+
40+
3341

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- beta
8+
pull_request:
9+
branches:
10+
- main
11+
- beta
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write # to be able to publish a GitHub release
18+
issues: write # to be able to comment on released issues
19+
pull-requests: write # to be able to comment on released pull requests
20+
id-token: write # to enable use of OIDC for npm provenance
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Install dependencies
26+
run: npm install
27+
28+
- name: Build NPM package
29+
run: npm run build
30+
31+
- name: Edit First Release Version
32+
run: sed -i 's/\( FIRST_RELEASE\) = "1.0.0"/\1 = "1.0.14"/' node_modules/semantic-release/lib/definitions/constants.js
33+
34+
- name: Create Release
35+
if: github.event_name == 'push'
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: npm run semantic-release
40+
41+
- name: Dry Run Release
42+
if: github.event_name == 'pull_request'
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
run: npm run semantic-release --dry-run

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules
22
coverage
3-
.vscode
43
.env
54
.dccache
65
dist

.vscode/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc][css][graphql]": {
4+
"editor.defaultFormatter": "biomejs.biome"
5+
},
6+
"typescript.tsdk": "node_modules/typescript/lib",
7+
"editor.formatOnSave": true,
8+
"editor.formatOnPaste": false,
9+
"emmet.showExpandedAbbreviation": "never",
10+
"editor.codeActionsOnSave": {
11+
"source.fixAll.biome": "explicit",
12+
"source.organizeImports.biome": "explicit"
13+
}
14+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ const Page = () => {
302302

303303
Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please fork the repository and submit a pull request.
304304

305-
Before you open a pull request, please make sure that you run `npm run dev:test` to make sure the code run as expected.
305+
Before you open a pull request, please make sure that you run `npm run dev` to make sure the code run as expected.
306+
307+
We are following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages.
306308

307309
## 📝 License
308310

bin/cli.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
22

3+
import { promises as fs } from "node:fs";
4+
import path from "node:path";
35
import envLoader from "@next/env";
4-
import { promises as fs } from "fs";
5-
import path from "path";
66
import { isPublisherId } from "../dist/utils.js";
77

88
const publicPath = path.join(process.cwd(), "public");
@@ -19,7 +19,7 @@ const createAdsTxt = async () => {
1919
if (isPublisherId(env.NEXT_PUBLIC_ADSENSE_PUBLISHER_ID)) {
2020
try {
2121
await fs.access(publicPath);
22-
} catch (err) {
22+
} catch (_err) {
2323
console.log(`📁 [next-google-adsense] Creating "public" folder...`);
2424
await fs.mkdir(publicPath);
2525
}
@@ -28,12 +28,12 @@ const createAdsTxt = async () => {
2828

2929
console.log(`✅ [next-google-adsense] Generation completed: ${adsTxtPath}`);
3030
console.log(
31-
`✨ [next-google-adsense] You can access it at: http://<hostname>/ads.txt`
31+
`✨ [next-google-adsense] You can access it at: http://<hostname>/ads.txt`,
3232
);
3333
}
3434

3535
console.error(
36-
`❌ [next-google-adsense] Invalid Google AdSense Publisher ID: ${env.NEXT_PUBLIC_ADSENSE_PUBLISHER_ID}`
36+
`❌ [next-google-adsense] Invalid Google AdSense Publisher ID: ${env.NEXT_PUBLIC_ADSENSE_PUBLISHER_ID}`,
3737
);
3838
};
3939

biome.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": true,
10+
"includes": ["**", "!dist"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"lineWidth": 80,
16+
"indentWidth": 2,
17+
"lineEnding": "lf"
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true,
23+
24+
"complexity": {
25+
"noUselessTypeConstraint": "error",
26+
"useLiteralKeys": "error",
27+
"useOptionalChain": "error",
28+
"noForEach": "off"
29+
},
30+
"correctness": {
31+
"noUnusedVariables": "info"
32+
},
33+
"style": {
34+
"noInferrableTypes": "error",
35+
"noNamespace": "error",
36+
"useAsConstAssertion": "error",
37+
"useBlockStatements": "error",
38+
"useConsistentArrayType": "error",
39+
"useForOf": "error",
40+
"useShorthandFunctionType": "error",
41+
"useImportType": "error"
42+
},
43+
"suspicious": {
44+
"noDebugger": "info",
45+
"noEmptyBlockStatements": "error",
46+
"noExplicitAny": "error",
47+
"noExtraNonNullAssertion": "error",
48+
"noMisleadingInstantiator": "error",
49+
"noUnsafeDeclarationMerging": "error",
50+
"useAwait": "warn",
51+
"useNamespaceKeyword": "error"
52+
}
53+
}
54+
},
55+
"javascript": {
56+
"formatter": {
57+
"quoteStyle": "double",
58+
"semicolons": "always",
59+
"trailingCommas": "all"
60+
}
61+
}
62+
}

jest.config.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

jest.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)