From 71d0c8b2d0e5f4737f968975a16bfd7b2d47b87a Mon Sep 17 00:00:00 2001 From: Chris Campbell Date: Fri, 9 Dec 2022 18:17:59 -0800 Subject: [PATCH] fix: upgrade csv-parse to 5.3.3 and update option names (#300) Fixes #299 --- packages/compile/src/_shared/helpers.js | 2 +- packages/plugin-config/package.json | 2 +- packages/plugin-config/src/context.ts | 4 ++-- pnpm-lock.yaml | 8 ++------ 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/compile/src/_shared/helpers.js b/packages/compile/src/_shared/helpers.js index 3b3233dd..ec371a97 100644 --- a/packages/compile/src/_shared/helpers.js +++ b/packages/compile/src/_shared/helpers.js @@ -225,7 +225,7 @@ export let readCsv = (pathname, delimiter = ',') => { columns: false, trim: true, skip_empty_lines: true, - skip_lines_with_empty_values: true + skip_records_with_empty_values: true } try { let data = B.read(pathname) diff --git a/packages/plugin-config/package.json b/packages/plugin-config/package.json index 3e3f9992..c142a40f 100644 --- a/packages/plugin-config/package.json +++ b/packages/plugin-config/package.json @@ -33,7 +33,7 @@ }, "dependencies": { "byline": "^5.0.0", - "csv-parse": "^4.15.4", + "csv-parse": "^5.3.3", "sanitize-html": "^2.7.1" }, "peerDependencies": { diff --git a/packages/plugin-config/src/context.ts b/packages/plugin-config/src/context.ts index b626178d..b418df62 100644 --- a/packages/plugin-config/src/context.ts +++ b/packages/plugin-config/src/context.ts @@ -3,7 +3,7 @@ import { readFileSync } from 'fs' import { join as joinPath, relative } from 'path' -import parseCsv from 'csv-parse/lib/sync.js' +import { parse as parseCsv } from 'csv-parse/sync' import type { BuildContext, InputSpec, LogLevel, OutputSpec } from '@sdeverywhere/build' @@ -174,7 +174,7 @@ function readCsvFile(path: string): CsvRow[] { columns: true, trim: true, skip_empty_lines: true, - skip_lines_with_empty_values: true + skip_records_with_empty_values: true }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73637283..d64dd026 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -295,13 +295,13 @@ importers: '@types/sanitize-html': ^2.6.2 '@types/temp': ^0.9.1 byline: ^5.0.0 - csv-parse: ^4.15.4 + csv-parse: ^5.3.3 dedent: ^0.7.0 sanitize-html: ^2.7.1 temp: ^0.9.4 dependencies: byline: 5.0.0 - csv-parse: 4.16.3 + csv-parse: 5.3.3 sanitize-html: 2.7.1 devDependencies: '@sdeverywhere/build': link:../build @@ -1262,10 +1262,6 @@ packages: shebang-command: 2.0.0 which: 2.0.2 - /csv-parse/4.16.3: - resolution: {integrity: sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==} - dev: false - /csv-parse/5.3.3: resolution: {integrity: sha512-kEWkAPleNEdhFNkHQpFHu9RYPogsFj3dx6bCxL847fsiLgidzWg0z/O0B1kVWMJUc5ky64zGp18LX2T3DQrOfw==} dev: false