Skip to content

Commit

Permalink
deps: update npm-install-checks@7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reggi committed Oct 2, 2024
1 parent be6ae96 commit 591130d
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 82 deletions.
4 changes: 3 additions & 1 deletion node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
/@npmcli/package-json/node_modules/@npmcli/*
!/@npmcli/package-json/node_modules/@npmcli/git
!/@npmcli/package-json/node_modules/isexe
!/@npmcli/package-json/node_modules/npm-install-checks
!/@npmcli/package-json/node_modules/npm-normalize-package-bin
!/@npmcli/package-json/node_modules/npm-package-arg
!/@npmcli/package-json/node_modules/npm-pick-manifest
Expand Down Expand Up @@ -241,6 +240,9 @@
!/npm-package-arg/node_modules/hosted-git-info
!/npm-packlist
!/npm-pick-manifest
!/npm-pick-manifest/node_modules/
/npm-pick-manifest/node_modules/*
!/npm-pick-manifest/node_modules/npm-install-checks
!/npm-profile
!/npm-registry-fetch
!/npm-registry-fetch/node_modules/
Expand Down
41 changes: 15 additions & 26 deletions node_modules/npm-install-checks/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const semver = require('semver')
const currentEnv = require('./current-env')
const { checkDevEngines } = require('./dev-engines')

const checkEngine = (target, npmVer, nodeVer, force = false) => {
const nodev = force ? null : nodeVer
Expand All @@ -20,44 +22,29 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => {
}
}

const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-')

const checkPlatform = (target, force = false, environment = {}) => {
if (force) {
return
}

const platform = environment.os || process.platform
const arch = environment.cpu || process.arch
const osOk = target.os ? checkList(platform, target.os) : true
const cpuOk = target.cpu ? checkList(arch, target.cpu) : true
const os = environment.os || currentEnv.os()
const cpu = environment.cpu || currentEnv.cpu()
const libc = environment.libc || currentEnv.libc(os)

let libcOk = true
let libcFamily = null
if (target.libc) {
// libc checks only work in linux, any value is a failure if we aren't
if (environment.libc) {
libcOk = checkList(environment.libc, target.libc)
} else if (platform !== 'linux') {
libcOk = false
} else {
const report = process.report.getReport()
if (report.header?.glibcVersionRuntime) {
libcFamily = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
libcFamily = 'musl'
}
libcOk = libcFamily ? checkList(libcFamily, target.libc) : false
}
const osOk = target.os ? checkList(os, target.os) : true
const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true
let libcOk = target.libc ? checkList(libc, target.libc) : true
if (target.libc && !libc) {
libcOk = false
}

if (!osOk || !cpuOk || !libcOk) {
throw Object.assign(new Error('Unsupported platform'), {
pkgid: target._id,
current: {
os: platform,
cpu: arch,
libc: libcFamily,
os,
cpu,
libc,
},
required: {
os: target.os,
Expand Down Expand Up @@ -98,4 +85,6 @@ const checkList = (value, list) => {
module.exports = {
checkEngine,
checkPlatform,
checkDevEngines,
currentEnv,
}
19 changes: 10 additions & 9 deletions node_modules/npm-install-checks/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
{
"name": "npm-install-checks",
"version": "6.3.0",
"version": "7.1.0",
"description": "Check the engines and platform fields in package.json",
"main": "lib/index.js",
"dependencies": {
"semver": "^7.1.1"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.19.0",
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"tap": "^16.0.1"
},
"scripts": {
"test": "tap",
"lint": "eslint \"**/*.js\"",
"lint": "npm run eslint",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run lint -- --fix",
"lintfix": "npm run eslint -- --fix",
"snap": "tap",
"posttest": "npm run lint"
"posttest": "npm run lint",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"repository": {
"type": "git",
"url": "https://github.com/npm/npm-install-checks.git"
"url": "git+https://github.com/npm/npm-install-checks.git"
},
"keywords": [
"npm,",
Expand All @@ -34,12 +35,12 @@
"lib/"
],
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^18.17.0 || >=20.5.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.19.0",
"version": "4.23.3",
"publish": "true"
},
"tap": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const semver = require('semver')
const currentEnv = require('./current-env')
const { checkDevEngines } = require('./dev-engines')

const checkEngine = (target, npmVer, nodeVer, force = false) => {
const nodev = force ? null : nodeVer
Expand All @@ -22,29 +20,44 @@ const checkEngine = (target, npmVer, nodeVer, force = false) => {
}
}

const isMusl = (file) => file.includes('libc.musl-') || file.includes('ld-musl-')

