@kitschpatrol/tldraw-cli 2.2.1 → 2.2.3
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/cli.js +25 -35
- package/dist/lib/index.js +7 -19
- package/package.json +2 -3
- package/readme.md +18 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitschpatrol/tldraw-cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A tiny little CLI tool for rendering tldraw URLs and .tldr files into svg or png images.",
|
|
6
6
|
"repository": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@kitschpatrol/shared-config": "^4.3.3",
|
|
50
|
+
"@sindresorhus/slugify": "^2.2.1",
|
|
50
51
|
"@tldraw/assets": "2.0.0-beta.2",
|
|
51
52
|
"@tldraw/tldraw": "2.0.0-beta.2",
|
|
52
53
|
"@types/express": "^4.17.21",
|
|
53
54
|
"@types/react": "^18.2.48",
|
|
54
55
|
"@types/react-dom": "^18.2.18",
|
|
55
|
-
"@types/voca": "^1.4.5",
|
|
56
56
|
"@types/yargs": "^17.0.32",
|
|
57
57
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
58
58
|
"bumpp": "^9.3.0",
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"untildify": "^5.0.0",
|
|
70
70
|
"vite": "^5.0.11",
|
|
71
71
|
"vitest": "^1.2.1",
|
|
72
|
-
"voca": "^1.4.1",
|
|
73
72
|
"yargs": "^17.7.2"
|
|
74
73
|
},
|
|
75
74
|
"publishConfig": {
|
package/readme.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
This could be useful in the context of a content publishing pipeline where you want to use a `.tldr` file (perhaps under version control) as the "source of truth" for assets to be embedded elsewhere, and you don't want to manage the export of that diagram manually.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
_For `.tldr` file import support in Vite projects, please see [@kitschpatrol/vite-plugin-tldraw](https://github.com/kitschpatrol/vite-plugin-tldraw)._
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -21,13 +21,13 @@ npx @kitschpatrol/tldraw-cli some-file.tldr
|
|
|
21
21
|
...or install locally:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
npm
|
|
24
|
+
npm install --save-dev @kitschpatrol/tldraw-cli
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
...or install globally:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
30
|
-
npm
|
|
30
|
+
npm install --global @kitschpatrol/tldraw-cli
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Command line usage
|
|
@@ -42,18 +42,18 @@ tldraw-cli file-or-url {options}
|
|
|
42
42
|
| ------------- | ------------------------------------------------------------------------------------------------------- |
|
|
43
43
|
| `file-or-url` | The sketch to convert to an image — either a path to a local ".tldr" file, or a tldraw\.com sketch URL. |
|
|
44
44
|
|
|
45
|
-
| Option | Alias | Description Value
|
|
46
|
-
| --------------------- | ----- |
|
|
47
|
-
| `--format <svg\|png>` | `-f` | Output image format, one of `svg` or `png
|
|
48
|
-
| `--dark-mode ` | `-d` | Output a dark theme version of the image
|
|
49
|
-
| `--transparent ` | `-t` | Output an image with a transparent background
|
|
50
|
-
| `--output <string>` | `-o` | Output directory
|
|
51
|
-
| `--name <string>` | `-n` | Output file name without extension; by default the original file name or URL id is used
|
|
52
|
-
| `--frames <array?>` | | Export each sketch "frame" as a separate image, use the option flag alone to export all frames, or pass one or more frame names or IDs
|
|
53
|
-
| `--strip-style` | | Remove `<style>` elements from SVG output, useful to lighten the load of embedded fonts or if you are going to provide your own stylesheet for the SVG
|
|
54
|
-
| `--help ` | `-h` | Show help
|
|
55
|
-
| `--version` | `-v` | Show version number
|
|
56
|
-
| `--verbose` | | Enable verbose output
|
|
45
|
+
| Option | Alias | Description Value | Default Value |
|
|
46
|
+
| --------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |
|
|
47
|
+
| `--format <svg\|png>` | `-f` | Output image format, one of `svg` or `png`. | `svg` |
|
|
48
|
+
| `--dark-mode ` | `-d` | Output a dark theme version of the image. | `false` |
|
|
49
|
+
| `--transparent ` | `-t` | Output an image with a transparent background. | `false` |
|
|
50
|
+
| `--output <string>` | `-o` | Output directory. | `./` |
|
|
51
|
+
| `--name <string>` | `-n` | Output file name without extension; by default the original file name or URL id is used. | |
|
|
52
|
+
| `--frames <array?>` | | Export each sketch "frame" as a separate image, use the option flag alone to export all frames, or pass one or more frame names or IDs, slugified frame names will also match. | `false` |
|
|
53
|
+
| `--strip-style` | | Remove `<style>` elements from SVG output, useful to lighten the load of embedded fonts or if you are going to provide your own stylesheet for the SVG. | `false` |
|
|
54
|
+
| `--help ` | `-h` | Show help. | |
|
|
55
|
+
| `--version` | `-v` | Show version number. | |
|
|
56
|
+
| `--verbose` | | Enable verbose output. | `false` |
|
|
57
57
|
|
|
58
58
|
## Examples
|
|
59
59
|
|
|
@@ -202,9 +202,11 @@ On Discord:
|
|
|
202
202
|
|
|
203
203
|
## Implementation notes
|
|
204
204
|
|
|
205
|
+
This tool is not a part of the official tldraw project, and it is currently only tested and known to be compatible with tldraw 2.0.0-beta.2.\_
|
|
206
|
+
|
|
205
207
|
Due to the current implementation of tldraw, export depends on functionality provided by a web browser. So, behind the scenes, this app serves a local instance of tldraw, then loads a `.tldr` and invokes the export download via [Puppeteer](https://pptr.dev).
|
|
206
208
|
|
|
207
|
-
This can be a bit slow, (exporting seems to take a second or two), but in the context of a content pipeline it's not the end of the world.
|
|
209
|
+
This can be a bit slow, (exporting seems to take a second or two), but in the context of a statically-generated content pipeline it's not the end of the world.
|
|
208
210
|
|
|
209
211
|
In terms of Puppeteer vs. Playwright and other headless browser automation tools, it [looks like](https://www.checklyhq.com/blog/puppeteer-vs-selenium-vs-playwright-speed-comparison/) Puppeteer's performance likely compares favorably. (Though I have not tested and benchmarked the alternatives in the specific context of `tldraw-cli`.)
|
|
210
212
|
|