mirror of
https://github.com/hanzoai/pack.git
synced 2026-09-30 23:43:13 +00:00
* feat: add reproduction case for pnpm 11 engines mismatch - Add a new example project to reproduce issues when using pnpm 11 in engines configuration with '.x' notation. - Include a test definition to verify node and pnpm versions as detected by the environment. Generated-by: aiautocommit * test: add snapshot for node-pnpm-11-engines example Generated-by: aiautocommit * feat(node): support pnpm 11+ global bin directory layout * Resolve pnpm version via the context resolver to handle non-semver range notation (e.g., "11.5.x") found in `engines.pnpm`. * Update global bin directory path for pnpm 11+ to `PNPM_HOME/bin` to ensure `node-gyp` installation succeeds. * Add test case for resolved mise versions. Generated-by: aiautocommit
24 lines
707 B
JavaScript
24 lines
707 B
JavaScript
const { execSync } = require('child_process');
|
|
|
|
function getPnpmVersion() {
|
|
const ua = process.env.npm_config_user_agent || "";
|
|
return /\bpnpm\/([^\s]+)/.exec(ua)?.[1] ?? null;
|
|
}
|
|
|
|
const nodeVersion = process.version;
|
|
console.log(`Node.js version: ${nodeVersion}`);
|
|
|
|
const pnpmVersionFromUA = getPnpmVersion();
|
|
if (pnpmVersionFromUA) {
|
|
console.log(`PNPM version (from user agent): v${pnpmVersionFromUA}`);
|
|
} else {
|
|
console.log('PNPM version (from user agent): not detected');
|
|
}
|
|
|
|
try {
|
|
const pnpmVersion = execSync('pnpm --version', { encoding: 'utf8' }).trim();
|
|
console.log(`PNPM version (from CLI): v${pnpmVersion}`);
|
|
} catch (error) {
|
|
console.log('PNPM version (from CLI): not available');
|
|
}
|