Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump csv-parse from 4.16.3 to 5.0.4 #57

Merged
merged 3 commits into from May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions jest.config.ts
@@ -1,10 +1,13 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
setupFiles: ["dotenv/config"],
setupFiles: ['dotenv/config'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
verbose: true
}
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/exec": "^1.1.1",
"csv-parse": "^4.16.3",
"csv-parse": "^5.0.4",
"semver": "^7.3.7",
"tmp": "^0.2.1"
},
Expand Down
18 changes: 10 additions & 8 deletions src/context.ts
@@ -1,4 +1,4 @@
import csvparse from 'csv-parse/lib/sync';
import {parse} from 'csv-parse/sync';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
Expand Down Expand Up @@ -96,19 +96,21 @@ export function getInputList(name: string, ignoreComma?: boolean): string[] {
return res;
}

for (const output of csvparse(items, {
const records = parse(items, {
columns: false,
relaxColumnCount: true,
skipLinesWithEmptyValues: true
}) as Array<string[]>) {
if (output.length == 1) {
res.push(output[0]);
skipEmptyLines: true
});

for (const record of records as Array<string[]>) {
if (record.length == 1) {
res.push(record[0]);
continue;
} else if (!ignoreComma) {
res.push(...output);
res.push(...record);
continue;
}
res.push(output.join(','));
res.push(record.join(','));
}

return res.filter(item => item).map(pat => pat.trim());
Expand Down
7 changes: 1 addition & 6 deletions yarn.lock
Expand Up @@ -1444,16 +1444,11 @@ cssstyle@^2.3.0:
dependencies:
cssom "~0.3.6"

csv-parse@*:
csv-parse@*, csv-parse@^5.0.4:
version "5.0.4"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.0.4.tgz#97e5e654413bcf95f2714ce09bcb2be6de0eb8e3"
integrity sha512-5AIdl8l6n3iYQYxan5djB5eKDa+vBnhfWZtRpJTcrETWfVLYN0WSj3L9RwvgYt+psoO77juUr8TG8qpfGZifVQ==

csv-parse@^4.16.3:
version "4.16.3"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.16.3.tgz#7ca624d517212ebc520a36873c3478fa66efbaf7"
integrity sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==

data-urls@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b"
Expand Down