From 2631e3b9baf1ca90ddd97d4d4c583a0903cc0552 Mon Sep 17 00:00:00 2001 From: Michiel De Smet Date: Sun, 19 May 2024 23:54:44 +0800 Subject: [PATCH] Fix semver check --- package-lock.json | 23 +++++++++-------------- package.json | 1 + src/dbt_client/dbtCloudIntegration.ts | 8 ++------ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3acee9b05..c714c17d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-dbt-power-user", - "version": "0.39.9", + "version": "0.39.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-dbt-power-user", - "version": "0.39.9", + "version": "0.39.10", "license": "MIT", "dependencies": { "@vscode/codicons": "^0.0.36", @@ -21,6 +21,7 @@ "parse-diff": "^0.11.1", "python-bridge": "github:mdesmet/node-python-bridge#feat/detached", "reflect-metadata": "^0.2.2", + "semver": "^7.6.2", "which": "^4.0.0", "yaml": "^2.4.2" }, @@ -5728,12 +5729,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -11071,12 +11069,9 @@ } }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==" }, "serialize-javascript": { "version": "6.0.0", diff --git a/package.json b/package.json index e965882c1..10a61fc9d 100644 --- a/package.json +++ b/package.json @@ -1163,6 +1163,7 @@ "parse-diff": "^0.11.1", "python-bridge": "github:mdesmet/node-python-bridge#feat/detached", "reflect-metadata": "^0.2.2", + "semver": "^7.6.2", "which": "^4.0.0", "yaml": "^2.4.2" }, diff --git a/src/dbt_client/dbtCloudIntegration.ts b/src/dbt_client/dbtCloudIntegration.ts index 3c749eb17..e5fc4445d 100644 --- a/src/dbt_client/dbtCloudIntegration.ts +++ b/src/dbt_client/dbtCloudIntegration.ts @@ -39,6 +39,7 @@ import { existsSync } from "fs"; import { ValidationProvider } from "../validation_provider"; import { DeferToProdService } from "../services/deferToProdService"; import { ProjectHealthcheck } from "./dbtCoreIntegration"; +import semver = require("semver"); function getDBTPath( pythonEnvironment: PythonEnvironment, @@ -88,13 +89,8 @@ export class DBTCloudDetection implements DBTDetection { const regex = /dbt Cloud CLI - (\d*\.\d*\.\d*)/gm; const matches = regex.exec(stdout); if (matches?.length === 2) { - const version = matches[1].split("."); const minVersion = "0.37.6"; - if ( - parseInt(version[0]) <= 0 && - parseInt(version[1]) <= 37 && - parseInt(version[2]) <= 6 - ) { + if (semver.lt(matches[1], minVersion)) { window.showErrorMessage( `This version of dbt Cloud is not supported. Please update to a dbt Cloud CLI version higher than ${minVersion}`, );