const checkPlatform = (target, force = false, environment = {}) => {
if (force) {
return
}

const os = environment.os || currentEnv.os()
const cpu = environment.cpu || currentEnv.cpu()
const libc = environment.libc || currentEnv.libc(os)
const platform = environment.os || process.platform
const arch = environment.cpu || process.arch
const osOk = target.os ? checkList(platform, target.os) : true
const cpuOk = target.cpu ? checkList(arch, target.cpu) : true

const osOk = target.os ? checkList(os, target.os) : true
const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true
let libcOk = target.libc ? checkList(libc, target.libc) : true
if (target.libc && !libc) {
libcOk = false
let libcOk = true
let libcFamily = null
if (target.libc) {
// libc checks only work in linux, any value is a failure if we aren't
if (environment.libc) {
libcOk = checkList(environment.libc, target.libc)
} else if (platform !== 'linux') {
libcOk = false
} else {
const report = process.report.getReport()
if (report.header?.glibcVersionRuntime) {
libcFamily = 'glibc'
} else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
libcFamily = 'musl'
}
libcOk = libcFamily ? checkList(libcFamily, target.libc) : false
}
}

if (!osOk || !cpuOk || !libcOk) {
throw Object.assign(new Error('Unsupported platform'), {
pkgid: target._id,
current: {
os,
cpu,
libc,
os: platform,
cpu: arch,
libc: libcFamily,
},
required: {
os: target.os,
Expand Down Expand Up @@ -85,6 +98,4 @@ const checkList = (value, list) => {
module.exports = {
checkEngine,
checkPlatform,
checkDevEngines,
currentEnv,
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
{
"name": "npm-install-checks",
"version": "7.1.0",
"version": "6.3.0",
"description": "Check the engines and platform fields in package.json",
"main": "lib/index.js",
"dependencies": {
"semver": "^7.1.1"
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.19.0",
"tap": "^16.0.1"
},
"scripts": {
"test": "tap",
"lint": "npm run eslint",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"template-oss-apply": "template-oss-apply --force",
"lintfix": "npm run eslint -- --fix",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
"posttest": "npm run lint"
},
"repository": {
"type": "git",
"url": "git+https://github.com/npm/npm-install-checks.git"
"url": "https://github.com/npm/npm-install-checks.git"
},
"keywords": [
"npm,",
Expand All @@ -35,12 +34,12 @@
"lib/"
],
"engines": {
"node": "^18.17.0 || >=20.5.0"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"author": "GitHub Inc.",
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.23.3",
"version": "4.19.0",
"publish": "true"
},
"tap": {
Expand Down
38 changes: 19 additions & 19 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"nopt": "^8.0.0",
"normalize-package-data": "^7.0.0",
"npm-audit-report": "^6.0.0",
"npm-install-checks": "^6.3.0",
"npm-install-checks": "^7.1.0",
"npm-package-arg": "^11.0.3",
"npm-pick-manifest": "^9.1.0",
"npm-profile": "^10.0.0",
Expand Down Expand Up @@ -1832,19 +1832,6 @@
"node": ">=16"
}
},
"node_modules/@npmcli/package-json/node_modules/npm-install-checks": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.0.tgz",
"integrity": "sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==",
"inBundle": true,
"license": "BSD-2-Clause",
"dependencies": {
"semver": "^7.1.1"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/@npmcli/package-json/node_modules/npm-normalize-package-bin": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz",
Expand Down Expand Up @@ -10271,16 +10258,16 @@
}
},
"node_modules/npm-install-checks": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz",
"integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-7.1.0.tgz",
"integrity": "sha512-bkTildVlofeMX7wiOaWk3PlW7YcBXAuEc7TWpOxwUgalG5ZvgT/ms+6OX9zt7iGLv4+VhKbRZhpOfgQJzk1YAw==",
"inBundle": true,
"license": "BSD-2-Clause",
"dependencies": {
"semver": "^7.1.1"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
"node": "^18.17.0 || >=20.5.0"
}
},
"node_modules/npm-normalize-package-bin": {
Expand Down Expand Up @@ -10351,6 +10338,19 @@
"node": "^16.14.0 || >=18.0.0"
}
},
"node_modules/npm-pick-manifest/node_modules/npm-install-checks": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz",
"integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==",
"inBundle": true,
"license": "BSD-2-Clause",
"dependencies": {
"semver": "^7.1.1"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/npm-profile": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/npm-profile/-/npm-profile-10.0.0.tgz",
Expand Down Expand Up @@ -17041,7 +17041,7 @@
"lru-cache": "^10.2.2",
"minimatch": "^9.0.4",
"nopt": "^8.0.0",
"npm-install-checks": "^6.2.0",
"npm-install-checks": "^7.1.0",
"npm-package-arg": "^11.0.2",
"npm-pick-manifest": "^9.0.1",
"npm-registry-fetch": "^17.0.1",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"nopt": "^8.0.0",
"normalize-package-data": "^7.0.0",
"npm-audit-report": "^6.0.0",
"npm-install-checks": "^6.3.0",
"npm-install-checks": "^7.1.0",
"npm-package-arg": "^11.0.3",
"npm-pick-manifest": "^9.1.0",
"npm-profile": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lru-cache": "^10.2.2",
"minimatch": "^9.0.4",
"nopt": "^8.0.0",
"npm-install-checks": "^6.2.0",
"npm-install-checks": "^7.1.0",
"npm-package-arg": "^11.0.2",
"npm-pick-manifest": "^9.0.1",
"npm-registry-fetch": "^17.0.1",
Expand Down

0 comments on commit 591130d

Please sign in to comment.