From 976b73894ec96c99eb9ac3f84f4b2c4f669c3d8d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 09:39:47 +0900 Subject: [PATCH 01/12] chore(deps): Bump pre-commit hook (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/igorshubovych/markdownlint-cli: v0.40.0 → v0.41.0](https://github.com/igorshubovych/markdownlint-cli/compare/v0.40.0...v0.41.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f54f551..24fd093 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: - id: actionlint - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.40.0 + rev: v0.41.0 hooks: - id: markdownlint-fix args: ["--disable", "MD013", "MD023", "MD024", "MD033", "MD036"] From 438d820d04030c4e4b2ad14200c11346903c20d8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:57:10 +0900 Subject: [PATCH 02/12] chore(deps): Bump pre-commit hook (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/crate-ci/typos: v1.21.0 → v1.22.0](https://github.com/crate-ci/typos/compare/v1.21.0...v1.22.0) - [github.com/gitleaks/gitleaks: v8.18.2 → v8.18.3](https://github.com/gitleaks/gitleaks/compare/v8.18.2...v8.18.3) - [github.com/rhysd/actionlint: v1.7.0 → v1.7.1](https://github.com/rhysd/actionlint/compare/v1.7.0...v1.7.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 24fd093..75dd150 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,17 +23,17 @@ repos: args: [--whitespaces-count, "2"] - repo: https://github.com/crate-ci/typos - rev: v1.21.0 + rev: v1.22.0 hooks: - id: typos - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.2 + rev: v8.18.3 hooks: - id: gitleaks - repo: https://github.com/rhysd/actionlint - rev: v1.7.0 + rev: v1.7.1 hooks: - id: actionlint From 4a433307af7a2783373766b8b97c7d554077d200 Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Tue, 4 Jun 2024 21:55:18 +0900 Subject: [PATCH 03/12] chore(deps): Pin Deno dependency versions for Molt (#62) That's because Molt doesn't update specified packages with ambiguous specifies. --- deno.json | 12 ++++++------ deno.lock | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/deno.json b/deno.json index ffd8d17..e401e0d 100644 --- a/deno.json +++ b/deno.json @@ -7,11 +7,11 @@ "test": "deno test --allow-read --allow-write" }, "imports": { - "@libs/xml": "jsr:@libs/xml@^5.0.2", - "@std/assert": "jsr:@std/assert@^0.225.2", - "@std/cli": "jsr:@std/cli@^0.224.2", - "@std/path": "jsr:@std/path@^0.225.1", - "@std/toml": "jsr:@std/toml@^0.224.0", - "@wok/case": "jsr:@wok/case@^1.0.1" + "@libs/xml": "jsr:@libs/xml@5.0.2", + "@std/assert": "jsr:@std/assert@0.225.2", + "@std/cli": "jsr:@std/cli@0.224.2", + "@std/path": "jsr:@std/path@0.225.1", + "@std/toml": "jsr:@std/toml@0.224.0", + "@wok/case": "jsr:@wok/case@1.0.1" } } diff --git a/deno.lock b/deno.lock index 396f130..420f9a4 100644 --- a/deno.lock +++ b/deno.lock @@ -3,14 +3,14 @@ "packages": { "specifiers": { "jsr:@libs/typing@2": "jsr:@libs/typing@2.0.3", - "jsr:@libs/xml@^5.0.2": "jsr:@libs/xml@5.0.2", - "jsr:@std/assert@^0.225.2": "jsr:@std/assert@0.225.2", - "jsr:@std/cli@^0.224.2": "jsr:@std/cli@0.224.2", - "jsr:@std/collections@^0.224.0": "jsr:@std/collections@0.224.2", - "jsr:@std/internal@^0.225.1": "jsr:@std/internal@0.225.1", - "jsr:@std/path@^0.225.1": "jsr:@std/path@0.225.1", - "jsr:@std/toml@^0.224.0": "jsr:@std/toml@0.224.0", - "jsr:@wok/case@^1.0.1": "jsr:@wok/case@1.0.1" + "jsr:@libs/xml@5.0.2": "jsr:@libs/xml@5.0.2", + "jsr:@std/assert@0.225.2": "jsr:@std/assert@0.225.2", + "jsr:@std/cli@0.224.2": "jsr:@std/cli@0.224.2", + "jsr:@std/collections@0.224.0": "jsr:@std/collections@0.224.2", + "jsr:@std/internal@0.225.1": "jsr:@std/internal@0.225.1", + "jsr:@std/path@0.225.1": "jsr:@std/path@0.225.1", + "jsr:@std/toml@0.224.0": "jsr:@std/toml@0.224.0", + "jsr:@wok/case@1.0.1": "jsr:@wok/case@1.0.1" }, "jsr": { "@libs/typing@2.0.3": { @@ -60,12 +60,12 @@ "remote": {}, "workspace": { "dependencies": [ - "jsr:@libs/xml@^5.0.2", - "jsr:@std/assert@^0.225.2", - "jsr:@std/cli@^0.224.2", - "jsr:@std/path@^0.225.1", - "jsr:@std/toml@^0.224.0", - "jsr:@wok/case@^1.0.1" + "jsr:@libs/xml@5.0.2", + "jsr:@std/assert@0.225.2", + "jsr:@std/cli@0.224.2", + "jsr:@std/path@0.225.1", + "jsr:@std/toml@0.224.0", + "jsr:@wok/case@1.0.1" ] } } From f52e4e64a7e41095acce97b182eb176543de00cf Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:09:21 +0900 Subject: [PATCH 04/12] fix(ci): Remove `./` from GitHub Actions workflows (#65) GitHub Actions probably doesn't recognize the syntax. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e090fce..19d081e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,12 +7,12 @@ on: - dev paths: - "**.ts" - - "./deno.lock" + - "deno.lock" - ".github/workflows/test.yml" pull_request: paths: - "**.ts" - - "./deno.lock" + - "deno.lock" - ".github/workflows/test.yml" jobs: From e2f6da0ddf19b495cbfe40c23a288ea87b998225 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:28:22 +0900 Subject: [PATCH 05/12] chore(deps): update dependencies (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - @libs/xml [5.0.2](https://jsr.io/@libs/xml/5.0.2) → [5.4.6](https://jsr.io/@libs/xml/5.4.6) - @std/assert [0.225.2](https://jsr.io/@std/assert/0.225.2) → [0.226.0](https://jsr.io/@std/assert/0.226.0) - @std/cli [0.224.2](https://jsr.io/@std/cli/0.224.2) → [0.224.5](https://jsr.io/@std/cli/0.224.5) - @std/path [0.225.1](https://jsr.io/@std/path/0.225.1) → [0.225.2](https://jsr.io/@std/path/0.225.2) - @std/toml [0.224.0](https://jsr.io/@std/toml/0.224.0) → [0.224.1](https://jsr.io/@std/toml/0.224.1) --- deno.json | 10 ++++----- deno.lock | 67 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/deno.json b/deno.json index e401e0d..1f7f998 100644 --- a/deno.json +++ b/deno.json @@ -7,11 +7,11 @@ "test": "deno test --allow-read --allow-write" }, "imports": { - "@libs/xml": "jsr:@libs/xml@5.0.2", - "@std/assert": "jsr:@std/assert@0.225.2", - "@std/cli": "jsr:@std/cli@0.224.2", - "@std/path": "jsr:@std/path@0.225.1", - "@std/toml": "jsr:@std/toml@0.224.0", + "@libs/xml": "jsr:@libs/xml@5.4.6", + "@std/assert": "jsr:@std/assert@0.226.0", + "@std/cli": "jsr:@std/cli@0.224.5", + "@std/path": "jsr:@std/path@0.225.2", + "@std/toml": "jsr:@std/toml@0.224.1", "@wok/case": "jsr:@wok/case@1.0.1" } } diff --git a/deno.lock b/deno.lock index 420f9a4..cccb9f7 100644 --- a/deno.lock +++ b/deno.lock @@ -2,54 +2,55 @@ "version": "3", "packages": { "specifiers": { - "jsr:@libs/typing@2": "jsr:@libs/typing@2.0.3", - "jsr:@libs/xml@5.0.2": "jsr:@libs/xml@5.0.2", - "jsr:@std/assert@0.225.2": "jsr:@std/assert@0.225.2", - "jsr:@std/cli@0.224.2": "jsr:@std/cli@0.224.2", - "jsr:@std/collections@0.224.0": "jsr:@std/collections@0.224.2", - "jsr:@std/internal@0.225.1": "jsr:@std/internal@0.225.1", - "jsr:@std/path@0.225.1": "jsr:@std/path@0.225.1", - "jsr:@std/toml@0.224.0": "jsr:@std/toml@0.224.0", + "jsr:@libs/typing@2": "jsr:@libs/typing@2.1.1", + "jsr:@libs/xml@5.4.6": "jsr:@libs/xml@5.4.6", + "jsr:@std/assert@0.226.0": "jsr:@std/assert@0.226.0", + "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", + "jsr:@std/cli@0.224.5": "jsr:@std/cli@0.224.5", + "jsr:@std/collections@^1.0.0-rc.1": "jsr:@std/collections@1.0.0-rc.1", + "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.0", + "jsr:@std/path@0.225.2": "jsr:@std/path@0.225.2", + "jsr:@std/toml@0.224.1": "jsr:@std/toml@0.224.1", "jsr:@wok/case@1.0.1": "jsr:@wok/case@1.0.1" }, "jsr": { - "@libs/typing@2.0.3": { - "integrity": "e2fb7b9f4a09ffbe322377e05a16dfd48e04249ed667e4c9c06ca166c48b379e" + "@libs/typing@2.1.1": { + "integrity": "964e61860716140671718b170d8de4a8705e05d86e7ed0c41883fe2687c91c80" }, - "@libs/xml@5.0.2": { - "integrity": "f17bb52752acb83eda027245695508de566ddad816a935a08c3d75df5aed0ff8", + "@libs/xml@5.4.6": { + "integrity": "9148f9d2d88030e766f120c82a43f7382eb29654dd50f9871ae24fdd4d0a60bb", "dependencies": [ "jsr:@libs/typing@2" ] }, - "@std/assert@0.225.2": { - "integrity": "6fd566c3ea01654d29c2b633298b7fc7599716336233852eb87e9843658fa192", + "@std/assert@0.226.0": { + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3", "dependencies": [ - "jsr:@std/internal@^0.225.1" + "jsr:@std/internal@^1.0.0" ] }, - "@std/cli@0.224.2": { - "integrity": "be330ce49928db596338b411037b082d8f8f218b34f8095bcad382fb0c3d6b31", + "@std/cli@0.224.5": { + "integrity": "79f1b02ac18f6c26de3eb33fe6458c02447eaa21b9be1db1b6efb907f02acd7a", "dependencies": [ - "jsr:@std/assert@^0.225.2" + "jsr:@std/assert@^0.226.0" ] }, - "@std/collections@0.224.2": { - "integrity": "e77819455294e92d4e7ddad1dbfd46f94174c09318e541e6621fac4a4d0ab326" + "@std/collections@1.0.0-rc.1": { + "integrity": "e69fa667e4bede8f1013be9fb48915e564707a2b054848ca4a4da1f3f10251d9" }, - "@std/internal@0.225.1": { - "integrity": "7d8a812be88c2792f15ab9cf46911e521ccca50435948a8f24df5cefda96bde9" + "@std/internal@1.0.0": { + "integrity": "ac6a6dfebf838582c4b4f61a6907374e27e05bedb6ce276e0f1608fe84e7cd9a" }, - "@std/path@0.225.1": { - "integrity": "8c3220635a73730eb51fe43de9e10b79e2724a5bb8638b9355d35ae012fd9429", + "@std/path@0.225.2": { + "integrity": "0f2db41d36b50ef048dcb0399aac720a5348638dd3cb5bf80685bf2a745aa506", "dependencies": [ - "jsr:@std/assert@^0.225.2" + "jsr:@std/assert@^0.226.0" ] }, - "@std/toml@0.224.0": { - "integrity": "15a60eb5eac12d8a81a48d99cb1aaed60a21c67dc94c2def696a7c39b815c74f", + "@std/toml@0.224.1": { + "integrity": "c364b9ca3b18207223c4e2a1f652ef2970ff80967f7575ddf89b6b0565a17148", "dependencies": [ - "jsr:@std/collections@^0.224.0" + "jsr:@std/collections@^1.0.0-rc.1" ] }, "@wok/case@1.0.1": { @@ -60,11 +61,11 @@ "remote": {}, "workspace": { "dependencies": [ - "jsr:@libs/xml@5.0.2", - "jsr:@std/assert@0.225.2", - "jsr:@std/cli@0.224.2", - "jsr:@std/path@0.225.1", - "jsr:@std/toml@0.224.0", + "jsr:@libs/xml@5.4.6", + "jsr:@std/assert@0.226.0", + "jsr:@std/cli@0.224.5", + "jsr:@std/path@0.225.2", + "jsr:@std/toml@0.224.1", "jsr:@wok/case@1.0.1" ] } From 0fb8ded09ce9edd96a92c21e2535aa4823ccbc4a Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Tue, 4 Jun 2024 22:45:02 +0900 Subject: [PATCH 06/12] chore(test): Improve test coverage (#67) Now, test coverage becomes 100%, and tests are run more reliably. --- deno.json | 2 +- src/libs/io.ts | 6 +++--- test/libs/io_test.ts | 28 +++++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/deno.json b/deno.json index 1f7f998..217919d 100644 --- a/deno.json +++ b/deno.json @@ -4,7 +4,7 @@ "test": { "include": ["src/", "test/"] }, "tasks": { "gen": "deno run --allow-read --allow-write ./src/main.ts", - "test": "deno test --allow-read --allow-write" + "test": "deno test --allow-read --allow-write --parallel --shuffle" }, "imports": { "@libs/xml": "jsr:@libs/xml@5.4.6", diff --git a/src/libs/io.ts b/src/libs/io.ts index a140509..d468f26 100644 --- a/src/libs/io.ts +++ b/src/libs/io.ts @@ -6,12 +6,12 @@ import { convertToOPML, convertToTOML } from "./mod.ts"; export async function readTOML(file: string): Promise { try { const data: string = await Deno.readTextFile(file); - return await convertToTOML(data); + return convertToTOML(data); } catch (error) { if (error instanceof Deno.errors.NotFound) { - throw Error(`File not found: "${file}"`); + throw new Error(`File not found: "${file}"`); } else if (error instanceof Deno.errors.PermissionDenied) { - throw Error(`Permission denied: "${file}"`); + throw new Error(`Permission denied: "${file}"`); } else throw error; } } diff --git a/test/libs/io_test.ts b/test/libs/io_test.ts index 0db5846..50f7929 100644 --- a/test/libs/io_test.ts +++ b/test/libs/io_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "@std/assert"; +import { assertEquals, assertIsError } from "@std/assert"; import { join } from "@std/path"; import { convertToOPML, @@ -25,6 +25,32 @@ xmlUrl = "https://example.com/feed" assertEquals(convertToTOML(toml), lists); }); +Deno.test("Read TOML (File not found)", async () => { + try { + await readTOML("file-not-found.toml"); + } catch (error) { + assertEquals(error.message, 'File not found: "file-not-found.toml"'); + } +}); + +Deno.test("Read TOML (Permission denied)", async () => { + const file: string = await Deno.makeTempFile({ suffix: ".toml" }); + await Deno.chmod(file, 0o000); + try { + await readTOML(file); + } catch (error) { + assertEquals(error.message, `Permission denied: "${file}"`); + } +}); + +Deno.test("Read TOML (Unexpected error)", async () => { + try { + await readTOML(""); + } catch (error) { + assertIsError(error); + } +}); + Deno.test("Write XML", async () => { const feeds: Lists = { lists: [ From f520f94974ba2b19481b8190c12fd3ea3251614c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:41:49 +0900 Subject: [PATCH 07/12] chore(deps): bump @std/cli to 0.224.6 (#68) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @std/cli 0.224.5 → 0.224.6 --- deno.json | 2 +- deno.lock | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/deno.json b/deno.json index 217919d..82b866f 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,7 @@ "imports": { "@libs/xml": "jsr:@libs/xml@5.4.6", "@std/assert": "jsr:@std/assert@0.226.0", - "@std/cli": "jsr:@std/cli@0.224.5", + "@std/cli": "jsr:@std/cli@0.224.6", "@std/path": "jsr:@std/path@0.225.2", "@std/toml": "jsr:@std/toml@0.224.1", "@wok/case": "jsr:@wok/case@1.0.1" diff --git a/deno.lock b/deno.lock index cccb9f7..016a8f2 100644 --- a/deno.lock +++ b/deno.lock @@ -6,7 +6,7 @@ "jsr:@libs/xml@5.4.6": "jsr:@libs/xml@5.4.6", "jsr:@std/assert@0.226.0": "jsr:@std/assert@0.226.0", "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", - "jsr:@std/cli@0.224.5": "jsr:@std/cli@0.224.5", + "jsr:@std/cli@0.224.6": "jsr:@std/cli@0.224.6", "jsr:@std/collections@^1.0.0-rc.1": "jsr:@std/collections@1.0.0-rc.1", "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.0", "jsr:@std/path@0.225.2": "jsr:@std/path@0.225.2", @@ -29,11 +29,8 @@ "jsr:@std/internal@^1.0.0" ] }, - "@std/cli@0.224.5": { - "integrity": "79f1b02ac18f6c26de3eb33fe6458c02447eaa21b9be1db1b6efb907f02acd7a", - "dependencies": [ - "jsr:@std/assert@^0.226.0" - ] + "@std/cli@0.224.6": { + "integrity": "98d7e17a70c1c24980baa2b9a511b29e0a460e7a3b8e3d4e220979d77d5f348e" }, "@std/collections@1.0.0-rc.1": { "integrity": "e69fa667e4bede8f1013be9fb48915e564707a2b054848ca4a4da1f3f10251d9" @@ -63,7 +60,7 @@ "dependencies": [ "jsr:@libs/xml@5.4.6", "jsr:@std/assert@0.226.0", - "jsr:@std/cli@0.224.5", + "jsr:@std/cli@0.224.6", "jsr:@std/path@0.225.2", "jsr:@std/toml@0.224.1", "jsr:@wok/case@1.0.1" From d01fccecdb3f722074cbacc7780ca4d5332b4c6f Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:55:06 +0900 Subject: [PATCH 08/12] docs(readme): Minor expression changes (#69) To make the README better. --- .github/README.md | 56 +++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/README.md b/.github/README.md index 7da93c4..95c508a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -22,34 +22,48 @@ OPML Generator has 2 ways to convert TOML to OPML. -1. ### 💻 On Local +### 💻 On Local - 1. 📰 Prepare your TOML file (Reference: [feeds.toml](./assets/example/feeds.toml)). +1. Prepare your TOML file (Reference: [feeds.toml](./assets/example/feeds.toml)) - 2. 🦕 Run Deno Task +2. Clone this repository - ```shell - deno task gen - ``` + ```sh + git clone https://github.com/5ouma/opml-generator.git + ``` - 3. 🗞️ Outputs are stored in the `outputs` directory separated by `lists`. +3. Run Deno Task -2. ### 🐙 On GitHub Actions + ```shell + deno task gen + ``` - 1. 🗒️ Create [a Gist](https://gist.github.com): - - includes [`feeds.toml`](./assets/example/feeds.toml). - - for outputs. - 2. 🔑 Create [a Personal Access Token] with the `Gist` permission. - 3. 🍴 [Fork this repository](https://github.com/5ouma/opml-generator/fork) - 4. 🔏 Add Actions secrets - from `Settings > Secrets and variables | Actions` in the sidebar: - - `TOML_GIST_ID`: Gist ID for [`feeds.toml`](./assets/example/feeds.toml) - - `OPML_GIST_ID`: Gist ID for outputs - - `TOKEN`: Personal Access Token - 5. ✅ Enable GitHub Actions by checking `Allow all actions and reusable workflows` - from `Settings > Actions | General` in the sidebar. +4. Outputs are stored in the `outputs` directory separated by `lists` - 🎉 Automatically update every 0 a.m. UTC +
+ +### 🐙 On GitHub Actions + +1. Create [a Gist](https://gist.github.com): + + - includes [`feeds.toml`](./assets/example/feeds.toml) + - for outputs + +2. Create [a Personal Access Token] with the `Gist` permission + +3. [Fork this repository](https://github.com/5ouma/opml-generator/fork) + +4. Add Actions secrets + from `Settings > Secrets and variables | Actions` in the sidebar: + + - `TOML_GIST_ID`: Gist ID for [`feeds.toml`](./assets/example/feeds.toml) + - `OPML_GIST_ID`: Gist ID for outputs + - `TOKEN`: Personal Access Token + +5. Enable GitHub Actions by checking `Allow all actions and reusable workflows` + from `Settings > Actions | General` in the sidebar + +🎉 Automatically update every 0 a.m. UTC [a Personal Access Token]: https://github.com/settings/tokens From eefc96b5f9e0b14faa6dae925c5e9d041c20ccc4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:22:17 +0900 Subject: [PATCH 09/12] chore(deps): bump @libs/xml to 5.4.7 (#71) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - @libs/xml [5.4.6](https://jsr.io/@libs/xml/5.4.6) → [5.4.7](https://jsr.io/@libs/xml/5.4.7) --- deno.json | 2 +- deno.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deno.json b/deno.json index 82b866f..d9b5f65 100644 --- a/deno.json +++ b/deno.json @@ -7,7 +7,7 @@ "test": "deno test --allow-read --allow-write --parallel --shuffle" }, "imports": { - "@libs/xml": "jsr:@libs/xml@5.4.6", + "@libs/xml": "jsr:@libs/xml@5.4.7", "@std/assert": "jsr:@std/assert@0.226.0", "@std/cli": "jsr:@std/cli@0.224.6", "@std/path": "jsr:@std/path@0.225.2", diff --git a/deno.lock b/deno.lock index 016a8f2..c5035fd 100644 --- a/deno.lock +++ b/deno.lock @@ -3,7 +3,7 @@ "packages": { "specifiers": { "jsr:@libs/typing@2": "jsr:@libs/typing@2.1.1", - "jsr:@libs/xml@5.4.6": "jsr:@libs/xml@5.4.6", + "jsr:@libs/xml@5.4.7": "jsr:@libs/xml@5.4.7", "jsr:@std/assert@0.226.0": "jsr:@std/assert@0.226.0", "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", "jsr:@std/cli@0.224.6": "jsr:@std/cli@0.224.6", @@ -17,8 +17,8 @@ "@libs/typing@2.1.1": { "integrity": "964e61860716140671718b170d8de4a8705e05d86e7ed0c41883fe2687c91c80" }, - "@libs/xml@5.4.6": { - "integrity": "9148f9d2d88030e766f120c82a43f7382eb29654dd50f9871ae24fdd4d0a60bb", + "@libs/xml@5.4.7": { + "integrity": "6a5ccb4ae832cbb6947e8cb73eaf41eeb38dabbf68e041252055a2d5233afca7", "dependencies": [ "jsr:@libs/typing@2" ] @@ -58,7 +58,7 @@ "remote": {}, "workspace": { "dependencies": [ - "jsr:@libs/xml@5.4.6", + "jsr:@libs/xml@5.4.7", "jsr:@std/assert@0.226.0", "jsr:@std/cli@0.224.6", "jsr:@std/path@0.225.2", From 225d035305fa4ced6ce7152d93f1ceed05910d99 Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:52:51 +0900 Subject: [PATCH 10/12] ci(test): Run other tests (#72) To clean code and workable. --- .github/workflows/test.yml | 11 ++++++++++- src/libs/convert.ts | 2 +- src/libs/io.ts | 4 ++-- src/libs/mod.ts | 1 - src/main.ts | 2 +- test/libs/convert_test.ts | 4 ++-- test/libs/io_test.ts | 10 +++------- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19d081e..1209870 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,5 +28,14 @@ jobs: with: deno-version: v1.x - - name: 🧪 Test Libraries + - name: 🧪 Run Tests run: deno task test + + - name: 🧹 Lint Check + run: deno lint + + - name: 📝 Format Check + run: deno fmt --check + + - name: 🔍 Type Check + run: deno check ./**/*.ts diff --git a/src/libs/convert.ts b/src/libs/convert.ts index 7f17a13..5b1c98d 100644 --- a/src/libs/convert.ts +++ b/src/libs/convert.ts @@ -1,6 +1,6 @@ import { stringify } from "@libs/xml"; import { parse } from "@std/toml"; -import { Feed, List, Lists, OPMLOutline } from "../types/mod.ts"; +import type { Feed, List, Lists, OPMLOutline } from "../types/mod.ts"; export function convertToTOML(data: string): Lists { const lists: Lists = parse(data) as Lists; diff --git a/src/libs/io.ts b/src/libs/io.ts index d468f26..1edb027 100644 --- a/src/libs/io.ts +++ b/src/libs/io.ts @@ -1,7 +1,7 @@ import { paramCase } from "@wok/case"; import { format } from "@std/path"; -import { List, Lists } from "../types/mod.ts"; -import { convertToOPML, convertToTOML } from "./mod.ts"; +import { convertToOPML, convertToTOML } from "./convert.ts"; +import type { List, Lists } from "../types/mod.ts"; export async function readTOML(file: string): Promise { try { diff --git a/src/libs/mod.ts b/src/libs/mod.ts index 8520d51..82c43f3 100644 --- a/src/libs/mod.ts +++ b/src/libs/mod.ts @@ -1,2 +1 @@ export * from "./io.ts"; -export * from "./convert.ts"; diff --git a/src/main.ts b/src/main.ts index 07bd193..45924e2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ import { parseArgs } from "@std/cli"; import { basename, resolve } from "@std/path"; import { readTOML, writeXML } from "./libs/mod.ts"; -import { Lists } from "./types/mod.ts"; +import type { Lists } from "./types/mod.ts"; const flags = parseArgs(Deno.args, { string: ["feeds", "output"], diff --git a/test/libs/convert_test.ts b/test/libs/convert_test.ts index 4ee5016..423dfcc 100644 --- a/test/libs/convert_test.ts +++ b/test/libs/convert_test.ts @@ -1,6 +1,6 @@ import { assertEquals } from "@std/assert"; -import { convertToOPML, convertToTOML } from "../../src/libs/mod.ts"; -import { List, Lists } from "../../src/types/mod.ts"; +import { convertToOPML, convertToTOML } from "../../src/libs/convert.ts"; +import type { List, Lists } from "../../src/types/mod.ts"; Deno.test("Parse TOML", () => { const feeds: Lists = { diff --git a/test/libs/io_test.ts b/test/libs/io_test.ts index 50f7929..1b69f24 100644 --- a/test/libs/io_test.ts +++ b/test/libs/io_test.ts @@ -1,12 +1,8 @@ import { assertEquals, assertIsError } from "@std/assert"; import { join } from "@std/path"; -import { - convertToOPML, - convertToTOML, - readTOML, - writeXML, -} from "../../src/libs/mod.ts"; -import { Lists } from "../../src/types/toml.ts"; +import { readTOML, writeXML } from "../../src/libs/io.ts"; +import { convertToOPML, convertToTOML } from "../../src/libs/convert.ts"; +import type { Lists } from "../../src/types/mod.ts"; Deno.test("Read TOML", async () => { const toml = ` From 9b573bcfa74967f44ca3862394030b10f90793ef Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Wed, 12 Jun 2024 20:56:35 +0900 Subject: [PATCH 11/12] refactor(opml): Add `text` property to OPML (#73) For Inoreader default config. --- src/libs/convert.ts | 1 + src/types/opml.ts | 1 + src/types/toml.ts | 1 + test/libs/convert_test.ts | 10 ++++++++-- test/libs/io_test.ts | 6 +++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/libs/convert.ts b/src/libs/convert.ts index 5b1c98d..3c59a27 100644 --- a/src/libs/convert.ts +++ b/src/libs/convert.ts @@ -17,6 +17,7 @@ export function convertToOPML(list: List): string { outline: list.feeds.map((feed: Feed): OPMLOutline => { return { "@title": feed.title, + "@text": feed.title, "@xmlUrl": feed.xmlUrl, "@type": "rss", }; diff --git a/src/types/opml.ts b/src/types/opml.ts index a034d69..b1bfc7f 100644 --- a/src/types/opml.ts +++ b/src/types/opml.ts @@ -1,5 +1,6 @@ export type OPMLOutline = { "@title": string; + "@text": string; "@xmlUrl": URL; "@type": "rss"; }; diff --git a/src/types/toml.ts b/src/types/toml.ts index e4aaa75..881c0f4 100644 --- a/src/types/toml.ts +++ b/src/types/toml.ts @@ -7,5 +7,6 @@ export type List = { }; export type Feed = { title: string; + text: string; xmlUrl: URL; }; diff --git a/test/libs/convert_test.ts b/test/libs/convert_test.ts index 423dfcc..4540fb2 100644 --- a/test/libs/convert_test.ts +++ b/test/libs/convert_test.ts @@ -8,7 +8,11 @@ Deno.test("Parse TOML", () => { { name: "list name", feeds: [ - { title: "feed title", xmlUrl: new URL("https://example.com/feed") }, + { + title: "feed title", + text: "feed title", + xmlUrl: new URL("https://example.com/feed"), + }, ], }, ], @@ -20,6 +24,7 @@ name = "list name" [[lists.feeds]] title = "feed title" +text = "feed title" xmlUrl = "https://example.com/feed" `; @@ -31,7 +36,7 @@ Deno.test("Convert Lists to OPML", () => { - + `; @@ -41,6 +46,7 @@ Deno.test("Convert Lists to OPML", () => { feeds: [ { title: "feed title", + text: "feed title", xmlUrl: new URL("https://example.com/feed"), }, ], diff --git a/test/libs/io_test.ts b/test/libs/io_test.ts index 1b69f24..a0ec944 100644 --- a/test/libs/io_test.ts +++ b/test/libs/io_test.ts @@ -53,7 +53,11 @@ Deno.test("Write XML", async () => { { name: "list name", feeds: [ - { title: "feed title", xmlUrl: new URL("https://example.com/feed") }, + { + title: "feed title", + text: "feed title", + xmlUrl: new URL("https://example.com/feed"), + }, ], }, ], From e5ccc4ace77708f34e077dd200c4da0cd44e3066 Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Wed, 12 Jun 2024 21:01:10 +0900 Subject: [PATCH 12/12] ci(test): Visualize code coverage (#74) Upload to Codecov and add comments to PRs. --- .github/CONTRIBUTING.md | 2 +- .github/README.md | 1 + .github/workflows/test.yml | 7 ++++++- .gitignore | 2 ++ deno.json | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9de51d4..07f2fe9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -54,7 +54,7 @@ flowchart LR end feature1 & feature2 & feature3 -- Squash Merge --> dev - dev -- Rebase Merge --> main + dev -- Merge --> main ```
diff --git a/.github/README.md b/.github/README.md index 95c508a..1f688e2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -13,6 +13,7 @@ [![Test](https://img.shields.io/github/actions/workflow/status/5ouma/opml-generator/test.yml?label=test&style=flat-square)](https://github.com/5ouma/opml-generator/actions/workflows/test.yml) [![Gist Update](https://img.shields.io/github/actions/workflow/status/5ouma/opml-generator/gist-update.yml?label=Gist%20Update&style=flat-square)](https://github.com/5ouma/opml-generator/actions/workflows/gist-update.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/5ouma/opml-generator/main.svg?style=flat-square)](https://results.pre-commit.ci/latest/github/5ouma/opml-generator/main) +[![codecov](https://codecov.io/github/5ouma/opml-generator/graph/badge.svg?token=ICJ7C3IDX7)](https://codecov.io/github/5ouma/opml-generator) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1209870..1a6f646 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: deno-version: v1.x - name: 🧪 Run Tests - run: deno task test + run: deno task cov - name: 🧹 Lint Check run: deno lint @@ -39,3 +39,8 @@ jobs: - name: 🔍 Type Check run: deno check ./**/*.ts + + - name: ☂️ Upload Coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f06f34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/coverage +/coverage.lcov diff --git a/deno.json b/deno.json index d9b5f65..6a6f354 100644 --- a/deno.json +++ b/deno.json @@ -4,7 +4,8 @@ "test": { "include": ["src/", "test/"] }, "tasks": { "gen": "deno run --allow-read --allow-write ./src/main.ts", - "test": "deno test --allow-read --allow-write --parallel --shuffle" + "test": "deno test --allow-read --allow-write --parallel --shuffle", + "cov": "deno task test --coverage && deno coverage --lcov > coverage.lcov" }, "imports": { "@libs/xml": "jsr:@libs/xml@5.4.7",