Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
cleanup

add gitignore

cleanup
  • Loading branch information
navidkpr committed Sep 25, 2024
1 parent 0319827 commit a6930a0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 309 deletions.
1 change: 1 addition & 0 deletions evals/bananalyzer-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
static
7 changes: 2 additions & 5 deletions evals/bananalyzer-ts/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ function validateEndUrlMatch(expected: string, actual: string): boolean {
// Updated evaluateExample function
export async function evaluateExample(exampleId: string): Promise<boolean> {
const examples = JSON.parse(
fs.readFileSync(
path.join(__dirname, "../bananalyzer/static/examples.json"),
"utf-8",
),
fs.readFileSync(path.join(__dirname, "./static/examples.json"), "utf-8"),
);
const example = examples.find((example: Example) => example.id === exampleId);
const stagehand = new Stagehand({ env: "LOCAL", verbose: 1 });
Expand All @@ -55,7 +52,7 @@ export async function evaluateExample(exampleId: string): Promise<boolean> {
// Handle MHTML Source
const mhtmlFilePath = path.resolve(
__dirname,
`../bananalyzer/static/${example.id}/index.mhtml`,
`./static/${example.id}/index.mhtml`,
);
const parsedMHTML = await parseMHTMLFile(mhtmlFilePath);

Expand Down
14 changes: 14 additions & 0 deletions evals/bananalyzer-ts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Get the directory of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Clone the repository
git clone https://github.com/reworkd/bananalyzer.git

# Copy the static folder to the script's directory
rm -rf "$SCRIPT_DIR/static"
cp -r bananalyzer/static "$SCRIPT_DIR"

# Remove the cloned repository
rm -rf bananalyzer
9 changes: 3 additions & 6 deletions evals/bananalyzer-ts/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import path from "path";

// Load examples
const examples = JSON.parse(
fs.readFileSync(
path.join(__dirname, "../bananalyzer/static/examples.json"),
"utf-8",
),
fs.readFileSync(path.join(__dirname, "./static/examples.json"), "utf-8"),
);

export const ExampleType = z.enum(["listing", "detail", "listing_detail"]);
Expand Down Expand Up @@ -73,7 +70,7 @@ export type Eval = z.infer<typeof EvalSchema>;

// Separate function to get predefined schema by name
export function getSchemaByName(schemaName: SchemaName): z.ZodRawShape {
const schemaPath = path.join(__dirname, "../bananalyzer/static/schemas.json");
const schemaPath = path.join(__dirname, "./static/schemas.json");
const schemasJson = JSON.parse(fs.readFileSync(schemaPath, "utf-8"));

if (!(schemaName in schemasJson)) {
Expand Down Expand Up @@ -130,6 +127,6 @@ function zodTypeFromJsonSchema(jsonSchema: any): z.ZodTypeAny {

// Function to read and parse the goals.json file
export function getGoals(): Record<string, string> {
const goalsPath = path.join(__dirname, "../bananalyzer/static/goals.json");
const goalsPath = path.join(__dirname, "./static/goals.json");
return JSON.parse(fs.readFileSync(goalsPath, "utf-8"));
}
273 changes: 0 additions & 273 deletions evals/bananalyzer-ts/server/public/f1b99917fa284587.css

This file was deleted.

Loading

0 comments on commit a6930a0

Please sign in to comment.