ba63 1.0.0 โ†’ 1.1.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 CHANGED
@@ -1,15 +1,86 @@
1
- # package
1
+ # BA63 ๐Ÿ“บ
2
2
 
3
- To install dependencies:
3
+ <table align="center">
4
+ <tr>
5
+ <td align="center">
6
+ <img src="./assets/demo.png" alt="Successfully running `BA63.testRender()`" width="320"/>
7
+ </td>
8
+ </tr>
9
+ <tr>
10
+ <td style="text-align: center;">
11
+ <p style="text-align: center;">
12
+ <code>ba63</code> is a very lightweight library that allows for simple interaction with any Wincor Nixdorf BA63 USB VFD.
13
+ </p>
14
+ </td>
15
+ </tr>
16
+ </table>
4
17
 
5
- ```bash
6
- bun install
18
+ ## Installation
19
+
20
+ <table align="center">
21
+ <tr>
22
+ <td>
23
+ ๐ŸฅŸ Bun
24
+
25
+ ```bash
26
+ bun add ba63
27
+ ```
28
+
29
+ <td>
30
+ ๐Ÿ“ฆ NPM
31
+
32
+ ```bash
33
+ npm install ba63
34
+ ```
35
+
36
+ <td>
37
+ ๐Ÿงถ Yarn:
38
+
39
+ ```bash
40
+ yarn add ba63
41
+ ```
42
+
43
+ </td>
44
+ </tr>
45
+ </table>
46
+
47
+ ## Getting started
48
+
49
+ Getting started with `ba63` is as easy as:
50
+
51
+ ```typescript
52
+ import { BA63 } from "ba63";
53
+
54
+ const ba63 = await BA63.create();
55
+
56
+ await ba63.testRender();
7
57
  ```
8
58
 
9
- To run:
59
+ Now we can enhance this script with the ability to clear the screen after a few seconds or on process interrupt:
10
60
 
11
- ```bash
12
- bun run index.ts
61
+ ```typescript
62
+ import { BA63 } from "ba63";
63
+
64
+ const ba63 = await BA63.create();
65
+
66
+ await ba63.testRender();
67
+
68
+ async function exit() {
69
+ await ba63.clearDisplay();
70
+ process.exit(0);
71
+ }
72
+
73
+ setTimeout(async () => {
74
+ await exit();
75
+ }, 7000);
76
+
77
+ process.on("SIGINT", async () => {
78
+ await exit();
79
+ });
13
80
  ```
14
81
 
15
- This project was created using `bun init` in bun v1.3.5. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
82
+ Alternatively, you can pull down this repo and run the demo yourself:
83
+
84
+ ```bash
85
+ bun install && bun demo
86
+ ```
@@ -1,4 +1,9 @@
1
1
  import HID from "node-hid";
