From d470cc88b6de461ac2ee45b43d365a9e02cd14cf Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 3 Dec 2026 22:56:48 +0800 Subject: [PATCH] refactor(build): share Cursor plugin metadata reads (#16382) --- scripts/lib/cursor-plugin-bundle.mjs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/lib/cursor-plugin-bundle.mjs b/scripts/lib/cursor-plugin-bundle.mjs index d215a079913..8cefec74931 100644 --- a/scripts/lib/cursor-plugin-bundle.mjs +++ b/scripts/lib/cursor-plugin-bundle.mjs @@ -164,13 +164,11 @@ export const syncCursorPluginSkill = async ({ root, check }) => { /** Read the committed plugin and report structured contract issues. */ export const inspectCursorPluginBundle = async (root) => { - const manifest = JSON.parse( - await readFile(join(root, CURSOR_PLUGIN_MANIFEST), "utf8"), - ); - const mcp = JSON.parse(await readFile(join(root, CURSOR_PLUGIN_MCP), "utf8")); - const packageJson = JSON.parse( - await readFile(join(root, "package.json"), "utf8"), - ); + const readJson = async (relativePath) => + JSON.parse(await readFile(join(root, relativePath), "utf8")); + const manifest = await readJson(CURSOR_PLUGIN_MANIFEST); + const mcp = await readJson(CURSOR_PLUGIN_MCP); + const packageJson = await readJson("package.json"); const logoExists = await stat(join(root, CURSOR_PLUGIN_LOGO)) .then((metadata) => metadata.isFile()) .catch((cause) => {