Skip to content

Commit

Permalink
feat!: Drop support for unsupported versions of Node.js (#833)
Browse files Browse the repository at this point in the history
* feat!: Drop support for unsupported versions of Node.js

* Upgrade requisite libraries for node 20

* Remove whitesource unified agent

* Run npm audit fix

* Fix lint arrow body style

* Fix CI
  • Loading branch information
zackerydev authored Dec 27, 2023
1 parent 19ede77 commit b569da0
Show file tree
Hide file tree
Showing 111 changed files with 16,669 additions and 16,134 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ module.exports = {
'plugin:jest/recommended',
'plugin:jest/style',
'prettier',
'prettier/@typescript-eslint',
],
ignorePatterns: ['**/build', '**/node_modules', 'documentation'],
rules: {
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'warn',
'prettier/prettier': 'error',
'arrow-body-style': ['warn', 'always'],
'tsdoc/syntax': 'warn',
// never allow default export
'import/prefer-default-export': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [18.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/whitesource.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v20.10.0
4 changes: 4 additions & 0 deletions documentation/docs/introduction/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title: Installation
---

> [!NOTE]
> `fast-csv` only supports the currently supported releases of [nodejs](https://nodejs.org/en/about/releases/).
> You can find the currently supported releases [here](https://endoflife.date/nodejs).
## fast-csv

```sh
Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const promisfyStream = (stream, expectedRows) => {
if (count !== expectedRows) {
rej(new Error(`Error expected ${expectedRows} got ${count}`));
} else {
res();
res(() => {});
}
})
.on('error', rej);
Expand Down
31 changes: 31 additions & 0 deletions examples/example-runner/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/example-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@types/yargs": "16.0.1",
"globby": "11.0.3",
"jest-diff": "26.6.2",
"typescript": "4.0.5",
"typescript": "5.3.3",
"yargs": "16.2.0"
}
}
4 changes: 3 additions & 1 deletion examples/fast-csv-ts/examples/format.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import * as csv from 'fast-csv';

const csvStream = csv.format({ headers: true });

csvStream.pipe(process.stdout).on('end', () => process.exit());
csvStream.pipe(process.stdout).on('end', () => {
return process.exit();
});

csvStream.write({ header1: 'row1-col1', header2: 'row1-col2' });
csvStream.write({ header1: 'row2-col1', header2: 'row2-col2' });
Expand Down
12 changes: 9 additions & 3 deletions examples/fast-csv-ts/examples/parse.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import * as csv from 'fast-csv';

fs.createReadStream(path.resolve(__dirname, '..', 'assets', 'parse.csv'))
.pipe(csv.parse({ headers: true }))
.on('error', (error) => console.error(error))
.on('data', (row) => console.log(row))
.on('end', (rowCount: number) => console.log(`Parsed ${rowCount} rows`));
.on('error', (error) => {
return console.error(error);
})
.on('data', (row) => {
return console.log(row);
})
.on('end', (rowCount: number) => {
return console.log(`Parsed ${rowCount} rows`);
});

// Output:
// { header1: 'row1-col1', header2: 'row1-col2' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ interface UserDetailsRow {
fs.createReadStream(path.resolve(__dirname, '..', 'assets', 'snake_case_users.csv'))
.pipe(csv.parse({ headers: true }))
// pipe the parsed input into a csv formatter
.pipe(
csv.format<UserCsvRow, UserDetailsRow>({ headers: true }),
)
.pipe(csv.format<UserCsvRow, UserDetailsRow>({ headers: true }))
// Using the transform function from the formatting stream
.transform((row, next): void => {
User.findById(+row.id, (err, user) => {
Expand All @@ -49,7 +47,9 @@ fs.createReadStream(path.resolve(__dirname, '..', 'assets', 'snake_case_users.cs
});
})
.pipe(process.stdout)
.on('end', () => process.exit());
.on('end', () => {
return process.exit();
});

// Output:
// id,firstName,lastName,address,isVerified,hasLoggedIn,age
Expand Down
98 changes: 98 additions & 0 deletions examples/fast-csv-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/fast-csv-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"dependencies": {
"example-runner": "4.3.6",
"fast-csv": "4.3.6",
"typescript": "4.0.5"
"typescript": "5.3.3"
}
}
24 changes: 16 additions & 8 deletions examples/formatting-ts/examples/append.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ class CsvFile {
static write(stream: NodeJS.WritableStream, rows: Row[], options: FormatterOptionsArgs<Row, Row>): Promise<void> {
return new Promise((res, rej) => {
writeToStream(stream, rows, options)
.on('error', (err: Error) => rej(err))
.on('finish', () => res());
.on('error', (err: Error) => {
return rej(err);
})
.on('finish', () => {
return res();
});
});
}

Expand Down Expand Up @@ -66,15 +70,19 @@ csvFile
{ a: 'a3', b: 'b3', c: 'c3' },
])
// append rows to file
.then(() =>
csvFile.append([
.then(() => {
return csvFile.append([
{ a: 'a4', b: 'b4', c: 'c4' },
{ a: 'a5', b: 'b5', c: 'c5' },
]),
)
]);
})
// append another row
.then(() => csvFile.append([{ a: 'a6', b: 'b6', c: 'c6' }]))
.then(() => csvFile.read())
.then(() => {
return csvFile.append([{ a: 'a6', b: 'b6', c: 'c6' }]);
})
.then(() => {
return csvFile.read();
})
.then((contents) => {
console.log(contents.toString());
})
Expand Down
4 changes: 3 additions & 1 deletion examples/formatting-ts/examples/hash_array.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { format } from '@fast-csv/format';

const csvStream = format({ headers: true });

csvStream.pipe(process.stdout).on('end', () => process.exit());
csvStream.pipe(process.stdout).on('end', () => {
return process.exit();
});

csvStream.write([
['header', 'value1a'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { format } from '@fast-csv/format';

const csvStream = format({ headers: true });

csvStream.pipe(process.stdout).on('end', () => process.exit());
csvStream.pipe(process.stdout).on('end', () => {
return process.exit();
});

csvStream.write([
['header1', 'value1a'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { format } from '@fast-csv/format';

const csvStream = format({ headers: true });

csvStream.pipe(process.stdout).on('end', () => process.exit());
csvStream.pipe(process.stdout).on('end', () => {
return process.exit();
});

csvStream.write({ header1: 'value1a', header2: 'value1b' });
csvStream.write({ header1: 'value2a', header2: 'value2b' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { format } from '@fast-csv/format';

const csvStream = format({ headers: ['header1', 'header2'] });

csvStream.pipe(process.stdout).on('end', () => process.exit());
csvStream.pipe(process.stdout).on('end', () => {
return process.exit();
});

csvStream.write(['value1a', 'value1b']);
csvStream.write(['value2a', 'value2b']);
Expand Down
Loading

0 comments on commit b569da0

Please sign in to comment.