Skip to content

Commit

Permalink
removing pngjs and just using jimp everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
catdad committed Apr 27, 2024
1 parent f9683c1 commit da86b86
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"lodash": "^4.17.21",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"pngjs": "^5.0.0",
"tempy": "^0.6.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/bin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('app-icon-maker CLI', () => {

const buffer = await fs.readFile(path.resolve(outdir, `${size}x${size}.png`));
expect(await type.fromBuffer(buffer)).to.deep.equal({ ext: 'png', mime: 'image/png' });
const { width, height, depth } = png.read(buffer);
const { width, height, depth } = await png(buffer);

expect(width).to.equal(size);
expect(height).to.equal(size);
Expand All @@ -163,7 +163,7 @@ describe('app-icon-maker CLI', () => {
for (let size of pngSizes) {
const buffer = await fs.readFile(path.resolve(outdir, `${size}x${size}.png`));
expect(await type.fromBuffer(buffer)).to.deep.equal({ ext: 'png', mime: 'image/png' });
const { width, height, depth } = png.read(buffer);
const { width, height, depth } = await png(buffer);

expect(width).to.equal(size);
expect(height).to.equal(size);
Expand Down
2 changes: 1 addition & 1 deletion test/generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('app-icon-maker API generateIcons', () => {
]);

for (let size of pngSizes) {
const { width, height, depth } = png.read(icons[`${size}x${size}.png`]);
const { width, height, depth } = await png(icons[`${size}x${size}.png`]);

expect(width).to.equal(size);
expect(height).to.equal(size);
Expand Down
3 changes: 2 additions & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ const crypto = require('crypto');
const path = require('path');

const { expect } = require('chai');
const { sync: png } = require('pngjs').PNG;
const jimp = require('jimp');
const type = require('file-type');
const svgRender = require('svg-render');

const png = async buffer => (await jimp.read(buffer)).bitmap;

const svg = '<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="5" fill="pink"/></svg>';
const layers = [svg, `<svg viewBox="0 0 500 500">
<ellipse cx="183" cy="155.5" rx="45" ry="33.5" style="fill:rgb(146,255,0);"/>
Expand Down
2 changes: 1 addition & 1 deletion test/maker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('app-icon-maker API filesystem icons', () => {
for (let size of pngSizes) {
const buffer = await fs.readFile(path.resolve(destination, `${size}x${size}.png`));
expect(await type.fromBuffer(buffer)).to.deep.equal({ ext: 'png', mime: 'image/png' });
const { width, height, depth } = png.read(buffer);
const { width, height, depth } = await png(buffer);

expect(width).to.equal(size);
expect(height).to.equal(size);
Expand Down

0 comments on commit da86b86

Please sign in to comment.