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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to TypeScript #147

Merged
merged 1 commit into from
Apr 19, 2021
Merged

Migrate to TypeScript #147

merged 1 commit into from
Apr 19, 2021

Conversation

nam-hle
Copy link
Collaborator

@nam-hle nam-hle commented Apr 15, 2021

This PR is for migrating the package to TypeScript (#146) with major changes (but should not contain breaking changes 馃檹):

  • Remove/replace all flow and babel packages/commands
  • Remove unnecessary JSdocs
  • Expose type declarations. The users would not need to @types/table now.
  • Reduce the unpacked size by 24% (112.4 kB now), the number of shipped files by 42% (33 files now)

Additionally, the schema definitions could generate from type definitions with third-party libraries like ts-json-schema-generator. By doing that, we can safely remove most of the checking code lines and maybe primitive type checking package like is-boolean, is-number,... But of course, we should do it later :D

@coveralls
Copy link

coveralls commented Apr 15, 2021

Pull Request Test Coverage Report for Build 279

  • 154 of 154 (100.0%) changed or added relevant lines in 24 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.1%) to 100.0%

Totals Coverage Status
Change from base Build 277: 1.1%
Covered Lines: 345
Relevant Lines: 345

馃挍 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 266

  • 88 of 88 (100.0%) changed or added relevant lines in 23 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.2%) to 97.718%

Totals Coverage Status
Change from base Build 264: -1.2%
Covered Lines: 346
Relevant Lines: 349

馃挍 - Coveralls

.eslintrc Outdated Show resolved Hide resolved
@nam-hle nam-hle marked this pull request as ready for review April 17, 2021 07:33

const config = makeConfig(rows, userConfig);

rows = truncateTableData(rows, config);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version is:

rows = truncateTableData(data, config);

But I think it is a suitable modification :)

Comment on lines +27 to +41
const openRed = '\u001b[31m';
const closeRed = '\u001b[39m';
describe('subject is lesser than the chunk size', () => {
it.skip('returns subject in a single chunk', () => {
expect(wrapString(chalk.red('aaa'), 3)).to.deep.equal([
'\u001B[31m\u001B[31m\u001B[31m\u001B[31m\u001B[31maaa\u001B[39m',
it('returns subject in a single chunk', () => {
expect(wrapString(`${openRed}aa${closeRed}`, 3)).to.deep.equal([
`${openRed}aa${closeRed}`,
]);
});
});
describe('subject is larger than the chunk size', () => {
it.skip('returns subject sliced into multiple chunks', () => {
expect(wrapString(chalk.red('aaabbbc'), 3)).to.deep.equal([
'\u001B[31m\u001B[31m\u001B[31m\u001B[31m\u001B[31maaa\u001B[39m',
'\u001B[31m\u001B[31m\u001B[31m\u001B[31m\u001B[31mbbb\u001B[39m',
'\u001B[31m\u001B[31m\u001B[31m\u001B[31m\u001B[31mc\u001B[39m',
it('returns subject sliced into multiple chunks', () => {
expect(wrapString(`${openRed}aaabbbc${closeRed}`, 3)).to.deep.equal([
`${openRed}aaa${closeRed}`,
`${openRed}bbb${closeRed}`,
`${openRed}c${closeRed}`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for the unexpected behaviors of chalk while testing.

@gajus gajus merged commit 803fe15 into gajus:master Apr 19, 2021
@gajus
Copy link
Owner

gajus commented Apr 19, 2021

馃コ

@gajus
Copy link
Owner

gajus commented Apr 19, 2021

馃帀 This PR is included in version 6.3.0 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

@gajus gajus added the released label Apr 19, 2021
@nam-hle
Copy link
Collaborator Author

nam-hle commented Apr 19, 2021

Awesome 馃ぉ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants