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

feat(typescript): convert to typescript #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xAndreiLi
Copy link

@xAndreiLi xAndreiLi commented Nov 8, 2024

This PR aims to convert this package to Typescript, allowing for both Javascript and Typescript projects to use it with added types for type-checking and IntelliSense.

Typescript was added as a dev dependency
File structure was changed to include src and build directories
tsc is used to transpile ts to js because of the package's simple output
ESLint was updated

Tests now use tsx and test index.ts in src
dist directory is gitignored and release runs build script
@types now matches installed dep versions (except for react)
types/react is installed @^18
react updated to 17

uses "exports" in package.json instead of main to supply built js and types
changed build dir to dist dir
changed target to es6 from 5 to remain at a version supporting all modern browsers
uses generic type for createReactSharedContext

enzyme testing replaced by vitest to upgrade react version
applied strict eslint rules
enforce prettier alongside eslint

@xAndreiLi xAndreiLi requested a review from a team as a code owner November 8, 2024 02:58
@CLAassistant
Copy link

CLAassistant commented Nov 8, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@Matthew-Mallimo Matthew-Mallimo left a comment

Choose a reason for hiding this comment

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

Can the tests not rely on the build output?

Also, since we now have a build step, its best not to include the build in the repo (add to .gitignore), and update the release workflow to have a build step.

package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@xAndreiLi xAndreiLi force-pushed the feat/typescript branch 4 times, most recently from 00aec0e to 6e48b3e Compare November 8, 2024 19:46
tsconfig.json Outdated Show resolved Hide resolved
@xAndreiLi xAndreiLi force-pushed the feat/typescript branch 2 times, most recently from e661365 to 6b834c8 Compare November 9, 2024 00:49
.github/workflows/release.yml Show resolved Hide resolved
package.json Show resolved Hide resolved
zacowan
zacowan previously approved these changes Dec 3, 2024
.eslintrc.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
@xAndreiLi xAndreiLi force-pushed the feat/typescript branch 3 times, most recently from 017e34a to febd8ef Compare December 10, 2024 20:17
alnaranjo
alnaranjo previously approved these changes Dec 12, 2024
.gitignore Outdated Show resolved Hide resolved
vite.config.ts Outdated Show resolved Hide resolved
__tests__/setup.ts Outdated Show resolved Hide resolved
update tests to tsx
match types version with dep versions
generic type
change to main/types to exports
change build to dist
change target to es6
update types/react to 18 to provide modern context type
switched to vitest and react-testing-library
updated to stricter eslint
update to react@17
install and enforce prettier during testing

fixed snapshot

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

Successfully merging this pull request may close these issues.

7 participants