From 8cda2b8fcd09c5e20b58007b4b22b0d8523527e2 Mon Sep 17 00:00:00 2001 From: kudo-sync-bot Date: Mon, 16 Dec 2024 06:51:21 -0800 Subject: [PATCH] =?UTF-8?q?Replaced=20`rePatterns.Hash.exec()`?= =?UTF-8?q?=20fallbacks=20using=20shorter=20optional=20chaining=20?= =?UTF-8?q?=E2=86=9E=20[auto-sync=20from=20https://github.com/adamlui/ai-w?= =?UTF-8?q?eb-extensions]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/bump/js-resources.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/bump/js-resources.js b/utils/bump/js-resources.js index aea8aa53..b0363426 100644 --- a/utils/bump/js-resources.js +++ b/utils/bump/js-resources.js @@ -97,14 +97,14 @@ const resourceName = (rePatterns.resourceName.exec(jsrURL) || ['resource'])[0] // dir/filename.js for logs // Compare commit hashes - if ((rePatterns.commitHash.exec(jsrURL) || [])[1] == latestCommitHash) { // commit hash didn't change... + if (rePatterns.commitHash.exec(jsrURL)?.[1] == latestCommitHash) { // commit hash didn't change... console.log(`${resourceName} already up-to-date!\n`) ; continue } // ...so skip resource let updatedURL = jsrURL.replace(rePatterns.commitHash, `@${latestCommitHash}`) // othrwise update commit hash // Generate/compare SRI hash console.log(`Generating SHA-256 hash for ${resourceName}...`) const newSRIhash = await getSRIhash(updatedURL) - if ((rePatterns.sriHash.exec(jsrURL) || [])[0] == newSRIhash) { // SRI hash didn't change + if (rePatterns.sriHash.exec(jsrURL)?.[0] == newSRIhash) { // SRI hash didn't change console.log(`${resourceName} already up-to-date!\n`) ; continue } // ...so skip resource updatedURL = updatedURL.replace(rePatterns.sriHash, newSRIhash) // otherwise update SRI hash