From 04333b37b738c9a0ca13ef480728fe09cde566eb Mon Sep 17 00:00:00 2001 From: Wanpeng Li Date: Tue, 28 May 2024 18:47:14 +0800 Subject: [PATCH] update typescript to resolve ci issue (#8338) Co-authored-by: albertxavier100 --- tools/js-sdk-release-tools/package-lock.json | 23 +++++++++++++++---- tools/js-sdk-release-tools/package.json | 2 +- .../src/hlc/generateMgmt.ts | 4 ++-- .../generateRLCInPipeline.ts | 6 ++--- .../src/llc/utils/generateChangelog.ts | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/tools/js-sdk-release-tools/package-lock.json b/tools/js-sdk-release-tools/package-lock.json index 2ebc2e8901f..55ed4d9fc05 100644 --- a/tools/js-sdk-release-tools/package-lock.json +++ b/tools/js-sdk-release-tools/package-lock.json @@ -36,7 +36,7 @@ "nodemon": "^3.1.0", "rimraf": "^3.0.2", "ts-node": "^10.9.2", - "typescript": "^3.9.7" + "typescript": "^5.4.5" } }, "node_modules/@azure-tools/openapi-tools-common": { @@ -2107,6 +2107,18 @@ "typescript": "^3.0.3" } }, + "node_modules/parse-ts-to-ast/node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -2678,15 +2690,16 @@ } }, "node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "version": "5.4.5", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/typical": { diff --git a/tools/js-sdk-release-tools/package.json b/tools/js-sdk-release-tools/package.json index 9fd378ff847..df76647e1fc 100644 --- a/tools/js-sdk-release-tools/package.json +++ b/tools/js-sdk-release-tools/package.json @@ -39,6 +39,6 @@ "nodemon": "^3.1.0", "rimraf": "^3.0.2", "ts-node": "^10.9.2", - "typescript": "^3.9.7" + "typescript": "^5.4.5" } } diff --git a/tools/js-sdk-release-tools/src/hlc/generateMgmt.ts b/tools/js-sdk-release-tools/src/hlc/generateMgmt.ts index 9ebbb7b3726..fb48064b583 100644 --- a/tools/js-sdk-release-tools/src/hlc/generateMgmt.ts +++ b/tools/js-sdk-release-tools/src/hlc/generateMgmt.ts @@ -52,7 +52,7 @@ export async function generateMgmt(options: { logger.logGreen('------------------------------------------------------------'); try { execSync(cmd, {stdio: 'inherit'}); - } catch (e) { + } catch (e: any) { throw new Error(`An error occurred while generating codes for readme file: "${options.readmeMd}":\nErr: ${e}\nStderr: "${e.stderr}"\nStdout: "${e.stdout}"\nErrorStack: "${e.stack}"`); } } @@ -154,7 +154,7 @@ export async function generateMgmt(options: { } } } - } catch (e) { + } catch (e: any) { logger.logError('Error:'); logger.logError(`An error occurred while run build for readme file: "${options.readmeMd}":\nErr: ${e}\nStderr: "${e.stderr}"\nStdout: "${e.stdout}"\nErrorStack: "${e.stack}"`); if (outputPackageInfo) { diff --git a/tools/js-sdk-release-tools/src/llc/generateRLCInPipeline/generateRLCInPipeline.ts b/tools/js-sdk-release-tools/src/llc/generateRLCInPipeline/generateRLCInPipeline.ts index 3ad2c1167a0..a869d4a6178 100644 --- a/tools/js-sdk-release-tools/src/llc/generateRLCInPipeline/generateRLCInPipeline.ts +++ b/tools/js-sdk-release-tools/src/llc/generateRLCInPipeline/generateRLCInPipeline.ts @@ -96,7 +96,7 @@ export async function generateRLCInPipeline(options: { } match = regexToExtractAutorestConfig.exec(options.autorestConfig); } - } catch (e) { + } catch (e: any) { logger.logError(`Encounter error when parsing autorestConfig from PR comment: \nErr: ${e}\nStderr: "${e.stderr}"\nStdout: "${e.stdout}"\nErrorStack: "${e.stack}"`); throw e; } @@ -178,7 +178,7 @@ export async function generateRLCInPipeline(options: { logger.logGreen('------------------------------------------------------------'); try { execSync(cmd, {stdio: 'inherit', cwd: path.dirname(autorestConfigFilePath)}); - } catch (e) { + } catch (e: any) { throw new Error(`An error occurred while generating codes for readme file: "${options.readmeMd}":\nErr: ${e}\nStderr: "${e.stderr}"\nStdout: "${e.stdout}"\nErrorStack: "${e.stack}"`); } } @@ -243,7 +243,7 @@ export async function generateRLCInPipeline(options: { } addApiViewInfo(outputPackageInfo, packagePath, relativePackagePath); } - } catch (e) { + } catch (e: any) { logger.logError('Error:'); if (options.typespecProject) { logger.logError(`An error occurred while run build for typespec project: "${options.typespecProject}":\nErr: ${e}\nStderr: "${e.stderr}"\nStdout: "${e.stdout}"\nErrorStack: "${e.stack}"`); diff --git a/tools/js-sdk-release-tools/src/llc/utils/generateChangelog.ts b/tools/js-sdk-release-tools/src/llc/utils/generateChangelog.ts index 3619f23d353..6de2d7139dd 100644 --- a/tools/js-sdk-release-tools/src/llc/utils/generateChangelog.ts +++ b/tools/js-sdk-release-tools/src/llc/utils/generateChangelog.ts @@ -74,7 +74,7 @@ export async function generateChangelog(packagePath) { } } - } catch (e) { + } catch (e: any) { logger.logError(`Generate changelog failed: ${e.message}`); } finally { fs.rmSync(path.join(packagePath, 'changelog-temp'), { recursive: true, force: true });