Files
dealplustech/dealplustech-astro/node_modules/preferred-pm/index.js
Kunthawat Greethong 3ed9f3f3ff 🎨 Fix CSS: Import global.css + plain CSS styles
CSS was not being imported! Fixed:

 Added 'import ../styles/global.css' to BaseLayout.astro
 Rewrote CSS with plain CSS (not @apply which wasn't working)
 Cookie banner has inline styles as backup
 Font size: 16px base
 Solid colors: green-600 (#16a34a), gray-900 (#111827)
 Footer has policy links

Build: 12 pages 
2026-03-10 08:21:30 +07:00

66 lines
1.6 KiB
JavaScript

'use strict'
const findYarnWorkspaceRoot = require('find-yarn-workspace-root2')
const fs = require('fs')
const path = require('path')
const whichPM = require('which-pm')
module.exports = async function preferredPM (pkgPath) {
if (typeof pkgPath !== 'string') {
throw new TypeError(`pkgPath should be a string, got ${typeof pkgPath}`)
}
if (fs.existsSync(path.join(pkgPath, 'package-lock.json'))) {
return {
name: 'npm',
version: '>=5'
}
}
if (fs.existsSync(path.join(pkgPath, 'yarn.lock'))) {
return {
name: 'yarn',
version: '*'
}
}
if (fs.existsSync(path.join(pkgPath, 'pnpm-lock.yaml'))) {
return {
name: 'pnpm',
version: '>=3'
}
}
if (fs.existsSync(path.join(pkgPath, 'shrinkwrap.yaml'))) {
return {
name: 'pnpm',
version: '1 || 2'
}
}
if (fs.existsSync(path.join(pkgPath, 'bun.lockb')) || fs.existsSync(path.join(pkgPath, 'bun.lock'))) {
return {
name: 'bun',
version: '*'
}
}
const { findUp } = await import('find-up-simple')
if (await findUp('pnpm-lock.yaml', { cwd: pkgPath })) {
return {
name: 'pnpm',
version: '>=3'
}
}
try {
const workspaceRoot = findYarnWorkspaceRoot(pkgPath)
if (typeof workspaceRoot === 'string') {
if (fs.existsSync(path.join(workspaceRoot, 'package-lock.json'))) {
return {
name: 'npm',
version: '>=7'
}
}
return {
name: 'yarn',
version: '*'
}
}
} catch (err) {}
const pm = await whichPM(pkgPath)
return pm && { name: pm.name, version: pm.version || '*' }
}