@marcovega/svg-tidy 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/svg-tidy.js +11 -0
- package/package.json +4 -1
package/bin/svg-tidy.js
CHANGED
|
@@ -11,6 +11,17 @@ import {
|
|
|
11
11
|
toSvgoOptions,
|
|
12
12
|
} from '../lib/config.js';
|
|
13
13
|
|
|
14
|
+
// `npx` / `npm exec` chdir into the nearest enclosing project root before
|
|
15
|
+
// invoking the bin, which would make us scan the wrong directory. npm leaves
|
|
16
|
+
// the user's original working directory in INIT_CWD, so restore it.
|
|
17
|
+
if (process.env.INIT_CWD && process.env.INIT_CWD !== process.cwd()) {
|
|
18
|
+
try {
|
|
19
|
+
process.chdir(process.env.INIT_CWD);
|
|
20
|
+
} catch {
|
|
21
|
+
// INIT_CWD is unreachable; fall through with whatever cwd we have.
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
const HELP = `svg-tidy - optimize SVG files in place using SVGO
|
|
15
26
|
|
|
16
27
|
Usage:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marcovega/svg-tidy",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Optimize SVG icons in a directory using SVGO. Writes a .svgtidy.json config on first run so you can customize and commit settings per project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,5 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"bugs": {
|
|
42
42
|
"url": "https://github.com/marcovega/svg-tidy/issues"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
43
46
|
}
|
|
44
47
|
}
|