@bobfrankston/brother-label 1.0.13 → 1.1.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/cli.ts CHANGED
@@ -1,184 +1,301 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Brother Label Printer CLI
4
- * Thin wrapper around the API
5
- */
6
-
7
- import * as fs from "fs";
8
- import * as path from "path";
9
- import { program } from "commander";
10
- import {
11
- print,
12
- render,
13
- getConfig,
14
- setConfig,
15
- getConfigPath,
16
- listPrinters,
17
- TapeSize,
18
- PrintOptions,
19
- } from "./api.js";
20
-
21
- const VALID_TAPES: TapeSize[] = [6, 9, 12, 18, 24];
22
-
23
- function parseTape(value: string): TapeSize {
24
- const num = parseInt(value.replace("mm", ""), 10) as TapeSize;
25
- if (!VALID_TAPES.includes(num)) {
26
- throw new Error(`Invalid tape size: ${value}. Valid: 6, 9, 12, 18, 24`);
27
- }
28
- return num;
29
- }
30
-
31
- // Detect content type from input string
32
- function buildPrintOptions(input: string, opts: { tape?: string; printer?: string; text?: boolean; html?: boolean; image?: boolean; aspect?: string; height?: string }): PrintOptions {
33
- const options: PrintOptions = {};
34
-
35
- // Parse tape option
36
- if (opts.tape) {
37
- options.tape = parseTape(opts.tape);
38
- }
39
- if (opts.printer) {
40
- options.printer = opts.printer;
41
- }
42
- if (opts.aspect) {
43
- options.aspect = opts.aspect;
44
- }
45
- if (opts.height) {
46
- options.textHeight = opts.height;
47
- }
48
-
49
- // Explicit type flags override auto-detection
50
- if (opts.text) {
51
- options.text = input;
52
- return options;
53
- }
54
- if (opts.html) {
55
- options.htmlPath = path.resolve(input);
56
- return options;
57
- }
58
- if (opts.image) {
59
- options.imagePath = path.resolve(input);
60
- return options;
61
- }
62
-
63
- // Auto-detect content type
64
- const lower = input.toLowerCase();
65
- if (lower.endsWith(".html") || lower.endsWith(".htm")) {
66
- options.htmlPath = path.resolve(input);
67
- } else if (lower.endsWith(".txt")) {
68
- options.textFile = path.resolve(input);
69
- } else if (lower.endsWith(".png") || lower.endsWith(".jpg") || lower.endsWith(".jpeg") || lower.endsWith(".bmp") || lower.endsWith(".gif")) {
70
- options.imagePath = path.resolve(input);
71
- } else if (fs.existsSync(input)) {
72
- // Exists but unknown extension - try to detect
73
- const ext = path.extname(lower);
74
- if (ext === ".html" || ext === ".htm") {
75
- options.htmlPath = path.resolve(input);
76
- } else {
77
- // Assume text file
78
- options.textFile = path.resolve(input);
79
- }
80
- } else {
81
- // Treat as literal text
82
- options.text = input;
83
- }
84
-
85
- return options;
86
- }
87
-
88
- program
89
- .name("brother-print")
90
- .description("Print labels on Brother P-touch printers")
91
- .version("1.0.0");
92
-
93
- // Default command - print
94
- program
95
- .argument("[input]", "Text to print, or path to file (auto-detects type)")
96
- .option("-t, --tape <size>", "Tape size: 6, 9, 12, 18, 24 (mm)")
97
- .option("-p, --printer <name>", "Printer name")
98
- .option("-o, --output <file>", "Save to file instead of printing (png, jpg, bmp)")
99
- .option("-a, --aspect <ratio>", "Aspect ratio width:height for HTML (e.g., 3.5:2)")
100
- .option("-H, --height <size>", "Text height: 12mm, .5in, or 50% (of tape height)")
101
- .option("--text", "Force input as literal text")
102
- .option("--html", "Force input as HTML file path")
103
- .option("--image", "Force input as image file path")
104
- .action(async (input: string | undefined, opts) => {
105
- if (!input) {
106
- program.help();
107
- return;
108
- }
109
-
110
- try {
111
- const options = buildPrintOptions(input, opts);
112
-
113
- if (opts.output) {
114
- // Render only, save to file
115
- const buffer = await render(options);
116
- fs.writeFileSync(opts.output, buffer);
117
- console.log(`Saved to ${opts.output}`);
118
- } else {
119
- // Print
120
- const result = await print(options);
121
- const tape = options.tape ?? getConfig().defaultTape ?? 24;
122
- console.log(`Printed on ${tape}mm tape`);
123
- }
124
- } catch (err) {
125
- console.error(`Error: ${(err as Error).message}`);
126
- process.exit(1);
127
- }
128
- });
129
-
130
- // List printers
131
- program
132
- .command("list")
133
- .description("List available Brother printers")
134
- .action(async () => {
135
- try {
136
- const printers = await listPrinters();
137
- if (printers.length === 0) {
138
- console.log("No Brother printers found");
139
- } else {
140
- console.log("Brother printers:");
141
- printers.forEach(p => console.log(` ${p.name}`));
142
- }
143
- } catch (err) {
144
- console.error(`Error: ${(err as Error).message}`);
145
- process.exit(1);
146
- }
147
- });
148
-
149
- // Config
150
- program
151
- .command("config")
152
- .description("Show or set configuration")
153
- .option("-t, --tape <size>", "Set default tape size: 6, 9, 12, 18, 24 (mm)")
154
- .option("-p, --printer <name>", "Set default printer name")
155
- .action((opts) => {
156
- try {
157
- if (!opts.tape && !opts.printer) {
158
- // Show config
159
- const config = getConfig();
160
- console.log("Configuration:");
161
- console.log(` File: ${getConfigPath()}`);
162
- console.log(` Default tape: ${config.defaultTape ? config.defaultTape + "mm" : "(not set)"}`);
163
- console.log(` Default printer: ${config.defaultPrinter ?? "(not set)"}`);
164
- console.log("\nValid tape sizes: 6, 9, 12, 18, 24");
165
- return;
166
- }
167
-
168
- if (opts.tape) {
169
- const tape = parseTape(opts.tape);
170
- setConfig({ defaultTape: tape });
171
- console.log(`Default tape set to: ${tape}mm`);
172
- }
173
-
174
- if (opts.printer) {
175
- setConfig({ defaultPrinter: opts.printer });
176
- console.log(`Default printer set to: ${opts.printer}`);
177
- }
178
- } catch (err) {
179
- console.error(`Error: ${(err as Error).message}`);
180
- process.exit(1);
181
- }
182
- });
183
-
184
- program.parse();
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Brother Label Printer CLI
4
+ * Thin wrapper around api.ts using shared CLI primitives from label-core.
5
+ */
6
+
7
+ import * as fs from "fs";
8
+ import * as path from "path";
9
+ import {
10
+ preprocessSingleQuotes,
11
+ parseArgs,
12
+ PrintOptions as CorePrintOptions,
13
+ PrinterStatus,
14
+ Segment,
15
+ ValuedOptionSpec,
16
+ BooleanFlagSpec,
17
+ } from "@bobfrankston/label-core";
18
+ import {
19
+ print,
20
+ render,
21
+ renderSegments,
22
+ printSegments,
23
+ getConfig,
24
+ setConfig,
25
+ getConfigPath,
26
+ listPrinters,
27
+ detectTapeSize,
28
+ brotherPrinter,
29
+ TapeSize,
30
+ PrintOptions,
31
+ SegmentOptions,
32
+ } from "./api.js";
33
+
34
+ const VERSION = "1.1.0";
35
+ const VALID_TAPES: TapeSize[] = [6, 9, 12, 18, 24];
36
+
37
+ function parseTape(value: string): TapeSize {
38
+ const num = parseInt(value.replace("mm", ""), 10) as TapeSize;
39
+ if (!VALID_TAPES.includes(num)) {
40
+ throw new Error(`Invalid tape size: ${value}. Valid: ${VALID_TAPES.join(", ")}`);
41
+ }
42
+ return num;
43
+ }
44
+
45
+ const VALUED: ValuedOptionSpec[] = [
46
+ { names: ["-tape"], key: "tape" },
47
+ { names: ["-p", "-printer"], key: "printer" },
48
+ { names: ["-o", "-output"], key: "output" },
49
+ { names: ["-a", "-aspect"], key: "aspect" },
50
+ { names: ["-H", "-height"], key: "height" },
51
+ { names: ["-s", "-space"], key: "space" },
52
+ { names: ["-timeout"], key: "timeout" },
53
+ { names: ["-interval"], key: "interval" },
54
+ ];
55
+
56
+ const BOOLEAN: BooleanFlagSpec[] = [
57
+ { names: ["-w", "-html"], key: "html" },
58
+ { names: ["-i", "-image"], key: "image" },
59
+ { names: ["-t"], key: "text" },
60
+ { names: ["-c", "-clip"], key: "clip" },
61
+ { names: ["-no-wait", "-nowait"], key: "nowait" },
62
+ { names: ["-help", "-h", "-?"], key: "help" },
63
+ { names: ["-version", "-v"], key: "version" },
64
+ ];
65
+
66
+ const SUBCOMMANDS = ["list", "status", "config"];
67
+
68
+ function showHelp(): void {
69
+ console.log(`Brother Label Printer CLI v${VERSION}
70
+
71
+ Usage:
72
+ brother-print [options] <text> Print text
73
+ brother-print [options] <file> Print html/txt/image file (auto-detected)
74
+ brother-print -clip [options] Print clipboard contents (image or text)
75
+ brother-print -text <v> -qr <v> ... Print ordered text/qr segments
76
+ brother-print list List Brother printers and status
77
+ brother-print status [-p <name>] Show printer status
78
+ brother-print config Show / set defaults
79
+
80
+ Tape size is auto-detected from the printer. Use -tape to override.
81
+ Single quotes can wrap arguments: '7"' 'line1\\nline2'
82
+
83
+ Options:
84
+ -tape <size> Tape size: 6, 9, 12, 18, 24 (mm) [auto-detected]
85
+ -p, -printer <name> Printer queue name
86
+ -o, -output <file> Save PNG to file instead of printing
87
+ -a, -aspect <r> Aspect ratio width:height for HTML (e.g. 3.5:2)
88
+ -H, -height <size> Text height: 12mm, .5in, or 50% (of tape height)
89
+ -s, -space <size> Space between segments: 12px, 1mm, .2in
90
+ -t, -text Force input as literal text (-text <v> for segments)
91
+ -qr <data> QR code segment
92
+ -w, -html Force input as HTML file path
93
+ -i, -image Force input as image file path
94
+ -c, -clip Read content from clipboard (image preferred, then text)
95
+ -no-wait Fail immediately if printer is offline (default: wait)
96
+ -timeout <secs> Max wait time when printer is offline
97
+ -interval <secs> Polling interval while waiting (default 2)
98
+ -help Show this help
99
+ -version Show version`);
100
+ }
101
+
102
+ async function main(): Promise<void> {
103
+ const argv = preprocessSingleQuotes(process.argv.slice(2));
104
+ let parsed;
105
+ try {
106
+ parsed = parseArgs(argv, VALUED, BOOLEAN, SUBCOMMANDS);
107
+ } catch (e: any) {
108
+ console.error(`Error: ${e.message}`);
109
+ process.exit(1);
110
+ }
111
+
112
+ if (parsed.unknown.length > 0) {
113
+ console.error(`Unknown option(s): ${parsed.unknown.join(", ")}`);
114
+ console.error(`Run "brother-print -help" for usage.`);
115
+ process.exit(1);
116
+ }
117
+
118
+ if (parsed.opts.help) { showHelp(); return; }
119
+ if (parsed.opts.version) { console.log(VERSION); return; }
120
+
121
+ try {
122
+ switch (parsed.command) {
123
+ case "list": await cmdList(); return;
124
+ case "status": await cmdStatus(parsed.opts); return;
125
+ case "config": await cmdConfig(parsed.opts); return;
126
+ }
127
+ await cmdPrint(parsed.opts, parsed.segments, parsed.inputs);
128
+ } catch (e: any) {
129
+ console.error(`Error: ${e.message}`);
130
+ process.exit(1);
131
+ }
132
+ }
133
+
134
+ async function cmdList(): Promise<void> {
135
+ const printers = await listPrinters();
136
+ if (printers.length === 0) {
137
+ console.log("No Brother printers found.");
138
+ return;
139
+ }
140
+ console.log(`Brother printers (${printers.length}):`);
141
+ for (const p of printers) {
142
+ let statusStr = "?";
143
+ try {
144
+ const s = await brotherPrinter.getStatus(p.name);
145
+ statusStr = s.online ? "online" : `offline (${s.statusText}${s.error ? ", " + s.error : ""})`;
146
+ } catch (e: any) {
147
+ statusStr = `status error: ${e.message}`;
148
+ }
149
+ console.log(` ${p.name} — ${statusStr}`);
150
+ }
151
+ }
152
+
153
+ async function cmdStatus(opts: Record<string, string | boolean>): Promise<void> {
154
+ const name = (opts.printer as string) || undefined;
155
+ const s = await brotherPrinter.getStatus(name);
156
+ console.log(`Printer: ${s.name}`);
157
+ console.log(`Online: ${s.online ? "yes" : "no"}`);
158
+ console.log(`Status: ${s.statusText}`);
159
+ if (s.error) console.log(`Error: ${s.error}`);
160
+ console.log(`Queue: ${s.queueLength} job(s)`);
161
+ if (s.workOffline) console.log(`Work offline flag: true`);
162
+ }
163
+
164
+ async function cmdConfig(opts: Record<string, string | boolean>): Promise<void> {
165
+ const hasUpdate = !!(opts.tape || opts.printer);
166
+ if (!hasUpdate) {
167
+ const cfg = getConfig();
168
+ console.log(`Configuration:`);
169
+ console.log(` File: ${getConfigPath()}`);
170
+ console.log(` Default tape: ${cfg.defaultTape ? cfg.defaultTape + "mm" : "(not set)"}`);
171
+ console.log(` Default printer: ${cfg.defaultPrinter ?? "(not set)"}`);
172
+ console.log("\nValid tape sizes: 6, 9, 12, 18, 24");
173
+ return;
174
+ }
175
+ if (opts.tape) {
176
+ const t = parseTape(opts.tape as string);
177
+ setConfig({ defaultTape: t });
178
+ console.log(`Default tape set to: ${t}mm`);
179
+ }
180
+ if (opts.printer) {
181
+ setConfig({ defaultPrinter: opts.printer as string });
182
+ console.log(`Default printer set to: ${opts.printer}`);
183
+ }
184
+ }
185
+
186
+ async function resolveTape(opts: Record<string, string | boolean>): Promise<TapeSize> {
187
+ const explicit = opts.tape ? parseTape(opts.tape as string) : null;
188
+ const detected = await detectTapeSize(opts.printer as string | undefined);
189
+ if (explicit) {
190
+ if (detected && detected !== explicit) {
191
+ console.warn(`Warning: -tape ${explicit}mm specified but printer reports ${detected}mm tape loaded`);
192
+ }
193
+ return explicit;
194
+ }
195
+ if (detected) return detected;
196
+ return getConfig().defaultTape ?? 24;
197
+ }
198
+
199
+ async function cmdPrint(
200
+ opts: Record<string, string | boolean>,
201
+ segments: Segment[],
202
+ inputs: string[]
203
+ ): Promise<void> {
204
+ const tape = await resolveTape(opts);
205
+
206
+ // If there are 2+ positional inputs, treat each as a text segment.
207
+ // (A single positional input is handled below via classifyInput so it can
208
+ // auto-detect file paths.)
209
+ if (inputs.length > 1 || (inputs.length >= 1 && segments.length > 0)) {
210
+ for (const inp of inputs) {
211
+ segments.push({ type: "text", value: inp });
212
+ }
213
+ inputs.length = 0;
214
+ }
215
+
216
+ const baseOpts = {
217
+ printer: opts.printer as string | undefined,
218
+ wait: !opts.nowait,
219
+ waitTimeoutMs: opts.timeout ? Math.round(parseFloat(opts.timeout as string) * 1000) : undefined,
220
+ waitIntervalMs: opts.interval ? Math.round(parseFloat(opts.interval as string) * 1000) : undefined,
221
+ onWaiting: makeWaitCallback(),
222
+ log: (msg: string) => console.log(msg),
223
+ };
224
+
225
+ // Multi-segment mode: explicit -text/-qr (>=1 segment), with positional joined in
226
+ if (segments.length > 1 || (segments.length === 1 && inputs.length === 0)) {
227
+ const segOpts: SegmentOptions = {
228
+ ...baseOpts,
229
+ tape,
230
+ textHeight: opts.height as string | undefined,
231
+ space: opts.space as string | undefined,
232
+ };
233
+ if (opts.output) {
234
+ const buffer = await renderSegments(segments, tape, opts.height as string | undefined, opts.space as string | undefined);
235
+ fs.writeFileSync(opts.output as string, buffer);
236
+ console.log(`Saved to ${opts.output}`);
237
+ } else {
238
+ await printSegments(segments, segOpts);
239
+ console.log(`Printed ${segments.length} segment(s) on ${tape}mm tape`);
240
+ }
241
+ return;
242
+ }
243
+
244
+ // Single content op
245
+ const printOpts: PrintOptions = {
246
+ ...baseOpts,
247
+ tape,
248
+ aspect: opts.aspect as string | undefined,
249
+ textHeight: opts.height as string | undefined,
250
+ };
251
+
252
+ if (opts.clip) {
253
+ printOpts.clip = true;
254
+ } else if (inputs.length === 1) {
255
+ Object.assign(printOpts, classifyInput(inputs[0], opts));
256
+ } else if (inputs.length === 0 && segments.length === 0) {
257
+ showHelp();
258
+ return;
259
+ }
260
+
261
+ if (opts.output) {
262
+ const buffer = await render(printOpts);
263
+ fs.writeFileSync(opts.output as string, buffer);
264
+ console.log(`Saved to ${opts.output}`);
265
+ return;
266
+ }
267
+ await print(printOpts);
268
+ console.log(`Printed on ${tape}mm tape`);
269
+ }
270
+
271
+ function classifyInput(input: string, opts: Record<string, string | boolean>): Partial<CorePrintOptions> {
272
+ if (opts.text) return { text: input };
273
+ if (opts.html) return { htmlPath: path.resolve(input) };
274
+ if (opts.image) return { imagePath: path.resolve(input) };
275
+
276
+ const lower = input.toLowerCase();
277
+ if (lower.endsWith(".html") || lower.endsWith(".htm")) return { htmlPath: path.resolve(input) };
278
+ if (lower.endsWith(".txt")) return { textFile: path.resolve(input) };
279
+ if (/\.(png|jpg|jpeg|bmp|gif)$/i.test(lower)) return { imagePath: path.resolve(input) };
280
+ if (fs.existsSync(input)) {
281
+ const ext = path.extname(lower);
282
+ if (ext === ".html" || ext === ".htm") return { htmlPath: path.resolve(input) };
283
+ return { textFile: path.resolve(input) };
284
+ }
285
+ return { text: input };
286
+ }
287
+
288
+ function makeWaitCallback() {
289
+ let lastReport = 0;
290
+ return (status: PrinterStatus, elapsedMs: number, alternatives: PrinterStatus[]) => {
291
+ const secs = Math.floor(elapsedMs / 1000);
292
+ if (secs - lastReport < 5) return;
293
+ lastReport = secs;
294
+ const altStr = alternatives.length > 0
295
+ ? ` (online alternatives: ${alternatives.map(a => a.name).join(", ")})`
296
+ : "";
297
+ console.log(`[brother-print] still waiting for ${status.name} (${status.statusText}${status.error ? ", " + status.error : ""}); ${secs}s elapsed${altStr}`);
298
+ };
299
+ }
300
+
301
+ main();
package/index.d.ts CHANGED
@@ -2,5 +2,6 @@
2
2
  * Brother Label Printer API
