Skip to content

Commit

Permalink
Add deprecation warnings. (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkenny54 authored Oct 3, 2024
1 parent 09d3e5e commit 6b0d646
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function makeProgram(program) {
.option('--no-color', 'Output plain text without color')
.option(
'-p, --precision <INTEGER>',
'Set number of digits in the fractional part, overrides plugins params',
'DEPRECATED. Set number of digits in the fractional part, overrides plugins params',
)
.action(action);
}
Expand Down Expand Up @@ -240,7 +240,12 @@ async function action(args, opts, command) {
}
if (opts.multipass) {
console.warn(
'The --multipass option is deprecated. Use --max-passes instead.',
'The --multipass option is deprecated and will be removed in a future release. Use --max-passes instead.',
);
}
if (opts.precision) {
console.warn(
'The --precision option is deprecated and will be removed in a future release.',
);
}

Expand Down
8 changes: 8 additions & 0 deletions plugins/moveGroupAttrsToElems.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const description =

const pathElemsWithGroupsAndText = [...pathElems, 'g', 'text'];

let deprecationWarning = true;

/**
* Move group attrs to the content elements.
*
Expand All @@ -26,6 +28,12 @@ const pathElemsWithGroupsAndText = [...pathElems, 'g', 'text'];
* @type {import('./plugins-types.js').Plugin<'moveGroupAttrsToElems'>}
*/
export const fn = () => {
if (deprecationWarning) {
console.warn(
'The moveGroupAttrsToElems plugin is deprecated and will be removed in a future release.',
);
deprecationWarning = false;
}
return {
element: {
enter: (node) => {
Expand Down

0 comments on commit 6b0d646

Please sign in to comment.