( type: CommandType = 'install', )
| 1702 | |
| 1703 | type CommandType = 'install' | 'uninstall' | 'update' |
| 1704 | export function getPackageManagerCommand( |
| 1705 | type: CommandType = 'install', |
| 1706 | ): string { |
| 1707 | const packageManager = |
| 1708 | process.env.npm_config_user_agent?.split(' ')[0].split('/')[0] || 'npm' |
| 1709 | switch (type) { |
| 1710 | case 'install': |
| 1711 | return packageManager === 'npm' ? 'npm install' : `${packageManager} add` |
| 1712 | case 'uninstall': |
| 1713 | return packageManager === 'npm' |
| 1714 | ? 'npm uninstall' |
| 1715 | : `${packageManager} remove` |
| 1716 | case 'update': |
| 1717 | return packageManager === 'yarn' |
| 1718 | ? 'yarn upgrade' |
| 1719 | : `${packageManager} update` |
| 1720 | default: |
| 1721 | throw new TypeError(`Unknown command type: ${type}`) |
| 1722 | } |
| 1723 | } |
| 1724 | |
| 1725 | export function isDevServer( |
| 1726 | server: ViteDevServer | PreviewServer, |
no outgoing calls
no test coverage detected