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-migration): Migrate Colorus-js codebase to TypeScript #23

Merged
merged 18 commits into from
Sep 2, 2024

Conversation

supitsdu
Copy link
Owner

@supitsdu supitsdu commented Sep 2, 2024

Description

This pull request marks the successful completion of the Colorus.js migration from JavaScript to TypeScript, as outlined in issue #19. The migration enhances code maintainability, readability, and developer experience by introducing static typing, improved tooling support, and a more structured codebase.

Branching Strategy and Merging

The migration followed the branching strategy outlined in issue #19:

  • main branch: Remains the production-ready branch, now containing the stable TypeScript version of the library.
  • feat/typescript-migration branch: Served as the central integration point for all TypeScript migration changes.
  • Sub-feature branches:
    • typescript-code-conversion: Handled the conversion of JavaScript files to TypeScript and the addition of type annotations.
    • update-build-system: Addressed changes to the build configuration for TypeScript compilation.
    • update-workflows: Updated automated workflows to accommodate TypeScript.
    • migrate-to-biome: Replaced ESLint and Prettier with Biome.js for linting and formatting.

Each sub-feature branch was merged into feat/typescript-migration after thorough review and testing. This PR now represents the final merge of feat/typescript-migration into main, completing the TypeScript migration process.

Key Changes and Benefits

  • Enhanced Type Safety: Static typing improves code reliability and helps catch errors early in development
  • Improved Tooling Support: The TypeScript codebase benefits from better code completion, type checking, and refactoring capabilities in modern IDEs
  • Facilitated Future Development: The more structured and type-safe codebase makes it easier to understand, maintain, and contribute to the project.
  • Major API Change: new Colorus() to dye(): The class-based new Colorus() instantiation has been replaced with a more functional and type-safe dye() function, simplifying the API and improving type inference

Additional Considerations

  • Breaking Changes:
    • While efforts were made to minimize breaking changes, some internal changes and type refinements might require minor adjustments in certain edge cases.
    • The documentation has been updated to guide users through any necessary changes.

Related Issues/PRs

Closes #19, Closes #15

…ons (#18)

* refact!: remove old js files

* feat!: major refactor and introduction of plugin system

- refactor: restructure file organization for improved clarity and maintainability
- feat: implement plugin system with enhanced TypeScript integration
- refactor!: rename Colorus class to Color
- feat: add defineColor helper function for simplified instance creation
- refactor: rename functions and variables for better readability and maintainability
- feat: expose ColorFormatter, parseColor, and isValidColor for public use
- refactor: separate parsing and serialization logic into distinct modules
- refactor: organize conversion functions into separate files based on color space
- refactor: move grayscale, mix, and invert methods into plugins
- feat: expose a few useful typescript types for public use

* refact!: ensure code structure works with new tests

* chore: update Jest config for TypeScript

* test: add new unit test written in TypeScript

* chore: clean up test files (remove unused comments and variables)
* chore: upload initial biome config

* chore!: remove old .eslintrc.json config

* lint: update files after running new lint config
#19) (#21)

* refact!: remove built-in plugins

Remove built-in plugins for the sake of improving separation of concerns, later we will add them as separate packages.

* chore(tsconfig): upload initial tsconfig.json file

* refact: fix issues reported by the new tsconfig.json

* chore: update deps and configs in package.json

* build: update build config

Automatically generate types declaration file, and use esbuild to generate more optimized JS ESNext bundles.

* refact!: clean and update types

* chore: update NPM ignore config file

* build(config): restruct the build process config

* build(tsconfig): improve tsconfig.json

* build: replace plugin to print bundle size

Because of some bugs with the rollup-plugin-output-size, I've decided to
go with a more simple alternative, the rollup-plugin-bundle-size.
- Improve type safety
- Refact colorFormatter.ts
- Rewrite unit tests
- Add new helper functions
…22)

* ci: update lint & format configs

* fix: upload linter fixes

* ci: add the Release workflow

* ci: upload dependabout.yml workflow

* ci: move dependabout.yml to .github/ folder
@supitsdu supitsdu added 📚 Documentation Improvements or additions to documentation ✨ Enhancement New feature or request ✅ Tests Apply this label to PRs or issues related to adding, updating, or fixing tests ♻️ Refactor Code refactoring, restructuring, or improving code quality without changing external behavior ⚙️ Configs Related to the project configs setup 💎 Code Quality Improving code style, maintainability, or performance 🛠️ Build Changes related to the build process. 🔄 Workflow Changes or updates to project workflows or CI/CD pipelines 👀 Under Review This issue or pull request is currently being reviewed. labels Sep 2, 2024
@supitsdu supitsdu self-assigned this Sep 2, 2024
@supitsdu supitsdu removed the 👀 Under Review This issue or pull request is currently being reviewed. label Sep 2, 2024
@supitsdu supitsdu merged commit c6a11c2 into main Sep 2, 2024
2 checks passed
@supitsdu supitsdu deleted the feat/typescript-migration branch September 2, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ Build Changes related to the build process. 💎 Code Quality Improving code style, maintainability, or performance ⚙️ Configs Related to the project configs setup 📚 Documentation Improvements or additions to documentation ✨ Enhancement New feature or request ♻️ Refactor Code refactoring, restructuring, or improving code quality without changing external behavior ✅ Tests Apply this label to PRs or issues related to adding, updating, or fixing tests 🔄 Workflow Changes or updates to project workflows or CI/CD pipelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate Colorus-js codebase to TypeScript Separate Parser Logic from serialize.js into parser.js
1 participant