Skip to content

Commit 208d44d

Browse files
fix(deps): update dependency json-2-csv to v5 (#4950)
* fix(deps): update dependency json-2-csv to v5 * update json2csv calls (no longer async) --------- Co-authored-by: Matt Seddon <[email protected]>
1 parent d5da8d1 commit 208d44d

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@
17151715
"appdirs": "1.1.0",
17161716
"execa": "5.1.1",
17171717
"fs-extra": "11.1.1",
1718-
"json-2-csv": "4.1.1",
1718+
"json-2-csv": "5.0.0",
17191719
"json5": "2.2.3",
17201720
"lodash.clonedeep": "4.5.0",
17211721
"lodash.get": "4.4.2",

extension/src/fileSystem/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ describe('writeJson', () => {
245245
})
246246

247247
describe('writeCsv', () => {
248-
it('should write csv into given file', async () => {
249-
await writeCsv('file-name.csv', [
248+
it('should write csv into given file', () => {
249+
writeCsv('file-name.csv', [
250250
{ nested: { string: 'string1' }, value: 3 },
251251
{ nested: { string: 'string2' }, value: 4 },
252252
{ nested: { string: 'string3' }, value: 6 }
@@ -260,8 +260,8 @@ describe('writeCsv', () => {
260260
})
261261

262262
describe('writeTsv', () => {
263-
it('should write tsv into given file', async () => {
264-
await writeTsv('file-name.tsv', [
263+
it('should write tsv into given file', () => {
264+
writeTsv('file-name.tsv', [
265265
{ nested: { string: 'string1' }, value: 3 },
266266
{ nested: { string: 'string2' }, value: 4 },
267267
{ nested: { string: 'string3' }, value: 6 }

extension/src/fileSystem/index.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -384,19 +384,13 @@ export const writeJson = <
384384
return writeFile(path, json)
385385
}
386386

387-
export const writeCsv = async (
388-
path: string,
389-
arr: Array<Record<string, unknown>>
390-
) => {
391-
const csv = await json2csv(arr)
387+
export const writeCsv = (path: string, arr: Array<Record<string, unknown>>) => {
388+
const csv = json2csv(arr)
392389
return writeFile(path, csv)
393390
}
394391

395-
export const writeTsv = async (
396-
path: string,
397-
arr: Array<Record<string, unknown>>
398-
) => {
399-
const csv = await json2csv(arr, { delimiter: { field: '\t' } })
392+
export const writeTsv = (path: string, arr: Array<Record<string, unknown>>) => {
393+
const csv = json2csv(arr, { delimiter: { field: '\t' } })
400394
return writeFile(path, csv)
401395
}
402396

extension/src/plots/model/index.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ export class PlotsModel extends ModelWithPersistence {
236236
}
237237

238238
public savePlotDataAsJson(filePath: string, plotId: string) {
239-
void this.savePlotData(filePath, plotId, data => {
240-
writeJson(filePath, data, true)
241-
return Promise.resolve()
242-
})
239+
this.savePlotData(filePath, plotId, data => writeJson(filePath, data, true))
243240
}
244241

245242
public savePlotDataAsCsv(filePath: string, plotId: string) {
@@ -508,10 +505,10 @@ export class PlotsModel extends ModelWithPersistence {
508505
return collectCustomPlotRawData(orderValue, experiments)
509506
}
510507

511-
private async savePlotData(
508+
private savePlotData(
512509
filePath: string,
513510
plotId: string,
514-
writeToFile: (rawData: Array<Record<string, unknown>>) => Promise<void>
511+
writeToFile: (rawData: Array<Record<string, unknown>>) => void
515512
) {
516513
const foundCustomPlot = this.customPlotsOrder.find(
517514
({ metric, param }) => getCustomPlotId(metric, param) === plotId
@@ -522,7 +519,7 @@ export class PlotsModel extends ModelWithPersistence {
522519
: this.getSelectedTemplatePlotData(plotId)
523520

524521
try {
525-
await writeToFile(rawData)
522+
writeToFile(rawData)
526523
void openFileInEditor(filePath)
527524
} catch {
528525
void Toast.showError('Cannot write to file')

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15595,10 +15595,10 @@ jsesc@~0.5.0:
1559515595
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
1559615596
integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=
1559715597

15598-
json-2-csv@4.1.1:
15599-
version "4.1.1"
15600-
resolved "https://registry.yarnpkg.com/json-2-csv/-/json-2-csv-4.1.1.tgz#ebba9c7dd60a35675ab47435cb19e716249e5163"
15601-
integrity sha512-xqP/61jVw6hlW5a+JuffbfGneYxuKOIixdSjmLtBY/qeNgMIzTc+vLRkTkLwb+ZVLHMqmJz64brY9U34BvIHZA==
15598+
json-2-csv@5.0.0:
15599+
version "5.0.0"
15600+
resolved "https://registry.yarnpkg.com/json-2-csv/-/json-2-csv-5.0.0.tgz#c8f8fc688a5c7460d48e01bce54c494f631b8bca"
15601+
integrity sha512-7+LmJmeO1UJqt8sqVYiSe5ufWGWPt1TwfdBSgCFLz66fq4jrX3K7+g8+J9gYc/Yp6VMfNhBSfZgaapBSt70IRQ==
1560215602
dependencies:
1560315603
deeks "3.0.2"
1560415604
doc-path "4.0.2"

0 commit comments

Comments
 (0)