Skip to content

Commit

Permalink
Merge pull request #3 from zacharyarney/v0.1.0
Browse files Browse the repository at this point in the history
V0.1.0 tests and GitHub actions
  • Loading branch information
zacharyarney authored Jul 11, 2024
2 parents 6da01e7 + 9e072c4 commit 274e529
Show file tree
Hide file tree
Showing 13 changed files with 6,608 additions and 1,633 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:import/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs', '*.config.ts', '*.config.js'],
parser: '@typescript-eslint/parser',
Expand All @@ -15,4 +16,25 @@ module.exports = {
tsconfigRootDir: __dirname,
},
plugins: ['prettier'],
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.js'],
},
},
},
overrides: [
{
files: ['*.test.ts', '*.spec.ts'],
plugins: ['jest'],
rules: {
// you should turn the original rule off *only* for test files
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
},
],
rules: {
'@typescript-eslint/unbound-method': 'error',
},
};
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Tests

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

jobs:
build:

runs-on: ubuntu-latest

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

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

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm ci

- name: Run Build
run: npm run build

- name: Lint Check
run: npm run lint --if-present

- name: Validate tests
run: npm run test --if-present
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"useTabs": false
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The histogram algorithm sorts the pixels in an image into sectors in a 3D grid b
the average RGB value for each sector in order of sector density.

Some reasonable default parameters are provided for the histogram generation process. The number of sectors can be
increased using the `dimensionscs` parameter for greater color accuracy and the size of the color palette can be
increased using the `dimensions` parameter for greater color accuracy and the size of the color palette can be
adjusted with the `paletteSize` parameter.

## Todo
Expand All @@ -42,6 +42,7 @@ adjusted with the `paletteSize` parameter.

- Currently requires Node.js runtime. Browser support is on the todo list.
- Doesn't yet support transparency and will ignore alpha channels when generating color palette, meaning that the color
palette will include RGB values for transparent pixels.
palette will include RGB values for transparent pixels which could lead to unexpected results when generating palettes
for images with transparency.
- The palette is stored as an array of objects with `r`, `g`, and `b` properties. This may be subject to change in the
future.
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
testEnvironment: 'node',
transform: {
'^.+.tsx?$': ['ts-jest', {}],
},
};
Loading

0 comments on commit 274e529

Please sign in to comment.