@svgsketch/cli 0.3.0 → 0.4.0
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/README.md +34 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +127 -0
- package/package.json +18 -6
package/README.md
CHANGED
|
@@ -11,7 +11,8 @@ npm install -g @svgsketch/cli
|
|
|
11
11
|
## Commands
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
svgsketch import <input.svg> -o <output.svgs>
|
|
14
|
+
svgsketch import <input.svg|.ai|.pdf|.eps> -o <output.svgs>
|
|
15
|
+
svgsketch convert <input.svg|.ai|.pdf|.eps|.svgs> -o <output.svg>
|
|
15
16
|
svgsketch validate <input>
|
|
16
17
|
svgsketch render <input> -o <output.svg>
|
|
17
18
|
svgsketch info <input>
|
|
@@ -25,6 +26,15 @@ svgsketch codegen <input> -f <svg|react|vue|d3|css>
|
|
|
25
26
|
# Import foreign SVG into the native document format
|
|
26
27
|
svgsketch import artwork.svg -o artwork.svgs
|
|
27
28
|
|
|
29
|
+
# Import an Illustrator file, keeping text editable, with a JSON report
|
|
30
|
+
svgsketch import poster.ai -o poster.svgs --report poster-report.json
|
|
31
|
+
|
|
32
|
+
# Import pages 1 and 3 of a PDF with text converted to outlines
|
|
33
|
+
svgsketch import brochure.pdf -o brochure.svgs --artboards 1,3 --text outline
|
|
34
|
+
|
|
35
|
+
# Convert an Illustrator file straight to plain SVG
|
|
36
|
+
svgsketch convert poster.ai -o poster.svg --background white
|
|
37
|
+
|
|
28
38
|
# Validate a document
|
|
29
39
|
svgsketch validate design.svgs
|
|
30
40
|
|
|
@@ -38,9 +48,30 @@ svgsketch codegen icon.svgs -f react -o Icon.tsx --name Icon --typescript
|
|
|
38
48
|
svgsketch codegen design.svgs -f css -o design-snippet.svg
|
|
39
49
|
```
|
|
40
50
|
|
|
51
|
+
## Illustrator, PDF and EPS input
|
|
52
|
+
|
|
53
|
+
`import` and `convert` read the first bytes of the input to decide its format.
|
|
54
|
+
The file extension is never trusted: a PDF saved as `.svg` is imported as a PDF, and a note on stderr says so.
|
|
55
|
+
Raster images are rejected, and `import` rejects `.svgs` input because it is already native.
|
|
56
|
+
|
|
57
|
+
An Illustrator file saved with "Create PDF Compatible File" carries a PDF rendition and its private Illustrator source.
|
|
58
|
+
The rendition provides the appearance and the source provides artboard names, layer names, lock state and hidden state.
|
|
59
|
+
Plain PDF files import their pages as artboards and their optional-content groups as layers.
|
|
60
|
+
A file saved without PDF content, or a PostScript-era `.ai` or `.eps` file, is refused with a message that says how to save it again.
|
|
61
|
+
|
|
62
|
+
| Option | Meaning |
|
|
63
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `--artboards <1,3\|all>` | Artboards (pages) to import, 1-based. Default `all`. Several artboards become one document with a `<view>` per artboard. |
|
|
65
|
+
| `--text <editable\|outline>` | Keep text editable (default) or convert every glyph to outlines. |
|
|
66
|
+
| `--hidden-layers <import\|skip>` | Import hidden layers as hidden (default) or leave them out. |
|
|
67
|
+
| `--report <file.json>` | Write the import report: what was preserved, approximated, rasterized or dropped, the fonts the document needs, and the timings. |
|
|
68
|
+
|
|
69
|
+
Transcoder diagnostics print to stderr as `severity: pdf:code: message` and `severity: illustrator:code: message` lines beside the ingest diagnostics.
|
|
70
|
+
`--fail-on-warnings` counts them along with the ingest warnings.
|
|
71
|
+
|
|
41
72
|
## Render diagnostics
|
|
42
73
|
|
|
43
|
-
`import`, `render`, and `codegen` report machine-readable diagnostics as `warning:` / `error:` lines on stderr.
|
|
74
|
+
`import`, `convert`, `render`, and `codegen` report machine-readable diagnostics as `warning:` / `error:` lines on stderr.
|
|
44
75
|
Import diagnostics also include their stable diagnostic code.
|
|
45
76
|
Malformed SVG never produces a partial `.svgs` file.
|
|
46
77
|
|
|
@@ -50,6 +81,7 @@ Pass `--fail-on-warnings` to these commands to exit with a nonzero status when a
|
|
|
50
81
|
|
|
51
82
|
```bash
|
|
52
83
|
svgsketch import artwork.svg -o artwork.svgs --fail-on-warnings
|
|
84
|
+
svgsketch convert poster.ai -o poster.svg --fail-on-warnings
|
|
53
85
|
svgsketch render design.svgs -o out.svg --fail-on-warnings
|
|
54
86
|
svgsketch codegen design.svgs -f react -o Icon.tsx --fail-on-warnings
|
|
55
87
|
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|