Comparing version 0.1.2-pre.1 to 0.1.2-pre.6
{ | ||
"name": "grafbase", | ||
"version": "0.1.2-pre.1", | ||
"version": "0.1.2-pre.6", | ||
"description": "The Grafbase command line interface", | ||
"keywords": [ | ||
"grafbase" | ||
], | ||
"homepage": "https://grafbase.com", | ||
"bugs": { | ||
"url": "https://github.com/grafbase/grafbase/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"directory": "cli", | ||
"url": "https://github.com/grafbase/grafbase" | ||
"url": "https://github.com/grafbase/grafbase", | ||
"directory": "cli" | ||
}, | ||
"license": "Apache-2.0", | ||
"bin": { | ||
@@ -16,26 +24,17 @@ "grafbase": "grafbase" | ||
}, | ||
"files": [ | ||
".npmrc", | ||
"grafbase", | ||
"postinstall.js", | ||
"ACKNOWLEDGEMENTS.md" | ||
], | ||
"keywords": [ | ||
"grafbase" | ||
], | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/grafbase/grafbase/issues" | ||
}, | ||
"homepage": "https://grafbase.com", | ||
"dependencies": { | ||
"detect-libc": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"jest": "^28.1.2" | ||
}, | ||
"optionalDependencies": { | ||
"@grafbase/cli-aarch64-apple-darwin": "^0.1.2-pre.6", | ||
"@grafbase/cli-x86_64-apple-darwin": "^0.1.2-pre.6", | ||
"@grafbase/cli-x86_64-pc-windows-msvc": "^0.1.2-pre.6", | ||
"@grafbase/cli-x86_64-unknown-linux-musl": "^0.1.2-pre.6" | ||
}, | ||
"engines": { | ||
"node": ">=16.7.0" | ||
}, | ||
"optionalDependencies": { | ||
"@grafbase/cli-macos-arm64": "^0.1.2-pre.1", | ||
"@grafbase/cli-macos-x64": "^0.1.2-pre.1" | ||
} | ||
} |
@@ -6,41 +6,45 @@ // Based on | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { existsSync, linkSync, copyFileSync } = require('fs'); | ||
const { dirname, join } = require('path'); | ||
const { getEnvironmentData } = require('./get-environment-data'); | ||
const platform = process.platform === 'win32' ? 'windows' : process.platform === 'darwin' ? 'macos' : process.platform; | ||
const parts = [platform, process.arch]; | ||
const SUPPORTED_TARGET_TRIPLES = [ | ||
'x86_64-apple-darwin', | ||
'aarch64-apple-darwin', | ||
'x86_64-unknown-linux-musl', | ||
'x86_64-pc-windows-msvc', | ||
]; | ||
if (process.platform === 'linux') { | ||
const { familySync } = require('detect-libc'); | ||
const linkBinary = (binary, binaryPath) => { | ||
try { | ||
linkSync(binaryPath, join(__dirname, binary)); | ||
} catch { | ||
copyFileSync(binaryPath, join(__dirname, binary)); | ||
} | ||
}; | ||
if (familySync() === 'musl') { | ||
parts.push('musl'); | ||
} else if (process.arch === 'arm') { | ||
parts.push('gnueabihf'); | ||
} else { | ||
parts.push('gnu'); | ||
const postinstall = () => { | ||
const { targetTriple, binary } = getEnvironmentData('grafbase'); | ||
if (!SUPPORTED_TARGET_TRIPLES.includes(targetTriple)) { | ||
console.error(`'${targetTriple}' is currently unsupported`); | ||
return; | ||
} | ||
} else if (process.platform === 'win32') { | ||
parts.push('msvc'); | ||
} | ||
const binary = process.platform === 'win32' ? 'grafbase.exe' : 'grafbase'; | ||
const triple = parts.join('-'); | ||
const packagePath = dirname(require.resolve(`@grafbase/cli-${targetTriple}/package.json`)); | ||
const binaryPath = join(packagePath, binary); | ||
const pkgPath = path.dirname(require.resolve(`@grafbase/cli-${triple}/package.json`)); | ||
const binPath = path.join(pkgPath, binary); | ||
try { | ||
if (fs.existsSync(binPath)) { | ||
if (existsSync(binaryPath)) { | ||
try { | ||
fs.linkSync(binPath, path.join(__dirname, binary)); | ||
linkBinary(binary, binaryPath); | ||
} catch { | ||
fs.copyFileSync(binPath, path.join(__dirname, binary)); | ||
console.error('Could not link or copy "grafbase" binary'); | ||
return; | ||
} | ||
} else { | ||
console.error('Could not link the "grafbase" binary'); | ||
throw new Error(); | ||
console.error('Could not find "grafbase" binary'); | ||
return; | ||
} | ||
} catch { | ||
console.error('Failed to find "grafbase" binary.'); | ||
} | ||
}; | ||
postinstall(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7226
7
149
0
0
48
5
1
1