3
3
  * @module @bobfrankston/brother-label
4
4
  */
5
- export { TapeSize, Orientation, PrinterConfig, PrinterInfo, PrintOptions, PrintResult, print, render, getConfig, setConfig, getConfigPath, listPrinters, } from "./api.js";
5
+ export { TapeSize, Orientation, PrinterConfig, PrinterInfo, PrintOptions, PrintResult, SegmentOptions, Segment, brotherPrinter, print, render, renderSegments, printSegments, getConfig, setConfig, getConfigPath, listPrinters, detectTapeSize, } from "./api.js";
6
+ export type { LabelPrinter, MediaInfo, PrinterStatus, WaitOptions, WaitCallback, LogFn, ClipboardKind, ClipboardResult, } from "@bobfrankston/label-core";
6
7
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EAEX,KAAK,EACL,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,GACf,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EAEP,cAAc,EAEd,KAAK,EACL,MAAM,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACjB,MAAM,UAAU,CAAC;AAGlB,YAAY,EACR,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,KAAK,EACL,aAAa,EACb,eAAe,GAClB,MAAM,0BAA0B,CAAC"}
package/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  * @module @bobfrankston/brother-label
4
4
  */
5
5
  export {
6
- // Functions
7
- print, render, getConfig, setConfig, getConfigPath, listPrinters, } from "./api.js";
6
+ /* The Brother-specific singleton (implements LabelPrinter from label-core) */
7
+ brotherPrinter,
8
+ /* Functions */
9
+ print, render, renderSegments, printSegments, getConfig, setConfig, getConfigPath, listPrinters, detectTapeSize, } from "./api.js";
8
10
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AAQH,YAAY;AACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,GACf,MAAM,UAAU,CAAC","sourcesContent":["/**\r\n * Brother Label Printer API\r\n * @module @bobfrankston/brother-label\r\n */\r\n\r\nexport {\r\n // Types\r\n TapeSize,\r\n Orientation,\r\n PrinterConfig,\r\n PrinterInfo,\r\n PrintOptions,\r\n PrintResult,\r\n // Functions\r\n print,\r\n render,\r\n getConfig,\r\n setConfig,\r\n getConfigPath,\r\n listPrinters,\r\n} from \"./api.js\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AAUH,8EAA8E;AAC9E,cAAc;AACd,eAAe;AACf,KAAK,EACL,MAAM,EACN,cAAc,EACd,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACjB,MAAM,UAAU,CAAC","sourcesContent":["/**\n * Brother Label Printer API\n * @module @bobfrankston/brother-label\n */\n\nexport {\n /* Brother-specific types (backward-compat) */\n TapeSize,\n Orientation,\n PrinterConfig,\n PrinterInfo,\n PrintOptions,\n PrintResult,\n SegmentOptions,\n Segment,\n /* The Brother-specific singleton (implements LabelPrinter from label-core) */\n brotherPrinter,\n /* Functions */\n print,\n render,\n renderSegments,\n printSegments,\n getConfig,\n setConfig,\n getConfigPath,\n listPrinters,\n detectTapeSize,\n} from \"./api.js\";\n\n/* Re-export the unified label-core types for cross-driver code. */\nexport type {\n LabelPrinter,\n MediaInfo,\n PrinterStatus,\n WaitOptions,\n WaitCallback,\n LogFn,\n ClipboardKind,\n ClipboardResult,\n} from \"@bobfrankston/label-core\";\n"]}
package/index.ts CHANGED
@@ -1,21 +1,40 @@
1
- /**
2
- * Brother Label Printer API
3
- * @module @bobfrankston/brother-label
4
- */
5
-
6
- export {
7
- // Types
8
- TapeSize,
9
- Orientation,
10
- PrinterConfig,
11
- PrinterInfo,
12
- PrintOptions,
13
- PrintResult,
14
- // Functions
15
- print,
16
- render,
17
- getConfig,
18
- setConfig,
19
- getConfigPath,
20
- listPrinters,
21
- } from "./api.js";
1
+ /**
2
+ * Brother Label Printer API
3
+ * @module @bobfrankston/brother-label
4
+ */
5
+
6
+ export {
7
+ /* Brother-specific types (backward-compat) */
8
+ TapeSize,
9
+ Orientation,
10
+ PrinterConfig,
11
+ PrinterInfo,
12
+ PrintOptions,
13
+ PrintResult,
14
+ SegmentOptions,
15
+ Segment,
16
+ /* The Brother-specific singleton (implements LabelPrinter from label-core) */
17
+ brotherPrinter,
18
+ /* Functions */
19
+ print,
20
+ render,
21
+ renderSegments,
22
+ printSegments,
23
+ getConfig,
24
+ setConfig,
25
+ getConfigPath,
26
+ listPrinters,
27
+ detectTapeSize,
28
+ } from "./api.js";
29
+
30
+ /* Re-export the unified label-core types for cross-driver code. */
31
+ export type {
32
+ LabelPrinter,
33
+ MediaInfo,
34
+ PrinterStatus,
35
+ WaitOptions,
36
+ WaitCallback,
37
+ LogFn,
38
+ ClipboardKind,
39
+ ClipboardResult,
40
+ } from "@bobfrankston/label-core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/brother-label",
3
- "version": "1.0.13",
3
+ "version": "1.1.1",
4
4
  "description": "API and CLI for printing labels on Brother P-touch printers",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -27,7 +27,8 @@
27
27
  "scripts": {
28
28
  "build": "tsc",
29
29
  "prepublishOnly": "npm run build",
30
- "start": "node cli.js"
30
+ "start": "node cli.js",
31
+ "release": "npmglobalize"
31
32
  },
32
33
  "keywords": [
33
34
  "brother",
@@ -44,7 +45,7 @@
44
45
  "url": "https://github.com/BobFrankston/brother-label.git"
45
46
  },
46
47
  "dependencies": {
47
- "commander": "^12.0.0",
48
+ "@bobfrankston/label-core": "^0.1.1",
48
49
  "jimp": "^1.6.0",
49
50
  "puppeteer": "^23.11.1",
50
51
  "qrcode": "^1.5.4"
@@ -56,5 +57,19 @@
56
57
  },
57
58
  "publishConfig": {
58
59
  "access": "public"
60
+ },
61
+ ".dependencies": {
62
+ "@bobfrankston/label-core": "file:../../../utils/label-core",
63
+ "jimp": "^1.6.0",
64
+ "puppeteer": "^23.11.1",
65
+ "qrcode": "^1.5.4"
66
+ },
67
+ ".transformedSnapshot": {
68
+ "dependencies": {
69
+ "@bobfrankston/label-core": "^0.1.1",
70
+ "jimp": "^1.6.0",
71
+ "puppeteer": "^23.11.1",
72
+ "qrcode": "^1.5.4"
73
+ }
59
74
  }
60
75
  }