Skip to content

Commit

Permalink
Several tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Jul 22, 2023
1 parent 925c911 commit c568acb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Expand Up @@ -10,16 +10,16 @@ jobs:
fail-fast: false
matrix:
node-version:
- 12
- 14
- 16
- 18
- 20
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -6,7 +6,7 @@ const imageminSvgo = options => async buffer => {
options = {multipass: true, ...options};

if (!isSvg(buffer)) {
return Promise.resolve(buffer);
return buffer;
}

if (Buffer.isBuffer(buffer)) {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/sindresorhus/imagemin-svgo?sponsor=1"
},
"engines": {
"node": ">=12.20"
"node": ">=16"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -28,11 +28,11 @@
"svgo"
],
"dependencies": {
"is-svg": "^4.3.1",
"svgo": "^2.5.0"
"is-svg": "^5.0.0",
"svgo": "^3.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"xo": "^0.44.0"
"ava": "^5.3.1",
"xo": "^0.55.0"
}
}
2 changes: 1 addition & 1 deletion readme.md
@@ -1,4 +1,4 @@
# imagemin-svgo ![GitHub Actions Status](https://github.com/imagemin/imagemin-svgo/workflows/test/badge.svg?branch=master)
# imagemin-svgo ![GitHub Actions Status](https://github.com/imagemin/imagemin-svgo/workflows/test/badge.svg?branch=main)

> [SVGO](https://github.com/svg/svgo) imagemin plugin
Expand Down
10 changes: 5 additions & 5 deletions test.js
Expand Up @@ -2,22 +2,22 @@ import test from 'ava';
import imageminSvgo from './index.js';

test('optimize a SVG', async t => {
const data = (await imageminSvgo()('<svg><script></script></svg>')).toString();
const buffer = await imageminSvgo()('<svg><script></script></svg>');

t.is(data, '<svg><script/></svg>');
t.is(buffer.toString(), '<svg><script/></svg>');
});

test('support SVGO options', async t => {
const data = (await imageminSvgo({
const buffer = await imageminSvgo({
plugins: [{
name: 'preset-default',
}, {
name: 'removeScriptElement',
active: true,
}],
})('<svg><script></script></svg>')).toString();
})('<svg><script></script></svg>');

t.is(data, '<svg/>');
t.is(buffer.toString(), '<svg/>');
});

// Failing as SVGO doesn't throw proper errors...
Expand Down

0 comments on commit c568acb

Please sign in to comment.