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

Refactor using typescript, while supporting esm/cjs #24

Closed
wants to merge 6 commits into from
Closed

Refactor using typescript, while supporting esm/cjs #24

wants to merge 6 commits into from

Conversation

rxliuli
Copy link

@rxliuli rxliuli commented May 10, 2021

The specific changes are as follows

  • build: Remove xo --fix from the format command, it will change the semantics of the typescript code, ref、
    image
  • build: Update gitignore to exclude the .idea directory automatically generated by the IDE and the dist directory generated after packaging
  • build: Modify packaging related functions to rollup, and support cjs/esm at the same time
  • refactor: Refactor the test file to ts, use jest instead of tape, modify tsconfig to support default import
  • refactor: Refactor the code into ts implementation and use String.prototype.repeat() instead of repeat-string npm package

…ototype.repeat()` instead of `repeat-string` npm package
…generated by the IDE and the dist directory generated after packaging
…ring mode, which causes the process to fail to end, and transfer it to the dev script
@wooorm
Copy link
Owner

wooorm commented May 10, 2021

Appreciate you working on markdown-table but:

  • Being ESM-only is intentional
  • I also intentionally use JS and tape instead of TS and Jest

Your fix of duplicate delimiterStart is a nice catch, and using String#repeat too. I would appreciate those fixes on their own!

@wooorm wooorm closed this May 10, 2021
@rxliuli
Copy link
Author

rxliuli commented May 10, 2021

Being ESM-only is intentional

Why? This will cause it to explode when used in jest tests(I used import), and it is not difficult to support cjs. . .

I also intentionally use JS and tape instead of TS and Jest

Obviously, .d.ts is already provided in the project, why not refactor to ts in one go? Again, this is not a trouble, my modification is only to add MarkdownTableOption

@wooorm
Copy link
Owner

wooorm commented May 10, 2021

Why? This will cause it to explode when used in jest tests(I used import), and it is not difficult to support cjs. . .

Obviously, .d.ts is already provided in the project, why not refactor to ts in one go?

Because I also had all my projects in CoffeeScript and its a ton of work to change language every couple of years.
I like JavaScript. I want to write JavaScript. I want code to run not to compile. I dislike that one company owns typescript

@rxliuli
Copy link
Author

rxliuli commented May 10, 2021

jest esm support is not complete, I will re-release a new package...

ref: https://jestjs.io/docs/ecmascript-modules

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

Successfully merging this pull request may close these issues.

2 participants