From bdf04e9a5f996eae375f6bb7a560c6e632a97f34 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Fri, 8 Mar 2024 08:59:01 +0800 Subject: [PATCH] ci: use yamlModule --- eslint.config.js | 5 ++--- scripts/modules/octokit.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index a81ff902..ca13bfd0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,5 @@ -import fs from "node:fs"; import path from "node:path"; -import YAML from "yaml"; +import yamlModule from "./scripts/modules/yamlModule.js"; import { configs } from "@annangela/eslint-config"; import readDir from "./scripts/modules/readDir.js"; @@ -17,7 +16,7 @@ const ignores = [ const srcESlintrcFiles = (await readDir("./src")).filter((n) => path.basename(n) === ".eslintrc.yaml"); for (const srcESlintrcFile of srcESlintrcFiles) { const dir = path.dirname(srcESlintrcFile); - const srcESlintrc = YAML.parse(await fs.promises.readFile(srcESlintrcFile, { encoding: "utf-8" })); + const srcESlintrc = await yamlModule.readFile(srcESlintrcFile); if (Array.isArray(srcESlintrc.ignorePatterns)) { for (const ignorePattern of srcESlintrc.ignorePatterns) { ignores.push(path.join(dir, ignorePattern)); diff --git a/scripts/modules/octokit.js b/scripts/modules/octokit.js index 08db2561..3d8f88a6 100644 --- a/scripts/modules/octokit.js +++ b/scripts/modules/octokit.js @@ -1,7 +1,6 @@ import console from "../modules/console.js"; -import fs from "fs"; -import yaml from "yaml"; -const { assignees } = yaml.parse(await fs.promises.readFile(".github/auto_assign.yaml", { encoding: "utf-8" })); +import yamlModule from "../modules/yamlModule.js"; +const { assignees } = await yamlModule.readFile(".github/auto_assign.yaml"); import { startGroup, endGroup } from "@actions/core"; import { Octokit } from "@octokit/rest"; import { retry } from "@octokit/plugin-retry";