2
+ import type { Charset } from "~/constants/charset";
3
+ type RenderOptions = Partial<{
4
+ /** If the message reaches the end of the top line, start printing on the bottom line.*/
5
+ wrap: boolean;
6
+ }>;
2
7
  export declare class BA63 {
3
8
  private device;
4
9
  /** Current cursor position in [row, column] format */
@@ -9,15 +14,22 @@ export declare class BA63 {
9
14
  constructor(device: HID.HIDAsync);
10
15
  static create(): Promise<BA63>;
11
16
  private run;
12
- render(message: string): Promise<void>;
17
+ render(message: string | number[], options?: RenderOptions): Promise<void>;
13
18
  renderInCenter(message: string): Promise<void>;
14
19
  testRender(): Promise<void>;
15
- setCharset(charset: number): Promise<void>;
20
+ carriageReturn(): Promise<void>;
21
+ lineFeed(): Promise<void>;
22
+ backspace(): Promise<void>;
23
+ setCharset(charset: Charset): Promise<void>;
16
24
  deleteToEOL(): Promise<void>;
17
25
  setCursorPosition(row: number, column: number): Promise<void>;
18
26
  setCursorColumn(column: number): Promise<void>;
19
27
  setCursorRow(row: number): Promise<void>;
20
28
  clearDisplay(): Promise<void>;
21
29
  get lengthToEnd(): number;
30
+ get row(): "top" | "bottom";
31
+ get currentRow(): number;
32
+ get currentColumn(): number;
22
33
  }
34
+ export {};
23
35
  //# sourceMappingURL=BA63.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BA63.d.ts","sourceRoot":"","sources":["../../src/classes/BA63.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAK3B,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAe;IAE7B,sDAAsD;IACtD,SAAS,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAU;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CACV,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC;IAgCV,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAM/B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAM1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7D,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,GAAG,IAAI,KAAK,GAAG,QAAQ,CAE1B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;CACF"}
@@ -0,0 +1,27 @@
1
+ export declare const charset: {
2
+ readonly USA: 0;
3
+ readonly France: 1;
4
+ readonly Germany: 2;
5
+ readonly UK: 3;
6
+ readonly Denmark1: 4;
7
+ readonly Sweden: 5;
8
+ readonly Italy: 6;
9
+ readonly Spain1: 7;
10
+ readonly Japan: 8;
11
+ readonly Norway: 9;
12
+ readonly Denmark2: 10;
13
+ readonly Spain2: 11;
14
+ readonly LatinAmerica: 12;
15
+ readonly Standard: 30;
16
+ readonly Latin1: 31;
17
+ readonly Latin2: 32;
18
+ readonly Latin5_Turkey: 33;
19
+ readonly LatinInternational: 34;
20
+ readonly Cyrillic: 35;
21
+ readonly Hebrew: 37;
22
+ readonly Greek2: 36;
23
+ readonly Katakana: 63;
24
+ readonly SpacePage: 73;
25
+ };
26
+ export type Charset = (typeof charset)[keyof typeof charset];
27
+ //# sourceMappingURL=charset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charset.d.ts","sourceRoot":"","sources":["../../src/constants/charset.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAwBV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export * from "./classes/BA63";
1
+ export { BA63 } from "~/classes/BA63";
2
+ export { charset } from "~/constants/charset";
3
+ export type { Charset } from "~/constants/charset";
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -20,20 +20,31 @@ class BA63 {
20
20
  throw new Error("BA63 display interface (Interface 1) not found!");
21
21
  }
22
22
  const device = await HID.HIDAsync.open(displayInterface.path);
23
- return new BA63(device);
23
+ const ba63 = new BA63(device);
24
+ await ba63.clearDisplay();
25
+ await ba63.setCharset(0);
26
+ return ba63;
24
27
  }
25
28
  async run(command) {
26
- const writeComment = [2, 0, command.length, ...command];
27
- while (writeComment.length < 32) {
28
- writeComment.push(0);
29
+ const writeCommand = [2, 0, command.length, ...command];
30
+ while (writeCommand.length < 32) {
31
+ writeCommand.push(0);
29
32
  }
30
- await this.device.write(writeComment);
33
+ await this.device.write(writeCommand);
31
34
  }
32
- async render(message) {
35
+ async render(message, options) {
33
36
  const trimmedMessage = message.slice(0, this.lengthToEnd);
34
- const data = Buffer.from(trimmedMessage, "ascii");
35
- const arr = Array.from(data);
37
+ const arr = typeof trimmedMessage === "string" ? Array.from(Buffer.from(trimmedMessage, "ascii")) : trimmedMessage;
36
38
  await this.run(arr);
39
+ this.setCursorColumn(this.currentColumn + arr.length);
40
+ if (options?.wrap && this.row === "top" && message.length > trimmedMessage.length) {
41
+ const excessMessage = message.slice(trimmedMessage.length);
42
+ await this.setCursorPosition(1, 0);
43
+ const excessArr = typeof excessMessage === "string" ? Array.from(Buffer.from(excessMessage, "ascii")) : excessMessage;
44
+ await this.run(excessArr);
45
+ this.setCursorColumn(this.currentColumn + excessArr.length);
46
+ return;
47
+ }
37
48
  }
38
49
  async renderInCenter(message) {
39
50
  const trimmedMessage = message.slice(0, 20);
@@ -47,6 +58,21 @@ class BA63 {
47
58
  await this.setCursorRow(1);
48
59
  await this.renderInCenter("- Caleb");
49
60
  }
61
+ async carriageReturn() {
62
+ const command = [13];
63
+ await this.run(command);
64
+ this.setCursorColumn(0);
65
+ }
66
+ async lineFeed() {
67
+ const command = [10];
68
+ await this.run(command);
69
+ this.setCursorRow(Math.min(1, this.currentRow + 1));
70
+ }
71
+ async backspace() {
72
+ const command = [8];
73
+ await this.run(command);
74
+ this.setCursorColumn(Math.max(0, this.currentColumn - 1));
75
+ }
50
76
  async setCharset(charset) {
51
77
  const command = [27, 82, charset];
52
78
  await this.run(command);
@@ -75,9 +101,45 @@ class BA63 {
75
101
  get lengthToEnd() {
76
102
  return 20 - this.cursorPos[1];
77
103
  }
104
+ get row() {
105
+ return this.cursorPos[0] === 0 ? "top" : "bottom";
106
+ }
107
+ get currentRow() {
108
+ return this.cursorPos[0];
109
+ }
110
+ get currentColumn() {
111
+ return this.cursorPos[1];
112
+ }
78
113
  }
114
+ // src/constants/charset.ts
115
+ var charset = {
116
+ USA: 0,
117
+ France: 1,
118
+ Germany: 2,
119
+ UK: 3,
120
+ Denmark1: 4,
121
+ Sweden: 5,
122
+ Italy: 6,
123
+ Spain1: 7,
124
+ Japan: 8,
125
+ Norway: 9,
126
+ Denmark2: 10,
127
+ Spain2: 11,
128
+ LatinAmerica: 12,
129
+ Standard: 30,
130
+ Latin1: 31,
131
+ Latin2: 32,
132
+ Latin5_Turkey: 33,
133
+ LatinInternational: 34,
134
+ Cyrillic: 35,
135
+ Hebrew: 37,
136
+ Greek2: 36,
137
+ Katakana: 63,
138
+ SpacePage: 73
139
+ };
79
140
  export {
141
+ charset,
80
142
  BA63
81
143
  };
82
144
 
83
- //# debugId=2318C4E4063EB96A64756E2164756E21
145
+ //# debugId=C3520B00CEF43B2B64756E2164756E21
package/dist/index.js.map CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/classes/BA63.ts"],
3
+ "sources": ["../src/classes/BA63.ts", "../src/constants/charset.ts"],
4
4
  "sourcesContent": [
5
- "import HID from \"node-hid\";\n\nconst vendorId = 2727;\nconst productId = 512;\n\nexport class BA63 {\n private device: HID.HIDAsync;\n\n /** Current cursor position in [row, column] format */\n protected cursorPos: [number, number] = [0, 0];\n\n /**\n * **NOTE**: This constructor should only be used if you already have an open HID device to interface with.\n */\n constructor(device: HID.HIDAsync) {\n this.device = device;\n }\n\n static async create(): Promise<BA63> {\n const devices = HID.devices();\n const ba63Devices = devices.filter(\n (device) => device.vendorId === vendorId && device.productId === productId\n );\n\n if (ba63Devices.length === 0) {\n throw new Error(\"BA63 device not found\");\n }\n\n /*\n * When connecting to a BA63, you'll find that there are two different interfaces\n * to connect to. Interface 0 is for updating the BA63's firmware whereas interface 1\n * is for communicating with the display itself.\n */\n const displayInterface = ba63Devices.find((d) => d.interface === 1);\n\n if (!displayInterface) {\n throw new Error(\"BA63 display interface (Interface 1) not found!\");\n }\n\n const device = await HID.HIDAsync.open(displayInterface.path!);\n // device.on(\"data\", (data) => {\n // console.log(\"Data received:\", data);\n // });\n\n // device.on(\"error\", (err) => {\n // console.error(\"Error:\", err);\n // });\n return new BA63(device);\n }\n\n private async run(command: number[]): Promise<void> {\n // Pad to 32 bytes (HID report size)\n const writeComment = [0x02, 0x00, command.length, ...command];\n while (writeComment.length < 32) {\n writeComment.push(0x00);\n }\n\n await this.device.write(writeComment);\n }\n\n async render(message: string): Promise<void> {\n const trimmedMessage = message.slice(0, this.lengthToEnd);\n const data = Buffer.from(trimmedMessage, \"ascii\");\n const arr = Array.from(data);\n\n await this.run(arr);\n }\n\n async renderInCenter(message: string): Promise<void> {\n const trimmedMessage = message.slice(0, 20);\n const padding = Math.floor((20 - trimmedMessage.length) / 2);\n this.setCursorPosition(this.cursorPos[0], padding);\n\n await this.render(trimmedMessage);\n }\n\n async testRender(): Promise<void> {\n const testMessage = \"Hello from BA63!\";\n await this.renderInCenter(testMessage);\n await this.setCursorRow(1);\n await this.renderInCenter(\"- Caleb\");\n }\n\n async setCharset(charset: number): Promise<void> {\n const command = [0x1b, 0x52, charset];\n await this.run(command);\n }\n\n async deleteToEOL(): Promise<void> {\n const command = [0x1b, 0x5b, 0x30, 0x4b];\n await this.run(command);\n }\n\n async setCursorPosition(row: number, column: number): Promise<void> {\n this.cursorPos = [row, column];\n\n const asciiRow = (row + 1).toString().charCodeAt(0);\n // asciiColumn can be more than one digit\n const asciiColumn = (column + 1)\n .toString()\n .split(\"\")\n .map((char) => char.charCodeAt(0));\n\n const command = [0x1b, 0x5b, asciiRow, 0x3b, ...asciiColumn, 0x48];\n await this.run(command);\n }\n\n async setCursorColumn(column: number): Promise<void> {\n this.setCursorPosition(this.cursorPos[0], column);\n }\n\n async setCursorRow(row: number): Promise<void> {\n this.setCursorPosition(row, this.cursorPos[1]);\n }\n\n async clearDisplay(): Promise<void> {\n const command = [0x1b, 0x5b, 0x32, 0x4a];\n await this.run(command);\n }\n\n get lengthToEnd(): number {\n return 20 - this.cursorPos[1];\n }\n}\n"
5
+ "import HID from \"node-hid\";\nimport type { Charset } from \"~/constants/charset\";\n\nconst vendorId = 2727;\nconst productId = 512;\n\ntype RenderOptions = Partial<{\n /** If the message reaches the end of the top line, start printing on the bottom line.*/\n wrap: boolean;\n}>;\n\nexport class BA63 {\n private device: HID.HIDAsync;\n\n /** Current cursor position in [row, column] format */\n protected cursorPos: [number, number] = [0, 0];\n\n /**\n * **NOTE**: This constructor should only be used if you already have an open HID device to interface with.\n */\n constructor(device: HID.HIDAsync) {\n this.device = device;\n }\n\n static async create(): Promise<BA63> {\n const devices = HID.devices();\n const ba63Devices = devices.filter(\n (device) => device.vendorId === vendorId && device.productId === productId\n );\n\n if (ba63Devices.length === 0) {\n throw new Error(\"BA63 device not found\");\n }\n\n /*\n * When connecting to a BA63, you'll find that there are two different interfaces\n * to connect to. Interface 0 is for updating the BA63's firmware whereas interface 1\n * is for communicating with the display itself.\n */\n const displayInterface = ba63Devices.find((d) => d.interface === 1);\n\n if (!displayInterface) {\n throw new Error(\"BA63 display interface (Interface 1) not found!\");\n }\n\n const device = await HID.HIDAsync.open(displayInterface.path!);\n\n // device.on(\"data\", (data) => {\n // console.log(\"Data received:\", data);\n // });\n\n // device.on(\"error\", (err) => {\n // console.error(\"Error:\", err);\n // });\n\n const ba63 = new BA63(device);\n await ba63.clearDisplay();\n await ba63.setCharset(0); // Set to USA charset\n\n return ba63;\n }\n\n private async run(command: number[]): Promise<void> {\n // Pad to 32 bytes (HID report size)\n const writeCommand = [0x02, 0x00, command.length, ...command];\n while (writeCommand.length < 32) {\n writeCommand.push(0x00);\n }\n\n await this.device.write(writeCommand);\n }\n\n async render(\n message: string | number[],\n options?: RenderOptions\n ): Promise<void> {\n const trimmedMessage = message.slice(0, this.lengthToEnd);\n\n const arr =\n typeof trimmedMessage === \"string\"\n ? Array.from(Buffer.from(trimmedMessage, \"ascii\"))\n : trimmedMessage;\n\n await this.run(arr);\n this.setCursorColumn(this.currentColumn + arr.length);\n\n // If wrapping is enabled, we're on the top line, and there's more message to render, continue rendering on next line\n if (\n options?.wrap &&\n this.row === \"top\" &&\n message.length > trimmedMessage.length\n ) {\n const excessMessage = message.slice(trimmedMessage.length);\n\n await this.setCursorPosition(1, 0);\n\n const excessArr =\n typeof excessMessage === \"string\"\n ? Array.from(Buffer.from(excessMessage, \"ascii\"))\n : excessMessage;\n\n await this.run(excessArr);\n this.setCursorColumn(this.currentColumn + excessArr.length);\n return;\n }\n }\n\n async renderInCenter(message: string): Promise<void> {\n const trimmedMessage = message.slice(0, 20);\n const padding = Math.floor((20 - trimmedMessage.length) / 2);\n this.setCursorPosition(this.cursorPos[0], padding);\n\n await this.render(trimmedMessage);\n }\n\n async testRender(): Promise<void> {\n const testMessage = \"Hello from BA63!\";\n await this.renderInCenter(testMessage);\n await this.setCursorRow(1);\n await this.renderInCenter(\"- Caleb\");\n }\n\n async carriageReturn(): Promise<void> {\n const command = [0x0d];\n await this.run(command);\n this.setCursorColumn(0);\n }\n\n async lineFeed(): Promise<void> {\n const command = [0x0a];\n await this.run(command);\n this.setCursorRow(Math.min(1, this.currentRow + 1));\n }\n\n async backspace(): Promise<void> {\n const command = [0x08];\n await this.run(command);\n this.setCursorColumn(Math.max(0, this.currentColumn - 1));\n }\n\n async setCharset(charset: Charset): Promise<void> {\n const command = [0x1b, 0x52, charset];\n await this.run(command);\n }\n\n async deleteToEOL(): Promise<void> {\n const command = [0x1b, 0x5b, 0x30, 0x4b];\n await this.run(command);\n }\n\n async setCursorPosition(row: number, column: number): Promise<void> {\n this.cursorPos = [row, column];\n\n const asciiRow = (row + 1).toString().charCodeAt(0);\n // asciiColumn can be more than one digit\n const asciiColumn = (column + 1)\n .toString()\n .split(\"\")\n .map((char) => char.charCodeAt(0));\n\n const command = [0x1b, 0x5b, asciiRow, 0x3b, ...asciiColumn, 0x48];\n await this.run(command);\n }\n\n async setCursorColumn(column: number): Promise<void> {\n this.setCursorPosition(this.cursorPos[0], column);\n }\n\n async setCursorRow(row: number): Promise<void> {\n this.setCursorPosition(row, this.cursorPos[1]);\n }\n\n async clearDisplay(): Promise<void> {\n const command = [0x1b, 0x5b, 0x32, 0x4a];\n await this.run(command);\n }\n\n get lengthToEnd(): number {\n return 20 - this.cursorPos[1];\n }\n\n get row(): \"top\" | \"bottom\" {\n return this.cursorPos[0] === 0 ? \"top\" : \"bottom\";\n }\n\n get currentRow(): number {\n return this.cursorPos[0];\n }\n\n get currentColumn(): number {\n return this.cursorPos[1];\n }\n}\n",
6
+ "export const charset = {\n USA: 0,\n France: 1,\n Germany: 2,\n UK: 3,\n Denmark1: 4,\n Sweden: 5,\n Italy: 6,\n Spain1: 7,\n Japan: 8,\n Norway: 9,\n Denmark2: 10,\n Spain2: 11,\n LatinAmerica: 12,\n Standard: 30,\n Latin1: 31,\n Latin2: 32,\n Latin5_Turkey: 33,\n LatinInternational: 34,\n Cyrillic: 35,\n Hebrew: 37,\n Greek2: 36,\n Katakana: 63,\n SpacePage: 73,\n} as const;\n\nexport type Charset = (typeof charset)[keyof typeof charset];\n"
6
7
  ],
7
- "mappings": ";AAAA;AAEA,IAAM,WAAW;AACjB,IAAM,YAAY;AAAA;AAEX,MAAM,KAAK;AAAA,EACR;AAAA,EAGE,YAA8B,CAAC,GAAG,CAAC;AAAA,EAK7C,WAAW,CAAC,QAAsB;AAAA,IAChC,KAAK,SAAS;AAAA;AAAA,cAGH,OAAM,GAAkB;AAAA,IACnC,MAAM,UAAU,IAAI,QAAQ;AAAA,IAC5B,MAAM,cAAc,QAAQ,OAC1B,CAAC,YAAW,QAAO,aAAa,YAAY,QAAO,cAAc,SACnE;AAAA,IAEA,IAAI,YAAY,WAAW,GAAG;AAAA,MAC5B,MAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AAAA,IAOA,MAAM,mBAAmB,YAAY,KAAK,CAAC,MAAM,EAAE,cAA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AAA,EACf,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AACb;",
9
+ "debugId": "C3520B00CEF43B2B64756E2164756E21",
9
10
  "names": []
10
11
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "ba63",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "author": {
5
5
  "name": "Caleb Perry",
6
6
  "url": "https://github.com/foxtrotperry",
7
7
  "email": "caleb@foxtrotperry.com"
8
8
  },
9
+ "repository": "github.com/foxtrotperry/ba63",
9
10
  "type": "module",
10
11
  "files": [
11
12
  "dist"
@@ -21,8 +22,9 @@
21
22
  "scripts": {
22
23
  "build:js": "bun run build.ts",
23
24
  "build:types": "tsc",
24
- "build": "bun run build:js && bun run build:types",
25
+ "build": "rm -rf ./dist && bun run build:js && bun run build:types",
25
26
  "package": "rm -rf ./dist && bun run build && bun pm pack",
27
+ "prepare": "bun run build",
26
28
  "test": "bun test"
27
29
  },
28
30
  "keywords": [