@kitschpatrol/tldraw-cli 5.0.12 → 5.0.14
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/dist/.DS_Store +0 -0
- package/dist/bin/cli.js +3 -3
- package/dist/lib/index.d.ts +49 -3
- package/dist/lib/index.js +2 -2
- package/dist/tldraw/assets/index-DV6RkLqi.js +501 -0
- package/dist/tldraw/index.html +1 -1
- package/package.json +24 -17
- package/readme.md +5 -7
- package/dist/lib/inline/get-image.d.ts +0 -13
- package/dist/lib/inline/get-tldr.d.ts +0 -7
- package/dist/lib/local-tldraw-server.d.ts +0 -10
- package/dist/lib/tldraw-controller.d.ts +0 -22
- package/dist/lib/tldraw-open.d.ts +0 -12
- package/dist/lib/tldraw-to-image.d.ts +0 -18
- package/dist/lib/utilities/log.d.ts +0 -12
- package/dist/lib/validation.d.ts +0 -8
- package/dist/tldraw/assets/index-Dur5mwK7.js +0 -501
package/dist/tldraw/index.html
CHANGED
|
@@ -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 via tldraw-cli</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DV6RkLqi.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-DWlTSBfy.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": "5.0.
|
|
3
|
+
"version": "5.0.14",
|
|
4
4
|
"description": "A CLI tool and TypeScript library for exporting tldraw sketches to PNG or SVG images.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tldraw",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"dist/*"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@hono/node-server": "^1.19.
|
|
46
|
+
"@hono/node-server": "^1.19.12",
|
|
47
47
|
"@sindresorhus/slugify": "^3.0.0",
|
|
48
48
|
"@types/node": "^20.19.37",
|
|
49
49
|
"cheerio": "^1.2.0",
|
|
50
|
-
"get-port": "^7.
|
|
51
|
-
"hono": "^4.12.
|
|
50
|
+
"get-port": "^7.2.0",
|
|
51
|
+
"hono": "^4.12.9",
|
|
52
52
|
"nanoid": "^5.1.7",
|
|
53
53
|
"natural-orderby": "^5.0.0",
|
|
54
54
|
"open": "^11.0.0",
|
|
@@ -62,41 +62,48 @@
|
|
|
62
62
|
"yargs": "^18.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
+
"@arethetypeswrong/core": "^0.18.2",
|
|
66
|
+
"@blazediff/vitest": "^1.1.12",
|
|
65
67
|
"@fontsource/inter": "^5.2.8",
|
|
66
|
-
"@kitschpatrol/shared-config": "^
|
|
67
|
-
"@tldraw/assets": "^4.5.
|
|
68
|
+
"@kitschpatrol/shared-config": "^7.0.0",
|
|
69
|
+
"@tldraw/assets": "^4.5.6",
|
|
68
70
|
"@types/react": "^19.2.14",
|
|
69
71
|
"@types/react-dom": "^19.2.3",
|
|
70
72
|
"@types/yargs": "^17.0.35",
|
|
71
73
|
"@vitejs/plugin-react": "^6.0.1",
|
|
72
74
|
"bumpp": "^11.0.1",
|
|
73
|
-
"esbuild": "^0.27.
|
|
74
|
-
"mdat-plugin-cli-help": "^
|
|
75
|
-
"node-addon-api": "^8.
|
|
75
|
+
"esbuild": "^0.27.5",
|
|
76
|
+
"mdat-plugin-cli-help": "^2.0.0",
|
|
77
|
+
"node-addon-api": "^8.7.0",
|
|
76
78
|
"node-gyp": "^12.2.0",
|
|
79
|
+
"publint": "^0.3.18",
|
|
77
80
|
"react": "^19.2.4",
|
|
78
81
|
"react-dom": "^19.2.4",
|
|
79
82
|
"rolldown": "1.0.0-rc.10",
|
|
80
83
|
"safe-stable-stringify": "^2.5.0",
|
|
81
|
-
"sharp": "^0.34.5",
|
|
82
|
-
"sharp-phash": "^2.2.0",
|
|
83
84
|
"strip-ansi": "^7.2.0",
|
|
84
|
-
"tldraw": "^4.5.
|
|
85
|
-
"tsdown": "^0.21.
|
|
85
|
+
"tldraw": "^4.5.6",
|
|
86
|
+
"tsdown": "^0.21.7",
|
|
86
87
|
"tsx": "^4.21.0",
|
|
87
88
|
"typescript": "~5.9.3",
|
|
88
|
-
"vite": "^8.0.
|
|
89
|
-
"vitest": "^4.1.
|
|
89
|
+
"vite": "^8.0.3",
|
|
90
|
+
"vitest": "^4.1.2"
|
|
90
91
|
},
|
|
91
92
|
"engines": {
|
|
92
93
|
"node": ">=20.19.0"
|
|
93
94
|
},
|
|
95
|
+
"devEngines": {
|
|
96
|
+
"runtime": {
|
|
97
|
+
"name": "node",
|
|
98
|
+
"version": ">=22.18.0"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
94
101
|
"publishConfig": {
|
|
95
102
|
"access": "public"
|
|
96
103
|
},
|
|
97
104
|
"scripts": {
|
|
98
105
|
"build": "pnpm run build:tldraw && pnpm run build:src",
|
|
99
|
-
"build:src": "tsdown
|
|
106
|
+
"build:src": "tsdown",
|
|
100
107
|
"build:tldraw": "pnpm run tldraw:copy-assets && vite build",
|
|
101
108
|
"clean": "git rm -f pnpm-lock.yaml ; git clean -fdX",
|
|
102
109
|
"dev": "pnpm run dev:tldraw",
|
|
@@ -108,6 +115,6 @@
|
|
|
108
115
|
"release": "bumpp --commit 'Release: %s' && pnpm run build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') && pnpm publish",
|
|
109
116
|
"test": "vitest run",
|
|
110
117
|
"test:watch": "pnpm run build && vitest",
|
|
111
|
-
"tldraw:copy-assets": "
|
|
118
|
+
"tldraw:copy-assets": "pnpm tsx ./scripts/copy-assets.ts"
|
|
112
119
|
}
|
|
113
120
|
}
|
package/readme.md
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
<!--+ Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. +-->
|
|
2
|
-
|
|
3
1
|
<!-- title -->
|
|
4
2
|
|
|
5
3
|
# @kitschpatrol/tldraw-cli
|
|
6
4
|
|
|
7
5
|
<!-- /title -->
|
|
8
6
|
|
|
9
|
-
<!-- badges -->
|
|
10
|
-
|
|
11
7
|
[](https://npmjs.com/package/@kitschpatrol/tldraw-cli)
|
|
12
8
|
[](https://opensource.org/licenses/MIT)
|
|
13
|
-
|
|
14
|
-
<!-- /badges -->
|
|
9
|
+
[](https://github.com/kitschpatrol/tldraw-cli/actions/workflows/ci.yml)
|
|
15
10
|
|
|
16
11
|
<!-- description -->
|
|
17
12
|
|
|
@@ -48,6 +43,8 @@ A CLI app to automate conversion and export of [tldraw](https://tldraw.dev) URLs
|
|
|
48
43
|
|
|
49
44
|
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.
|
|
50
45
|
|
|
46
|
+
_Please note that this tool, which is all about image export, should not be confused with the official [tldraw project scaffolding CLI](https://www.npmjs.com/package/create-tldraw) which is all about creating new tldraw-powered projects._
|
|
47
|
+
|
|
51
48
|
_For `.tldr` file import support in Vite projects, please see [@kitschpatrol/vite-plugin-tldraw](https://github.com/kitschpatrol/vite-plugin-tldraw)._
|
|
52
49
|
|
|
53
50
|
## Installation
|
|
@@ -486,6 +483,7 @@ On GitHub:
|
|
|
486
483
|
- [AWS Lambda-based approach](https://gist.github.com/steveruizok/c30fc99b9b3d95a14c82c59bdcc69201)
|
|
487
484
|
- [Added exporting of shapes and pages as images](https://github.com/tldraw/tldraw/pull/468)
|
|
488
485
|
- [\[feature\] Copy/Share as PNG](https://github.com/tldraw/tldraw-v1/issues/361)
|
|
486
|
+
- [Create tldraw CLI tools](https://github.com/tldraw/tldraw/issues/7539)
|
|
489
487
|
|
|
490
488
|
On Discord:
|
|
491
489
|
|
|
@@ -494,7 +492,7 @@ On Discord:
|
|
|
494
492
|
|
|
495
493
|
## Implementation notes
|
|
496
494
|
|
|
497
|
-
This tool is
|
|
495
|
+
This tool is _not_ a part of the official tldraw project.
|
|
498
496
|
|
|
499
497
|
Due to the architecture 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 the [Puppeteer](https://pptr.dev) headless browser automation tool.
|
|
500
498
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Editor } from 'tldraw';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
editor: Editor;
|
|
5
|
-
getImage: (options: {
|
|
6
|
-
background?: boolean;
|
|
7
|
-
darkMode?: boolean;
|
|
8
|
-
format: 'png' | 'svg';
|
|
9
|
-
padding?: number;
|
|
10
|
-
scale?: number;
|
|
11
|
-
}) => Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { TldrawToImageOptions } from './tldraw-to-image.js';
|
|
2
|
-
export default class TldrawController {
|
|
3
|
-
private readonly href;
|
|
4
|
-
private browser?;
|
|
5
|
-
private isEmpty?;
|
|
6
|
-
private page?;
|
|
7
|
-
private get isLocal();
|
|
8
|
-
constructor(href: string);
|
|
9
|
-
close(): Promise<void>;
|
|
10
|
-
download(options: TldrawToImageOptions): Promise<string[]>;
|
|
11
|
-
start(): Promise<void>;
|
|
12
|
-
private getCurrentPage;
|
|
13
|
-
private getDownloadPlans;
|
|
14
|
-
private getPageFrames;
|
|
15
|
-
private getPages;
|
|
16
|
-
private getSketchStructure;
|
|
17
|
-
private setCurrentPage;
|
|
18
|
-
private stripStyleElement;
|
|
19
|
-
private stripUndefined;
|
|
20
|
-
private validateFrames;
|
|
21
|
-
private validatePages;
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
export type TldrawOpenOptions = {
|
|
3
|
-
location: 'local' | 'remote';
|
|
4
|
-
};
|
|
5
|
-
export type TldrawOpenResult = {
|
|
6
|
-
browserExitPromise: Promise<ChildProcess>;
|
|
7
|
-
openedSketchUrl: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Opens a tldraw file or URL in a browser.
|
|
11
|
-
*/
|
|
12
|
-
export declare function tldrawOpen(tldrPathOrUrl?: string, options?: Partial<TldrawOpenOptions>): Promise<TldrawOpenResult>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type TldrawFormat = 'png' | 'svg' | 'tldr';
|
|
2
|
-
export type TldrawToImageOptions = {
|
|
3
|
-
dark?: boolean;
|
|
4
|
-
format?: TldrawFormat;
|
|
5
|
-
frames?: boolean | string[];
|
|
6
|
-
name?: string;
|
|
7
|
-
output?: string;
|
|
8
|
-
padding?: number;
|
|
9
|
-
pages?: boolean | number[] | string[];
|
|
10
|
-
print?: boolean;
|
|
11
|
-
scale?: number;
|
|
12
|
-
stripStyle?: boolean;
|
|
13
|
-
transparent?: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Downloads a tldraw file or URL as an image.
|
|
17
|
-
*/
|
|
18
|
-
export declare function tldrawToImage(tldrPathOrUrl: string, options?: TldrawToImageOptions): Promise<string[]>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare const log: {
|
|
2
|
-
verbose: boolean;
|
|
3
|
-
log(...data: unknown[]): void;
|
|
4
|
-
logPrefixed(prefix: string, ...data: unknown[]): void;
|
|
5
|
-
info(...data: unknown[]): void;
|
|
6
|
-
infoPrefixed(prefix: string, ...data: unknown[]): void;
|
|
7
|
-
warn(...data: unknown[]): void;
|
|
8
|
-
warnPrefixed(prefix: string, ...data: unknown[]): void;
|
|
9
|
-
error(...data: unknown[]): void;
|
|
10
|
-
errorPrefixed(prefix: string, ...data: unknown[]): void;
|
|
11
|
-
};
|
|
12
|
-
export default log;
|
package/dist/lib/validation.d.ts
DELETED