This repository was archived by the owner on Apr 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(nuxi): display nuxt and nitro versions for dev and build commands #7118
Merged
Merged
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
26be10f
feat(nuxi): show versions in dev and build commands
pi0 52a0570
add nitro for info
pi0 9b9aaff
make casing consistent
pi0 3557692
better colors
pi0 f904ac0
remove extra color format
pi0 d2d4a16
update style
pi0 7b031d9
add nuxt-edge and fallback strings
pi0 2b90543
reorder
pi0 ca0c6d4
fix typo
pi0 e76d4e5
simplify
pi0 f281bbc
make it more readable
pi0 92b4884
add protection fallbacks back
pi0 d017ba1
remove verbosity
pi0 bc67813
try another version
pi0 cb4c16b
update
pi0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,24 @@ | ||
import { createRequire } from 'node:module' | ||
import clear from 'clear' | ||
import { green } from 'colorette' | ||
import { gray, green } from 'colorette' | ||
import { version } from '../../package.json' | ||
|
||
export function showBanner (_clear?: boolean) { | ||
if (_clear) { clear() } | ||
console.log(green(`Nuxt CLI v${version}`)) | ||
console.log(gray(`nuxi ${version}`)) | ||
} | ||
|
||
export function showVersions (cwd: string) { | ||
const _require = createRequire(cwd) | ||
const versions = [] | ||
for (const pkg of ['nuxt', 'nitropack', 'vite', 'webpack']) { | ||
try { | ||
const { version } = _require(`${pkg}/package.json`) | ||
const fullName = pkg + '@' + version | ||
versions.push(pkg === 'nuxt' ? green(fullName) : gray(fullName)) | ||
} catch { | ||
// Not found | ||
} | ||
} | ||
console.log(versions.join(' ')) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.