2021-04-15 19:17:44 +00:00
|
|
|
import clear from 'clear'
|
2022-09-01 09:34:56 +00:00
|
|
|
import { bold, gray, green } from 'colorette'
|
2021-04-15 19:17:44 +00:00
|
|
|
import { version } from '../../package.json'
|
2022-09-01 10:56:18 +00:00
|
|
|
import { tryRequireModule } from './cjs'
|
2021-04-15 19:17:44 +00:00
|
|
|
|
2021-07-02 12:45:15 +00:00
|
|
|
export function showBanner (_clear?: boolean) {
|
2021-04-15 19:17:44 +00:00
|
|
|
if (_clear) { clear() }
|
2022-09-01 09:34:56 +00:00
|
|
|
console.log(gray(`Nuxi ${(bold(version))}`))
|
|
|
|
}
|
|
|
|
|
|
|
|
export function showVersions (cwd: string) {
|
|
|
|
const getPkgVersion = (pkg: string) => {
|
2022-09-01 10:56:18 +00:00
|
|
|
return tryRequireModule(`${pkg}/package.json`, cwd)?.version || ''
|
2022-09-01 09:34:56 +00:00
|
|
|
}
|
|
|
|
const nuxtVersion = getPkgVersion('nuxt') || getPkgVersion('nuxt-edge')
|
|
|
|
const nitroVersion = getPkgVersion('nitropack')
|
|
|
|
console.log(gray(
|
|
|
|
green(`Nuxt ${bold(nuxtVersion)}`) +
|
|
|
|
(nitroVersion ? ` with Nitro ${(bold(nitroVersion))}` : '')
|
|
|
|
))
|
2021-04-15 19:17:44 +00:00
|
|
|
}
|