From f17d23f5d8855bbe5fb0b242d9240427ca7b1238 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sat, 4 Mar 2023 21:03:46 +0800 Subject: [PATCH] A script for sorting contributors from weblate --- extra/sort-contributors.js | 22 ++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 extra/sort-contributors.js diff --git a/extra/sort-contributors.js b/extra/sort-contributors.js new file mode 100644 index 000000000..418bc233d --- /dev/null +++ b/extra/sort-contributors.js @@ -0,0 +1,22 @@ +const fs = require("fs"); + +// Read the file from private/sort-contributors.txt +const file = fs.readFileSync("private/sort-contributors.txt", "utf8"); + +// Convert to an array of lines +let lines = file.split("\n"); + +// Remove empty lines +lines = lines.filter((line) => line !== ""); + +// Remove duplicates +lines = [ ...new Set(lines) ]; + +// Remove @weblate and @UptimeKumaBot +lines = lines.filter((line) => line !== "@weblate" && line !== "@UptimeKumaBot"); + +// Sort the lines +lines = lines.sort(); + +// Output the lines, concat with " " +console.log(lines.join(" ")); diff --git a/package.json b/package.json index 8f808687f..f413309a9 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,8 @@ "cy:run:unit": "npx cypress run --browser chrome --headless --config-file ./config/cypress.frontend.config.js", "cypress-open": "concurrently -k -r \"node test/prepare-test-server.js && node server/server.js --port=3002 --data-dir=./data/test/\" \"cypress open --config-file ./config/cypress.config.js\"", "build-healthcheck-armv7": "cross-env GOOS=linux GOARCH=arm GOARM=7 go build -x -o ./extra/healthcheck-armv7 ./extra/healthcheck.go", - "depoly-demo-server": "node extra/deploy-demo-server.js" + "depoly-demo-server": "node extra/deploy-demo-server.js", + "sort-contributors": "node extra/sort-contributors.js" }, "dependencies": { "@grpc/grpc-js": "~1.7.3",