From 203f872bb26641f9853448b9bad595b0f8e1cc3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 09:16:50 +0000 Subject: [PATCH] chore(deps-dev): bump typescript from 4.3.5 to 4.4.2 (#475) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.3.5 to 4.4.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.3.5...v4.4.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com> --- windows/test-app.js | 26 ++++++++++++++++---------- yarn.lock | 6 +++--- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/windows/test-app.js b/windows/test-app.js index 1a0c4c9b4..aa1d9d57c 100755 --- a/windows/test-app.js +++ b/windows/test-app.js @@ -81,6 +81,15 @@ function findUserProjects(projectDir, projects = []) { }, projects); } +/** + * Returns whether specified object is Error-like. + * @param {unknown} e + * @returns {e is Error} + */ +function isErrorLike(e) { + return typeof e === "object" && e !== null && "name" in e && "message" in e; +} + /** * Returns a NuGet package entry for specified package id and version. * @param {string} id NuGet package id @@ -176,16 +185,9 @@ function toProjectEntry(project, destPath) { * @param {{ [pattern: string]: string }=} replacements e.g. {'TextToBeReplaced': 'Replacement'} */ function copyAndReplace(srcPath, destPath, replacements = {}) { - /** @type {(e: NodeJS.ErrnoException | null) => void} */ - const throwOnError = (e) => { - if (e) { - throw e; - } - }; - if (binaryExtensions.includes(path.extname(srcPath))) { // Binary file - return fs.copyFile(srcPath, destPath, throwOnError); + return fs.copyFile(srcPath, destPath, rethrow); } else { // Text file return fs.writeFile( @@ -198,7 +200,7 @@ function copyAndReplace(srcPath, destPath, replacements = {}) { encoding: "utf-8", mode: fs.statSync(srcPath).mode, }, - throwOnError + rethrow ); } } @@ -238,7 +240,11 @@ function getBundleResources(manifestFilePath, projectFilesDestPath) { bundleFileContent, }; } catch (e) { - console.warn(`Could not parse 'app.json':\n${e.message}`); + if (isErrorLike(e)) { + console.warn(`Could not parse 'app.json':\n${e.message}`); + } else { + throw e; + } } } else { console.warn("Could not find 'app.json' file."); diff --git a/yarn.lock b/yarn.lock index 0a0f71444..aae97d0aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9383,9 +9383,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^4.0.0: - version "4.3.5" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" - integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== + version "4.4.2" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" + integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== ua-parser-js@^0.7.18: version "0.7.28"