antonmedv / jsize

Find out minified and gzipped npm package size
MIT License
178 stars 12 forks source link

Use table to render data #26

Closed DylanPiercey closed 7 years ago

DylanPiercey commented 7 years ago

This should resolve https://github.com/antonmedv/jsize/issues/18 (checkout both normal and verbose mode).

I messed with it for quite a while to get it to look decent, let me know what you think or if you have any ideas.

DylanPiercey commented 7 years ago

@antonmedv I ended up adding the 'package' header, uppercased the headers and removed the bold.

I tried adding the padding to the left however it strangely aligned the whole table :(.


Edit: I added a spacer character which seems to have fixed the issue, take a look now and tell me what you think.

DylanPiercey commented 7 years ago

I think I'm finally satisfied with this PR. However it also requires updated docs.

I was hoping ideally to also use gifs at this point. Would you mind reviewing this again and making gifs for the examples? I can then add to the PR.

antonmedv commented 7 years ago

Also what about separating to a few files in src dir?

DylanPiercey commented 7 years ago

I'll take another look into the '..' thing, what terminal are you using?

Also re separating it out I'm not sure it makes sense since this stuff is only used in the CLI

antonmedv commented 7 years ago

I'm using iTerm2.9.

You can pad without '..' and hidden stuff. Take a look:

logUpdate(createTable(table, { stringLength: stringWidth }).split('\n').map(s => '  ' + s).join('\n'))
DylanPiercey commented 7 years ago

@antonmedv I just updated the PR, it still works for me if I use 'hidden' spaces. If I don't make them hidden the alignment goes all weird in the OS X terminal. This should resolve the issues you had though.

antonmedv commented 7 years ago

Still don't know why you don't take my solution? 😀 It's less LOC and simple.

DylanPiercey commented 7 years ago

Used your solution and simplified things a bit.

antonmedv commented 7 years ago

Now no padding at all: image

DylanPiercey commented 7 years ago

Seems to be working in every term I have?