Skip to content

Commit

Permalink
chore: handle newlines
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
kzantow committed Jul 27, 2024
1 parent 2da2040 commit f27b08b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# force unix line endings for consistent ncc output
*.js text eol=lf
package.json text eol=lf
package-lock.json text eol=lf
6 changes: 6 additions & 0 deletions dos2unix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const fs = require("fs");
for (const f of process.argv.slice(2)) {
let contents = fs.readFileSync(f, { encoding: "utf-8" });
contents = contents.replace(/\r/g, "");
fs.writeFileSync(f, contents, { encoding: "utf-8" });
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "anchore-scan-action",
"version": "2.0.2",
"description": "Anchore image scan github action",
"main": "index.js",
"source": "index.js",
"main": "dist/index.js",
"directories": {
"lib": "lib",
"test": "tests"
Expand All @@ -13,8 +14,8 @@
"test": "eslint index.js && npm run download-pinned-grype-db && GRYPE_DB_AUTO_UPDATE=false GRYPE_DB_CACHE_DIR=./grype-db GRYPE_DB_VALIDATE_AGE=false jest --runInBand",
"test:update-snapshots": "eslint index.js && npm run download-pinned-grype-db && GRYPE_DB_AUTO_UPDATE=false GRYPE_DB_CACHE_DIR=./grype-db GRYPE_DB_VALIDATE_AGE=false jest --updateSnapshot",
"download-pinned-grype-db": "mkdir -p grype-db/5 && curl -sL https://toolbox-data.anchore.io/grype/databases/vulnerability-db_v5_2022-10-17T08:14:57Z_b50a86ce07d268101316.tar.gz | tar zxf - -C grype-db/5",
"build": "ncc build ./index.js",
"precommit": "npm run build && git add dist/",
"build": "ncc build ./index.js && node dos2unix.js dist/index.js",
"precommit": "npm run prettier && npm run build && git add dist/",
"prepare": "husky install",
"prettier": "prettier -w *.js && prettier -w tests/*.js",
"update-deps": "ncu -u && npm i && npm audit fix"
Expand Down

0 comments on commit f27b08b

Please sign in to comment.