Skip to content

Commit

Permalink
chore: use jsr std libraries (#93)
Browse files Browse the repository at this point in the history
* chore: use jsr std libraries

* feat: add lockfile

* chore: excape unused variables

* chore: use @std/testing

* chore: add dependabot auto-approve
  • Loading branch information
9renpoto authored Jul 13, 2024
1 parent 3d3fca9 commit 590072a
Show file tree
Hide file tree
Showing 14 changed files with 4,022 additions and 55 deletions.
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 @@ describe("islands/SearchButton.tsx", () => {
// 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,
_apiKey: string,
_indexName: string,
_container: HTMLElement | string,
) => {});
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/tabler_icons_tsx@0.0.5/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/fresh_testing_library@0.12.0/",
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
"$fresh_seo": "https://deno.land/x/fresh_seo@1.0.1/mod.ts",
"preact": "https://esm.sh/preact@10.19.6",
"preact/": "https://esm.sh/preact@10.19.6/",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
"./": "./",
"@/": "./",
"@deno/gfm": "jsr:@deno/gfm@^0.8.2",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
"@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/preact@10.19.6",
"preact/": "https://esm.sh/preact@10.19.6/",
"tailwindcss": "npm:tailwindcss@3.4.1",
"tailwindcss/": "npm:tailwindcss@3.4.1/",
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
"$fresh-testing-library/": "https://deno.land/x/fresh_testing_library@0.12.0/",
"$std/": "https://deno.land/std@0.192.0/",
"@/": "./",
"./": "./",
"$gfm": "https://deno.land/x/gfm@0.3.0/mod.ts",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts"
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js"
},
"lint": {
"rules": {
"tags": [
"fresh",
"recommended"
]
}
},
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
"exclude": ["**/_fresh/*", "cache"]
"exclude": [
"**/_fresh/*",
"cache"
]
}
Loading

0 comments on commit 590072a

Please sign in to comment.