fairsplice
Advanced tools
| config.ts lib/average.ts lib/junit.ts backend/redis.ts |
+16
-4
@@ -29,2 +29,10 @@ #!/usr/bin/env bun | ||
| }, | ||
| ["replace-from"]: { | ||
| type: "string", | ||
| multiple: true, | ||
| }, | ||
| ["replace-to"]: { | ||
| type: "string", | ||
| multiple: true, | ||
| }, | ||
| out: { | ||
@@ -57,6 +65,8 @@ type: "string", | ||
| Available options: | ||
| --pattern <pattern> Pattern to match test files (can be used multiple times) | ||
| --total <total> Total number of workers | ||
| --index <index> Worker index | ||
| --out <file> File to write selected test files to (newline separated) | ||
| --pattern <pattern> Pattern to match test files (can be used multiple times) | ||
| --total <total> Total number of workers | ||
| --index <index> Worker index | ||
| --out <file> File to write selected test files to (newline separated) | ||
| --replace-from <string> Substring to replace in the file paths (can be used multiple times) | ||
| --replace-to <string> Replacement for the substring (can be used multiple times but must match the number of --replace-from) | ||
@@ -84,2 +94,4 @@ Example: fairsplice select --pattern "test_*.py" --pattern "tests*.py" --total 3 --index 1 --out selected.txt | ||
| out: values.out, | ||
| replaceFrom: values["replace-from"], | ||
| replaceTo: values["replace-to"], | ||
| }); | ||
@@ -86,0 +98,0 @@ process.exit(0); |
+1
-1
| { | ||
| "name": "fairsplice", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "module": "index.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+2
-0
@@ -62,2 +62,4 @@ # Fairsplice | ||
| - `--out <file>`: File to write selected test files to (newline separated) | ||
| - `--replace-from <string>`: Substring to replace in the file paths (can be used multiple times) | ||
| - `--replace-to <string>`: Replacement for the substring (can be used multiple times but must match the number of --replace-from) | ||
@@ -64,0 +66,0 @@ Example: |
@@ -11,2 +11,4 @@ import { Glob } from "bun"; | ||
| index, | ||
| replaceFrom, | ||
| replaceTo, | ||
| out, | ||
@@ -17,2 +19,4 @@ }: { | ||
| index: string | undefined; | ||
| replaceFrom: string[] | undefined; | ||
| replaceTo: string[] | undefined; | ||
| out: string | undefined; | ||
@@ -27,2 +31,9 @@ }) { | ||
| if (replaceFrom && replaceTo && replaceFrom.length !== replaceTo.length) { | ||
| console.warn( | ||
| "The number of --replace-from and --replace-to flags must match." | ||
| ); | ||
| process.exit(1); | ||
| } | ||
| // get files | ||
@@ -35,2 +46,14 @@ const files: string[] = []; | ||
| // replace strings | ||
| if (replaceFrom && replaceTo) { | ||
| for (let i = 0; i < replaceFrom.length; i++) { | ||
| const from = replaceFrom[i]; | ||
| const to = replaceTo[i]; | ||
| files.forEach((file, index) => { | ||
| files[index] = file.replace(from, to); | ||
| }); | ||
| } | ||
| } | ||
| // hash files | ||
| let hashToFile: Record<string, string> = {}; | ||
@@ -67,4 +90,4 @@ let fileToHash: Record<string, string> = {}; | ||
| const filenames = | ||
| selected[indexInt].map((hash) => hashToFile[hash]).join("\n") + "\n"; | ||
| selected[indexInt].map((hash) => hashToFile[hash]).join(" ") + "\n"; | ||
| await Bun.write(out, filenames); | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
31386
4.46%18
5.88%408
8.8%102
2%