Skip to content

Commit 807927d

Browse files
committed
export debug namespace
1 parent 718e6d4 commit 807927d

23 files changed

+1804
-3536
lines changed

debug.config.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* The debug namespace for this package.
3+
*/
4+
export declare const DEBUG_NAMESPACE = "faster-report-parser";
5+
/**
6+
* The debug namespaces string to enable debug output for this package.
7+
*/
8+
export declare const DEBUG_ENABLE_NAMESPACES = "faster-report-parser:*";

debug.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* The debug namespace for this package.
3+
*/
4+
export const DEBUG_NAMESPACE = 'faster-report-parser';
5+
/**
6+
* The debug namespaces string to enable debug output for this package.
7+
*/
8+
export const DEBUG_ENABLE_NAMESPACES = `${DEBUG_NAMESPACE}:*`;

debug.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* The debug namespace for this package.
3+
*/
4+
export const DEBUG_NAMESPACE = 'faster-report-parser'
5+
6+
/**
7+
* The debug namespaces string to enable debug output for this package.
8+
*/
9+
export const DEBUG_ENABLE_NAMESPACES = `${DEBUG_NAMESPACE}:*`

package-lock.json

Lines changed: 1727 additions & 3516 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
"./csvReports.js": "./csvReports.js",
1616
"./xlsx": "./xlsxReports.js",
1717
"./xlsxReports": "./xlsxReports.js",
18-
"./xlsxReports.js": "./xlsxReports.js"
18+
"./xlsxReports.js": "./xlsxReports.js",
19+
"./debug": "./debug.config.js"
1920
},
2021
"scripts": {
2122
"test": "node --test",
2223
"test:csv": "node --test --test-name-pattern=\"node-faster-report-parser/csv\"",
23-
"test:xlsx": "cross-env NODE_ENV=dev DEBUG=faster-report-parser:* node --test --test-name-pattern=\"node-faster-report-parser/xlsx\"",
24+
"test:xlsx": "node --test --test-name-pattern=\"node-faster-report-parser/xlsx\"",
2425
"coverage": "c8 --reporter=lcov --reporter=text --reporter=text-summary node --test"
2526
},
2627
"keywords": [
@@ -43,16 +44,16 @@
4344
"homepage": "https://github.com/cityssm/node-faster-report-parser#readme",
4445
"devDependencies": {
4546
"@types/debug": "^4.1.12",
46-
"@types/node": "^22.9.1",
47+
"@types/node": "^22.10.6",
4748
"@types/papaparse": "^5.3.15",
48-
"eslint-config-cityssm": "^15.2.0",
49+
"eslint-config-cityssm": "^18.3.0",
4950
"prettier-config-cityssm": "^1.0.0"
5051
},
5152
"dependencies": {
5253
"@cityssm/string-to-numeric": "^1.0.0",
5354
"@cityssm/utils-datetime": "^1.3.0",
54-
"debug": "^4.3.7",
55-
"papaparse": "^5.4.1",
55+
"debug": "^4.4.0",
56+
"papaparse": "^5.5.1",
5657
"xlsx": "https://github.com/cityssm/node-dependencies/raw/main/xlsx/xlsx-0.20.2.tgz"
5758
}
5859
}

test/csvReports.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import assert from 'node:assert';
22
import { describe, it } from 'node:test';
3+
import Debug from 'debug';
34
import { fasterCsvReportOptions, parseFasterCsvReport } from '../csvReports.js';
5+
import { DEBUG_ENABLE_NAMESPACES } from '../debug.config.js';
6+
Debug.enable(DEBUG_ENABLE_NAMESPACES);
47
await describe('node-faster-report-parser/csv', async () => {
58
await it('Parses "W200S - Inventory Summary Report"', async () => {
69
const results = await parseFasterCsvReport('./samples/w200s.csv', fasterCsvReportOptions.w200s);

test/csvReports.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import assert from 'node:assert'
22
import { describe, it } from 'node:test'
33

4+
import Debug from 'debug'
5+
46
import { fasterCsvReportOptions, parseFasterCsvReport } from '../csvReports.js'
7+
import { DEBUG_ENABLE_NAMESPACES } from '../debug.config.js'
8+
9+
Debug.enable(DEBUG_ENABLE_NAMESPACES)
510

611
await describe('node-faster-report-parser/csv', async () => {
712
await it('Parses "W200S - Inventory Summary Report"', async () => {

test/xlsxReports.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import assert from 'node:assert';
44
import { describe, it } from 'node:test';
55
import { isValidDateString, isValidTimeString } from '@cityssm/utils-datetime';
6+
import Debug from 'debug';
7+
import { DEBUG_ENABLE_NAMESPACES } from '../debug.config.js';
68
import { parseW114ExcelReport, parseW200ExcelReport, parseW201ExcelReport, parseW217ExcelReport, parseW223ExcelReport, parseW311ExcelReport, parseW604ExcelReport, w114ReportName, w200ReportName, w201ReportName, w217ReportName, w223ReportName, w311ReportName, w604ReportName } from '../xlsxReports.js';
9+
Debug.enable(DEBUG_ENABLE_NAMESPACES);
710
await describe('node-faster-report-parser/xlsx', async () => {
811
await it('Parses "W114 - Asset Master List"', () => {
912
const results = parseW114ExcelReport('./samples/w114_assetMasterList.xlsx');

test/xlsxReports.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import assert from 'node:assert'
55
import { describe, it } from 'node:test'
66

77
import { isValidDateString, isValidTimeString } from '@cityssm/utils-datetime'
8+
import Debug from 'debug'
89

10+
import { DEBUG_ENABLE_NAMESPACES } from '../debug.config.js'
911
import {
1012
parseW114ExcelReport,
1113
parseW200ExcelReport,
@@ -23,6 +25,8 @@ import {
2325
w604ReportName
2426
} from '../xlsxReports.js'
2527

28+
Debug.enable(DEBUG_ENABLE_NAMESPACES)
29+
2630
await describe('node-faster-report-parser/xlsx', async () => {
2731
await it('Parses "W114 - Asset Master List"', () => {
2832
const results = parseW114ExcelReport('./samples/w114_assetMasterList.xlsx')

xlsxReports/assets/w114.assetMasterList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { dateToString } from '@cityssm/utils-datetime';
22
import Debug from 'debug';
3+
import { DEBUG_NAMESPACE } from '../../debug.config.js';
34
import { extractReportMetadata, getXLSXWorkBook, getXLSXWorkSheetData } from '../helpers.js';
4-
const debug = Debug('faster-report-parser:xlsx:w114');
5+
const debug = Debug(`${DEBUG_NAMESPACE}:xlsx:w114`);
56
export const w114ReportName = 'W114 - Asset Master List';
67
function isDataRow(row) {
78
return row.length === 19 && Number.isFinite(Number.parseFloat(row[2] ?? ''));

0 commit comments

Comments
 (0)