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

chore: use jsr std libraries #93

Merged
merged 5 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 0 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: docker
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: npm
directory: "/"
schedule:
interval: "daily"
15 changes: 4 additions & 11 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,10 @@ jobs:
with:
deno-version: v1.x

- name: Verify formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: Run tests
run: deno test -A --coverage=coverage

- name: Create coverage report
run: deno coverage ./coverage --lcov > coverage.lcov
- run: deno fmt --check
- run: deno lint
- run: deno test -A --coverage=coverage
- run: deno coverage ./coverage --lcov > coverage.lcov

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Dependabot auto merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4 changes: 2 additions & 2 deletions __tests__/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import { assertExists } from "$std/testing/asserts.ts";
import { afterEach, beforeAll, describe, it } from "@std/testing/bdd";
import { assertExists } from "@std/testing/asserts";
import { cleanup, render, setup } from "$fresh-testing-library/components.ts";
import { Footer } from "@/components/Footer.tsx";

Expand Down
4 changes: 2 additions & 2 deletions __tests__/Header.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import { assertExists } from "$std/testing/asserts.ts";
import { afterEach, beforeAll, describe, it } from "@std/testing/bdd";
import { assertExists } from "@std/testing/asserts";
import { cleanup, render, setup } from "$fresh-testing-library/components.ts";
import { Header } from "@/components/Header.tsx";

Expand Down
4 changes: 2 additions & 2 deletions __tests__/SEO.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import { assertExists } from "$std/testing/asserts.ts";
import { afterEach, beforeAll, describe, it } from "@std/testing/bdd";
import { assertExists } from "@std/testing/asserts";
import { cleanup, render, setup } from "$fresh-testing-library/components.ts";
import { SEO } from "@/components/SEO.tsx";

Expand Down
4 changes: 2 additions & 2 deletions __tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import { assertExists } from "$std/testing/asserts.ts";
import { afterEach, beforeAll, describe, it } from "@std/testing/bdd";
import { assertExists } from "@std/testing/asserts";
import { cleanup, render, setup } from "$fresh-testing-library/components.ts";
import { PostCard } from "@/routes/index.tsx";

Expand Down
12 changes: 6 additions & 6 deletions __tests__/islands/SearchButton.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from "$std/testing/asserts.ts";
import { assert } from "@std/testing/asserts";
import { cleanup, render, setup } from "$fresh-testing-library/components.ts";
import { fn } from "$fresh-testing-library/expect.ts";
import { afterEach, beforeAll, describe, it } from "$std/testing/bdd.ts";
import { afterEach, beforeAll, describe, it } from "@std/testing/bdd";
import SearchButton from "../../islands/SearchButton.tsx";
import docsearch from "https://esm.sh/@docsearch/js@3?target=es2020";

Expand All @@ -13,10 +13,10 @@
// create mock implementation of docsearch
// @ts-ignore mock impl
const dsearch = fn(docsearch).mockImplementation((
applId: string,
apiKey: string,
indexName: string,
container: HTMLElement | string,
_applId: string,

Check notice on line 16 in __tests__/islands/SearchButton.test.tsx

View check run for this annotation

codefactor.io / CodeFactor

__tests__/islands/SearchButton.test.tsx#L16

'_applId' is defined but never used. (@typescript-eslint/no-unused-vars)
_apiKey: string,

Check notice on line 17 in __tests__/islands/SearchButton.test.tsx

View check run for this annotation

codefactor.io / CodeFactor

__tests__/islands/SearchButton.test.tsx#L17

'_apiKey' is defined but never used. (@typescript-eslint/no-unused-vars)
_indexName: string,

Check notice on line 18 in __tests__/islands/SearchButton.test.tsx

View check run for this annotation

codefactor.io / CodeFactor

__tests__/islands/SearchButton.test.tsx#L18

'_indexName' is defined but never used. (@typescript-eslint/no-unused-vars)
_container: HTMLElement | string,

Check notice on line 19 in __tests__/islands/SearchButton.test.tsx

View check run for this annotation

codefactor.io / CodeFactor

__tests__/islands/SearchButton.test.tsx#L19

'_container' is defined but never used. (@typescript-eslint/no-unused-vars)
) => {});
const { getByTitle } = render(
<SearchButton class="font-bold" docsearch={dsearch} />,
Expand Down
2 changes: 1 addition & 1 deletion components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import IconActivity from "https://deno.land/x/[email protected]/tsx/activit
export function Header({ title }: { title: string }) {
const menus = [
{ name: <IconRss />, href: "/rss.xml" },
{ name: <IconActivity />, href: "https://9renpoto.github.io/upptime/" },
{ name: <IconActivity />, href: "https://status.9renpoto.win" },
{ name: <>About me</>, href: "/about" },
];
return (
Expand Down
40 changes: 27 additions & 13 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,39 @@
"lint": "deno run -A npm:textlint",
"preview": "deno run -A main.ts"
},
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
"lock": false,
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"imports": {
"$fresh-testing-library/": "https://deno.land/x/[email protected]/",
"$fresh/": "https://deno.land/x/[email protected]/",
"$fresh_seo": "https://deno.land/x/[email protected]/mod.ts",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
"./": "./",
"@/": "./",
"@deno/gfm": "jsr:@deno/gfm@^0.8.2",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"@std/front-matter": "jsr:@std/front-matter@^0.224.3",
"@std/path": "jsr:@std/path@^1.0.0",
"@std/testing": "jsr:@std/testing@^0.225.3",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"tailwindcss": "npm:[email protected]",
"tailwindcss/": "npm:[email protected]/",
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
"$fresh-testing-library/": "https://deno.land/x/[email protected]/",
"$std/": "https://deno.land/[email protected]/",
"@/": "./",
"./": "./",
"$gfm": "https://deno.land/x/[email protected]/mod.ts",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts"
"tailwindcss/plugin": "npm:/[email protected]/plugin.js"
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
"exclude": ["**/_fresh/*", "cache"]
"exclude": [
"**/_fresh/*",
"cache"
]
}
Loading