From 99aca1f795882e51df034ba9e40689fb97debe6e Mon Sep 17 00:00:00 2001 From: Alex Nitu Date: Tue, 25 Jun 2024 10:30:46 +0300 Subject: [PATCH] feat: upgrade to Node version 20 --- .circleci/config.yml | 2 +- .nvmrc | 2 +- .tool-versions | 2 +- jest.config.js | 3 --- package.json | 14 +++++++------- .../source-handlers/github/get-repo-metadata.ts | 2 +- src/lib/source-handlers/github/list-repos.ts | 2 +- .../github/organization-is-empty.ts | 2 +- tsconfig.json | 3 ++- 9 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 720247b9..58d67a81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ main_only: &main_only defaults: &defaults resource_class: small docker: - - image: circleci/node:12 + - image: cimg/node:20.11.1 jobs: security-scans: diff --git a/.nvmrc b/.nvmrc index 48082f72..209e3ef4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12 +20 diff --git a/.tool-versions b/.tool-versions index 961648f0..d7568adf 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -nodejs 12.22.12 +nodejs 20.11.1 diff --git a/jest.config.js b/jest.config.js index f8cdc48d..039da88a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,4 @@ module.exports = { testEnvironment: 'node', collectCoverageFrom: ['lib/**/*.ts'], coverageReporters: ['text-summary', 'html'], - moduleNameMapper: { - '^axios$': 'axios/dist/node/axios.cjs', - }, }; diff --git a/package.json b/package.json index a456807c..b8c2b8ad 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "author": "Snyk Tech Services", "license": "Apache-2.0", "engines": { - "node": ">=12" + "node": ">=20" }, "files": [ "bin", @@ -42,7 +42,6 @@ "@gitbeaker/node": "35.7.0", "@octokit/plugin-retry": "4.0.3", "@octokit/rest": "19.0.5", - "@types/base-64": "^1.0.0", "base-64": "^1.0.0", "bottleneck": "2.19.5", "bunyan": "1.8.15", @@ -63,13 +62,14 @@ "devDependencies": { "@octokit/types": "6.14.2", "@semantic-release/exec": "5.0.0", + "@types/base-64": "^1.0.0", "@types/bunyan": "1.8.6", "@types/debug": "4.1.5", - "@types/jest": "^25.1.1", + "@types/jest": "^29.5.12", "@types/lodash": "^4.14.149", "@types/micromatch": "4.0.6", "@types/needle": "2.0.4", - "@types/node": "14.14.45", + "@types/node": "^20.11.1", "@types/parse-link-header": "1.0.0", "@types/rimraf": "3.0.2", "@types/split": "1.0.0", @@ -78,13 +78,13 @@ "eslint": "7.30.0", "eslint-config-prettier": "^6.10.0", "eslint-plugin-check-file": "1.2.3", - "jest": "27.0.6", + "jest": "^29.7.0", "nock": "^13.2.1", "prettier": "2.7.1", "semantic-release": "17.3.0", - "ts-jest": "27.0.3", + "ts-jest": "^29.1.5", "tsc-watch": "^4.1.0", - "typescript": "4.3.5", + "typescript": "4.5", "uuid": "9.0.0" }, "pkg": { diff --git a/src/lib/source-handlers/github/get-repo-metadata.ts b/src/lib/source-handlers/github/get-repo-metadata.ts index d63d8886..29af178f 100644 --- a/src/lib/source-handlers/github/get-repo-metadata.ts +++ b/src/lib/source-handlers/github/get-repo-metadata.ts @@ -5,7 +5,7 @@ import type { RepoMetaData, Target } from '../../types'; import { getGithubToken } from './get-github-token'; import { getGithubBaseUrl } from './github-base-url'; -const githubClient = Octokit.plugin(retry); +const githubClient = Octokit.plugin(retry as any); const debug = debugLib('snyk:get-github-defaultBranch-script'); export async function getGithubRepoMetaData( diff --git a/src/lib/source-handlers/github/list-repos.ts b/src/lib/source-handlers/github/list-repos.ts index 81fbb48f..d81545f4 100644 --- a/src/lib/source-handlers/github/list-repos.ts +++ b/src/lib/source-handlers/github/list-repos.ts @@ -6,7 +6,7 @@ import { getGithubBaseUrl } from './github-base-url'; import type { GithubRepoData } from './types'; const debug = debugLib('snyk:list-repos-script'); -const githubClient = Octokit.plugin(retry); +const githubClient = Octokit.plugin(retry as any); export async function fetchReposForPage( octokit: Octokit, diff --git a/src/lib/source-handlers/github/organization-is-empty.ts b/src/lib/source-handlers/github/organization-is-empty.ts index 534cc10d..ee369840 100644 --- a/src/lib/source-handlers/github/organization-is-empty.ts +++ b/src/lib/source-handlers/github/organization-is-empty.ts @@ -7,7 +7,7 @@ import { fetchReposForPage } from './list-repos'; import { getGithubToken } from './get-github-token'; const debug = debugLib('snyk:github'); -const githubClient = Octokit.plugin(retry); +const githubClient = Octokit.plugin(retry as any); export async function githubOrganizationIsEmpty( orgName: string, diff --git a/tsconfig.json b/tsconfig.json index 23395cfb..8e27a5d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "declaration": true, "importHelpers": true, "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "useUnknownInCatchVariables": false }, "include": ["./src/**/**/*"] }