Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platformatic/utils

Package Overview
Dependencies
Maintainers
6
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platformatic/utils - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

2

index.js

@@ -22,3 +22,3 @@ 'use strict'

module.exports.checkForDependencies = packages.checkForDependencies
module.exports.getLatestNpmVersion = packages.getLatestNpmVersion
module.exports.errors = errors

@@ -6,2 +6,3 @@ 'use strict'

const isFileAccessible = require('./is-file-accessible')
const { request } = require('undici')

@@ -42,3 +43,12 @@ async function getDependencyVersion (require, dependencyName) {

for (const m of modules) {
requiredDependencies[m] = await getPlatformaticVersion()
if (m.startsWith('@platformatic')) {
requiredDependencies[m] = await getPlatformaticVersion()
} else {
const externalModuleVersion = await getLatestNpmVersion(m)
if (externalModuleVersion === null) {
logger.error(`Cannot find latest version on npm for package ${m}`)
} else {
requiredDependencies[m] = externalModuleVersion
}
}
}

@@ -60,4 +70,3 @@

}
if (allRequiredDependenciesInstalled) return
if (allRequiredDependenciesInstalled) return /* c8 ignore next */
}

@@ -77,5 +86,17 @@

module.exports.getDependencyVersion = getDependencyVersion
module.exports.getPlatformaticVersion = getPlatformaticVersion
module.exports.hasDependency = hasDependency
module.exports.checkForDependencies = checkForDependencies
async function getLatestNpmVersion (pkg) {
const res = await request(`https://registry.npmjs.org/${pkg}`)
if (res.statusCode === 200) {
const json = await res.body.json()
return json['dist-tags'].latest
}
return null
}
module.exports = {
getDependencyVersion,
getPlatformaticVersion,
hasDependency,
checkForDependencies,
getLatestNpmVersion
}
{
"name": "@platformatic/utils",
"version": "1.1.1",
"version": "1.2.0",
"description": "Platformatic DB Utils",

@@ -27,3 +27,4 @@ "main": "index.js",

"leven": "~3.1.0",
"minimatch": "^8.0.4"
"minimatch": "^8.0.4",
"undici": "^5.25.4"
},

@@ -30,0 +31,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc