@risleylima/escpos 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.0.15] - 2024-11-23
8
+ ## [0.2.0] - 2025-11-23
9
+
10
+ ### Added
11
+ - `Serial.listSerial()` method to list all available serial ports
12
+ - Returns array of serial port objects with path, manufacturer, vendorId, productId, etc.
13
+ - Similar functionality to `USB.listUSB()` for consistency between adapters
14
+
15
+ ## [0.1.0] - 2025-11-23
9
16
 
10
17
  ### Added
11
18
  - Complete JSDoc documentation for all public APIs
@@ -55,6 +62,7 @@ Initial stable release with USB and Serial adapter support.
55
62
 
56
63
  ## Version History
57
64
 
58
- - **0.0.15** - Major dependency updates, 100% test coverage, complete documentation
65
+ - **0.2.0** - Added `Serial.listSerial()` method for listing available serial ports
66
+ - **0.1.0** - Major dependency updates, 100% test coverage, complete documentation
59
67
  - **0.0.14** - Initial stable release
60
68
 
package/README.md CHANGED
@@ -215,6 +215,14 @@ await USB.disconnect();
215
215
 
216
216
  #### Methods
217
217
 
218
+ ##### `Serial.listSerial()`
219
+ List all available serial ports.
220
+
221
+ ```javascript
222
+ const ports = await Serial.listSerial();
223
+ console.log(ports); // Array of serial port objects with path, manufacturer, vendorId, productId, etc.
224
+ ```
225
+
218
226
  ##### `Serial.connect(port, options)`
219
227
  Connect to a serial port printer.
220
228
 
@@ -3,7 +3,7 @@
3
3
  ## 📋 General Information
4
4
 
5
5
  - **Name**: `@risleylima/escpos`
6
- - **Version**: `0.0.14`
6
+ - **Version**: `0.1.0`
7
7
  - **License**: MIT
8
8
  - **Node.js**: `>=18.0.0`
9
9
  - **Description**: Library to manage ESC/POS commands in Buffer (Node.js), then use an adapter to send the resulting data to the printer.
@@ -189,7 +189,7 @@ node -e "console.log(require('./package.json').version)"
189
189
 
190
190
  # Check if version follows semantic versioning
191
191
  # MAJOR.MINOR.PATCH
192
- # 0.0.14 -> 0.0.15 (minor update)
192
+ # 0.0.14 -> 0.1.0 (minor update)
193
193
  ```
194
194
 
195
195
  **What to check:**
@@ -302,7 +302,7 @@ npx np minor
302
302
 
303
303
  ## 🎯 Specific Recommendations for This Version
304
304
 
305
- For v0.0.15, check especially:
305
+ For v0.1.0, check especially:
306
306
 
307
307
  1. **Major Dependency Updates:**
308
308
  - [x] `usb@^2.16.0` - Promise-based API working
@@ -186,8 +186,7 @@ await printer.flush();
186
186
  ### Version Strategy
187
187
 
188
188
  Since there are **NO breaking changes** to the public API:
189
- - **Minor version bump**: `0.0.14` → `0.0.15` (recommended)
190
- - **OR patch version**: `0.0.14` → `0.0.15` (if you want to be conservative)
189
+ - **Minor version bump**: `0.0.14` → `0.1.0` (published)
191
190
 
192
191
  **NOT a major version** because public API is unchanged.
193
192
 
@@ -1,7 +1,7 @@
1
1
  # Pre-Publish Verification Results
2
2
 
3
- Date: 2024-11-23
4
- Version: 0.0.15 (to be published)
3
+ Date: 2025-11-23
4
+ Version: 0.1.0 (published)
5
5
 
6
6
  ## ✅ All Verifications Passed
7
7
 
@@ -89,7 +89,7 @@ Version: 0.0.15 (to be published)
89
89
  ### 10. Versioning Verification ✅
90
90
  - **Status**: PASSED
91
91
  - **Current Version**: 0.0.14
92
- - **Next Version**: 0.0.15 (minor update)
92
+ - **Next Version**: 0.1.0 (minor update)
93
93
  - **Semantic Versioning**: ✅ Follows semver
94
94
  - **CHANGELOG**: ✅ Version 0.0.14 found in CHANGELOG
95
95
  - **Breaking Changes**: None in public API
@@ -151,7 +151,7 @@ Version: 0.0.15 (to be published)
151
151
 
152
152
  ## 🎯 Ready for Publication
153
153
 
154
- **All verifications passed!** The package is ready to be published as v0.0.15.
154
+ **All verifications passed!** The package was successfully published as v0.1.0.
155
155
 
156
156
  ### Next Steps:
157
157
  1. Review CHANGELOG.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@risleylima/escpos",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Library to deal with ESCPOS using some adapters",
5
5
  "main": "index.js",
6
6
  "author": "Rlima Info",
@@ -26,6 +26,22 @@ const scope = {
26
26
  // Create Adapter instance first, so it's the same object used internally and exported
27
27
  const Serial = new Adapter();
28
28
 
29
+ /**
30
+ * List all available serial ports
31
+ * @async
32
+ * @returns {Promise<Array<Object>>} Array of serial port objects with properties like path, manufacturer, vendorId, productId, etc.
33
+ * @example
34
+ * const ports = await Serial.listSerial();
35
+ * console.log(ports);
36
+ * // [
37
+ * // { path: '/dev/ttyUSB0', manufacturer: 'FTDI', vendorId: '0403', productId: '6001' },
38
+ * // { path: '/dev/ttyUSB1', manufacturer: 'Prolific', vendorId: '067b', productId: '2303' }
39
+ * // ]
40
+ */
41
+ Serial.listSerial = async () => {
42
+ return await SerialPort.list();
43
+ };
44
+
29
45
  /**
30
46
  * Connect to a serial port printer
31
47
  * @async
@@ -49,6 +49,20 @@ describe('Serial Adapter', () => {
49
49
  jest.clearAllMocks();
50
50
  });
51
51
 
52
+ describe('listSerial', () => {
53
+ it('should list all available serial ports', async () => {
54
+ const ports = await Serial.listSerial();
55
+ expect(Array.isArray(ports)).toBe(true);
56
+ expect(SerialPort.list).toHaveBeenCalled();
57
+ });
58
+
59
+ it('should return port objects with path property', async () => {
60
+ const ports = await Serial.listSerial();
61
+ expect(ports.length).toBeGreaterThan(0);
62
+ expect(ports[0]).toHaveProperty('path');
63
+ });
64
+ });
65
+
52
66
  describe('connect', () => {
53
67
  it('should connect to serial port', async () => {
54
68
  const result = await Serial.connect('/dev/ttyUSB0');