Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/codebattle/assets/js/__tests__/RootContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import task from '../widgets/machines/task';
import RootContainer from '../widgets/pages/RoomWidget';
import reducers from '../widgets/slices';

vi.mock('pixelmatch', () => ({ default: () => {} }));
vi.mock('@blazediff/core', () => ({ default: () => {} }));

vi.mock('monaco-editor', () => ({
editor: {
Expand Down
6 changes: 3 additions & 3 deletions apps/codebattle/assets/js/widgets/lib/cssbattle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pixelmatch from 'pixelmatch';
import blazediff from '@blazediff/core';

const diffThreshold = 0.1;

Expand Down Expand Up @@ -74,15 +74,15 @@ export const matchBattlePictures = (
const firstDiff = firstDiffContext.createImageData(width, height);
const secondDiff = secondDiffContext.createImageData(width, height);

const firstStats = pixelmatch(
const firstStats = blazediff(
firstDataImg.data,
targetDataImg.data,
firstDiff.data,
width,
height,
{ threshold: diffThreshold },
);
const secondStats = pixelmatch(
const secondStats = blazediff(
secondDataImg.data,
targetDataImg.data,
secondDiff.data,
Expand Down
2 changes: 1 addition & 1 deletion apps/codebattle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@blazediff/core": "1.9.3",
"@dnd-kit/core": "^6.3.1",
"@ebay/nice-modal-react": "^1.2.13",
"@emoji-mart/data": "^1.2.1",
Expand Down Expand Up @@ -73,7 +74,6 @@
"phoenix": "^1.8.7",
"phoenix_html": "^4.3.0",
"phoenix_live_view": "^1.1.31",
"pixelmatch": "^7.2.0",
"popper.js": "^1.16.1",
"process": "^0.11.10",
"prop-types": "^15.8.1",
Expand Down
47 changes: 19 additions & 28 deletions apps/codebattle/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/runner/images/css/checker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync, writeFileSync } from 'fs';
import pixelmatch from 'pixelmatch';
import blazediff from '@blazediff/core';
import LZString from 'lz-string';
import nodeHtmlToImage from 'node-html-to-image';
import { PNG } from 'pngjs';
Expand Down Expand Up @@ -61,7 +61,7 @@ const run = function run(args = []) {
const targetImgDataUri = `data:${mime};${encoding},${targetImageBuffer.toString(encoding)}`;

try {
const stats = pixelmatch(solutionImg.data, targetImg.data, diff.data, width, height, { threshold: 0.1 });
const stats = blazediff(solutionImg.data, targetImg.data, diff.data, width, height, { threshold: 0.1 });
const match = getMatchPoints(stats, width, height);
const matchPercentage = getMatchPercentageText(match);
const diffBuffer = PNG.sync.write(diff);
Expand Down
22 changes: 8 additions & 14 deletions apps/runner/images/css/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/runner/images/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"js-yaml": "^4.1.1"
},
"dependencies": {
"@blazediff/core": "1.9.3",
"@types/node": "^20.11.25",
"lz-string": "^1.5.0",
"node-html-to-image": "^5.0.0",
"pixelmatch": "^6.0.0",
"pngjs": "^7.0.0"
}
}