Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove decimal places when displaying only bytes #1166

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing

## Making changes

1. Fork the repository.
2. Make changes.
3. Add tests in `test/`.
4. Run tests with `pnpm test`.

## Release changes

1. Merge PRs into dev branch.
2. Merge dev branch into main branch with `git checkout main && git merge dev`
3. Push main branch to remote with `git push`
4. GitHub action will create a release and publish it to npm.

Feel free to improve this process by creating an issue or PR.
2 changes: 1 addition & 1 deletion src/lib/report-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as colors from 'picocolors'
import type { Logger } from '../log'

const prettyBytes = (bytes: number) => {
if (bytes === 0) return '0 B'
if (bytes < 1024) return `${bytes} B`
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const exp = Math.floor(Math.log(bytes) / Math.log(1024))
return `${(bytes / 1024 ** exp).toFixed(2)} ${unit[exp]}`
Expand Down
Loading