From 042e187dfa583641deed06dc00178cc9f02b17af Mon Sep 17 00:00:00 2001 From: ncqwer <1732031236@qq.com> Date: Mon, 26 Feb 2024 10:46:00 +0800 Subject: [PATCH] feat(noexist_library): fix typo --- scripts/utils/isPackageExist.js | 26 ++++++++++++++------------ scripts/utils/updatePR.js | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/utils/isPackageExist.js b/scripts/utils/isPackageExist.js index 974caf48..9b8f0d12 100644 --- a/scripts/utils/isPackageExist.js +++ b/scripts/utils/isPackageExist.js @@ -1,22 +1,24 @@ const fsp = require('fs').promises; const path = require('path'); -module.exports.isPackageExist = async (libraryName) => { +const isPackageExist = async (libraryName) => { const [prefix] = libraryName.split(/[\-\_]/); - const targetPackagesDir = path.join( - '.', - 'packages', - prefix.length === libraryName.length ? '' : prefix, - libraryName - ); + let targetPackagesDir = path.join('.', 'packages', prefix.length === libraryName.length ? '' : prefix, libraryName); try { - await fsp.access( - targetPackagesDir, - fsp.constants.R_OK | fsp.constants.W_OK - ); + await fsp.access(targetPackagesDir, fsp.constants.R_OK | fsp.constants.W_OK); return targetPackagesDir; } catch { - return null; + try { + targetPackagesDir = path.join('.', libraryName); + await fsp.access(targetPackagesDir, fsp.constants.R_OK | fsp.constants.W_OK); + return targetPackagesDir; + } catch { + return null; + } } }; + +module.exports.isPackageExist = isPackageExist; + +// isPackageExist('noexist_library').then((v) => console.log(v)); diff --git a/scripts/utils/updatePR.js b/scripts/utils/updatePR.js index 5d47a645..7cc0c16d 100644 --- a/scripts/utils/updatePR.js +++ b/scripts/utils/updatePR.js @@ -10,7 +10,7 @@ module.exports.updatePullRequest = async (content) => { }; console.log('pull number', pullRequestNumber); - const response = await fetch('https://api.github.com/repos/vusion/cloud-ui/pull/${pullRequestNumber}', { + const response = await fetch('https://api.github.com/repos/vusion/cloud-ui-materials/pull/${pullRequestNumber}', { method: 'PATCH', headers: { 'Content-Type': 'application/json',