Skip to content

Commit

Permalink
feat(typescript-migration): Migrate Colorus-js codebase to TypeScript (
Browse files Browse the repository at this point in the history
…#23)

* Migrate codebase to TypeScript - initial conversion and type annotations (#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)

* Migrate to Biome and remove ESLint  (#20)

* chore: upload initial biome config

* chore!: remove old .eslintrc.json config

* lint: update files after running new lint config

* Build System Update for Typescript Migration & Plugin Separation (Issue #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.

* refact!: Replace Color class with dye function

- Improve type safety
- Refact colorFormatter.ts
- Rewrite unit tests
- Add new helper functions

* docs(CONTRIBUTING): add contributing guidelines

* docs: Add comprehensive guide for working with plugins in Colorus.js

* docs: Update README.md with improved structure and examples

* ci: Add code quality workflow using Biome

* ci: Add NPM CI workflow for testing and building

* ci: Add GitHub Actions Workflows for CI/CD and Dependency Management (#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

* chore(linter): update biome.js included files prefs

* chore(scripts): improve package.json scripts

* fix: resolve linting errors reported by Biome

* ci: refact CI workflow for build & test

* ci: refact Code Quality workflow

* ci: fix name of linting script

* chore(package.json): bump version and update description

* refact(type): improve DyeReturns type
  • Loading branch information
supitsdu authored Sep 2, 2024
1 parent a72f467 commit c6a11c2
Show file tree
Hide file tree
Showing 79 changed files with 9,133 additions and 7,461 deletions.
15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Test & Build

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Display Node.js version
run: node -v

- name: Install dependencies
run: npm ci

- name: Cache node_modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Run linting
run: npm run lint

- name: Run type-checking
run: npm run check-types

- name: Run tests
run: npm test

- name: Build the package
run: npm run build
39 changes: 39 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Code Quality

on: [pull_request]

jobs:
quality:
name: Lint, Format & Organize

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Biome.js
uses: biomejs/setup-biome@v2
with:
version: latest

- name: Run linting
run: npm run lint

- name: Run docs formating
run: npm run format
54 changes: 0 additions & 54 deletions .github/workflows/node-ci.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
release:
types: [published]

jobs:
publish:
name: NPM Publish

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

permissions:
contents: read # Allow reading repository contents
id-token: write # Allow writing an OIDC token for authentication

steps:
- uses: actions/checkout@v4 # Check out the repository code

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build the project (if applicable)
run: npm run build --if-present

- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
coverage
src
test
build
mock
bun.lockb
.gitignore
Expand Down
18 changes: 9 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 140,
"trailingComma": "none",
"arrowParens": "avoid",
"bracketSpacing": true,
"quoteProps": "as-needed",
"endOfLine": "auto"
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"printWidth": 140,
"trailingComma": "none",
"arrowParens": "avoid",
"bracketSpacing": true,
"quoteProps": "as-needed",
"endOfLine": "auto"
}
Loading

0 comments on commit c6a11c2

Please sign in to comment.