Skip to content

Commit

Permalink
Merge pull request #57 from docker/dependabot/npm_and_yarn/csv-parse-…
Browse files Browse the repository at this point in the history
…5.0.4

Bump csv-parse from 4.16.3 to 5.0.4
  • Loading branch information
crazy-max committed May 4, 2022
2 parents cd0aebd + 407697c commit 5595f90
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
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

0 comments on commit 5595f90

Please sign in to comment.