@kitschpatrol/tldraw-cli 1.3.0 → 2.0.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>tldraw export helper</title>
7
- <script type="module" crossorigin src="/assets/index-pvJwlX83.js"></script>
7
+ <script type="module" crossorigin src="/assets/index--JsGxma4.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Go1mR3Ch.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitschpatrol/tldraw-cli",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
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": {
@@ -48,7 +48,6 @@
48
48
  "devDependencies": {
49
49
  "@kitschpatrol/shared-config": "^4.3.3",
50
50
  "@tldraw/assets": "2.0.0-beta.2",
51
- "@tldraw/editor": "2.0.0-beta.2",
52
51
  "@tldraw/tldraw": "2.0.0-beta.2",
53
52
  "@types/express": "^4.17.21",
54
53
  "@types/react": "^18.2.48",
package/readme.md CHANGED
@@ -42,14 +42,15 @@ 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 | Description | Default |
46
- | --------------------- | ------------------------------------------------------------------------------------------------------- | ----------- |
47
- | `-f`, `--format` | Output image format , one of "png" or "svg". | `svg` |
48
- | `-t`, `--transparent` | When true, produces an image with a transparent background. If left undefined, project setting is used. | `undefined` |
49
- | `-o`, `--output` | Output image directory. | `./` |
50
- | `-h`, `--help` | Show help. | |
51
- | `-v`, `--version` | Show version number. | |
52
- | `--verbose` | Enable verbose output. | `false` |
45
+ | Option | Alias | Description | Default |
46
+ | --------------- | ----- | --------------------------------------------- | ----------- |
47
+ | `--format` | `-f` | Output image format, one of "png" or "svg" | `svg` |
48
+ | `--dark-mode` | `-d` | Output a dark theme version of the image |
49
+ | `--transparent` | `-t` | Output an image with a transparent background | `undefined` |
50
+ | `--output` | `-o` | Output directory | `./` |
51
+ | `--help` | `-h` | Show help | |
52
+ | `--version` | `-v` | Show version number | |
53
+ | `--verbose` | | Enable verbose output | `false` |
53
54
 
54
55
  ## Examples
55
56
 
@@ -89,10 +90,18 @@ npx @kitschpatrol/tldraw-cli your-drawing.tldr --output ~/Desktop
89
90
 
90
91
  The conversion tool's functionality is also exposed as a module for use in TypeScript or JavaScript Node projects.
91
92
 
92
- The library exports a single async function, `tldrawToImage` with the following type signature, mirroring the arguments available via the command line. The same default values apply:
93
+ The library exports a single async function, `tldrawToImage`, which takes an options argument mirroring the arguments available via the command line. The same default values apply:
93
94
 
94
95
  ```ts
95
- tldrawToImage(tldrPathOrUrl: string, format?: ExportFormat, destination?: string, verbose?: boolean): Promise<string>;
96
+ tldrawToImage(
97
+ tldrPathOrUrl: string,
98
+ {
99
+ darkMode?: boolean
100
+ output?: string
101
+ format?: ExportFormat
102
+ transparent?: boolean
103
+ verbose?: boolean
104
+ }): Promise<string>;
96
105
  ```
97
106
 
98
107
  The function exports the image in the requested format returns the full path to the output image.
@@ -104,8 +113,8 @@ Assuming you've installed `@kitschpatrol/tldraw-cli` locally in your project, it
104
113
 
105
114
  import { tldrawToImage } from '@kitschpatrol/tldraw-cli'
106
115
 
107
- // converting a local file
108
- const imagePathFromLocal = await tldrawToImage('./some-file.tldr', 'png', './', false)
116
+ // Converting a local file
117
+ const imagePathFromLocal = await tldrawToImage('./some-file.tldr', { format: 'png', output: './' })
109
118
 
110
119
  // Image saved to: "[...]/some-file.png"
111
120
  console.log(`Image saved to: "${imagePathFromLocal}"`)
@@ -142,7 +151,6 @@ The local instance of tldraw includes its assets dependencies, so the tool shoul
142
151
 
143
152
  This is a very minimal implementation. Current plans for future improvements include the following:
144
153
 
145
- - Switch to options object in Node API for 2.0
146
154
  - Add CLI tests
147
155
  - Implement the ability to export specific frames or pages as separate image files
148
156
  - Add an option flag to set dpi when exporting to a bitmap format