Clean package.json & rebaseline snapshots (#328)
This commit is contained in:
@@ -418,11 +418,6 @@ Available packages and libraries:
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="eslint.config.js">
|
||||
// Contents omitted for brevity
|
||||
</dyad-file>
|
||||
@@ -454,6 +449,11 @@ export default {
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="src/App.css">
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
|
||||
@@ -418,11 +418,6 @@ Available packages and libraries:
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="eslint.config.js">
|
||||
// Contents omitted for brevity
|
||||
</dyad-file>
|
||||
@@ -454,6 +449,11 @@ export default {
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="src/App.css">
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
|
||||
@@ -418,11 +418,6 @@ Available packages and libraries:
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="eslint.config.js">
|
||||
// Contents omitted for brevity
|
||||
</dyad-file>
|
||||
@@ -454,6 +449,11 @@ export default {
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="src/App.css">
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
|
||||
@@ -418,11 +418,6 @@ Available packages and libraries:
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="eslint.config.js">
|
||||
// Contents omitted for brevity
|
||||
</dyad-file>
|
||||
@@ -454,6 +449,11 @@ export default {
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="README.md">
|
||||
# Welcome to your Dyad app
|
||||
|
||||
</dyad-file>
|
||||
|
||||
<dyad-file path="src/App.css">
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -30,7 +30,7 @@
|
||||
},
|
||||
{
|
||||
"path": "package.json",
|
||||
"content": "{\n \"name\": \"vite_react_shadcn_ts\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"vite build\",\n \"build:dev\": \"vite build --mode development\",\n \"lint\": \"eslint .\",\n \"preview\": \"vite preview\"\n },\n \"dependencies\": {\n \"@hookform/resolvers\": \"^3.9.0\",\n \"@radix-ui/react-accordion\": \"^1.2.0\",\n \"@radix-ui/react-alert-dialog\": \"^1.1.1\",\n \"@radix-ui/react-aspect-ratio\": \"^1.1.0\",\n \"@radix-ui/react-avatar\": \"^1.1.0\",\n \"@radix-ui/react-checkbox\": \"^1.1.1\",\n \"@radix-ui/react-collapsible\": \"^1.1.0\",\n \"@radix-ui/react-context-menu\": \"^2.2.1\",\n \"@radix-ui/react-dialog\": \"^1.1.2\",\n \"@radix-ui/react-dropdown-menu\": \"^2.1.1\",\n \"@radix-ui/react-hover-card\": \"^1.1.1\",\n \"@radix-ui/react-label\": \"^2.1.0\",\n \"@radix-ui/react-menubar\": \"^1.1.1\",\n \"@radix-ui/react-navigation-menu\": \"^1.2.0\",\n \"@radix-ui/react-popover\": \"^1.1.1\",\n \"@radix-ui/react-progress\": \"^1.1.0\",\n \"@radix-ui/react-radio-group\": \"^1.2.0\",\n \"@radix-ui/react-scroll-area\": \"^1.1.0\",\n \"@radix-ui/react-select\": \"^2.1.1\",\n \"@radix-ui/react-separator\": \"^1.1.0\",\n \"@radix-ui/react-slider\": \"^1.2.0\",\n \"@radix-ui/react-slot\": \"^1.1.0\",\n \"@radix-ui/react-switch\": \"^1.1.0\",\n \"@radix-ui/react-tabs\": \"^1.1.0\",\n \"@radix-ui/react-toast\": \"^1.2.1\",\n \"@radix-ui/react-toggle\": \"^1.1.0\",\n \"@radix-ui/react-toggle-group\": \"^1.1.0\",\n \"@radix-ui/react-tooltip\": \"^1.1.4\",\n \"@tanstack/react-query\": \"^5.56.2\",\n \"class-variance-authority\": \"^0.7.1\",\n \"clsx\": \"^2.1.1\",\n \"cmdk\": \"^1.0.0\",\n \"date-fns\": \"^3.6.0\",\n \"embla-carousel-react\": \"^8.3.0\",\n \"input-otp\": \"^1.2.4\",\n \"lucide-react\": \"^0.462.0\",\n \"next-themes\": \"^0.3.0\",\n \"react\": \"^18.3.1\",\n \"react-day-picker\": \"^8.10.1\",\n \"react-dom\": \"^18.3.1\",\n \"react-hook-form\": \"^7.53.0\",\n \"react-resizable-panels\": \"^2.1.3\",\n \"react-router-dom\": \"^6.26.2\",\n \"recharts\": \"^2.12.7\",\n \"sonner\": \"^1.5.0\",\n \"tailwind-merge\": \"^2.5.2\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"vaul\": \"^0.9.3\",\n \"zod\": \"^3.23.8\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.9.0\",\n \"@tailwindcss/typography\": \"^0.5.15\",\n \"@types/node\": \"^22.5.5\",\n \"@types/react\": \"^18.3.3\",\n \"@types/react-dom\": \"^18.3.0\",\n \"@vitejs/plugin-react-swc\": \"^3.9.0\",\n \"autoprefixer\": \"^10.4.20\",\n \"eslint\": \"^9.9.0\",\n \"eslint-plugin-react-hooks\": \"^5.1.0-rc.0\",\n \"eslint-plugin-react-refresh\": \"^0.4.9\",\n \"globals\": \"^15.9.0\",\n \"postcss\": \"^8.4.47\",\n \"tailwindcss\": \"^3.4.11\",\n \"typescript\": \"^5.5.3\",\n \"typescript-eslint\": \"^8.0.1\",\n \"vite\": \"^6.3.4\"\n }\n}\n"
|
||||
"content": "{\n \"dependencies\": {\n \"@hookform/resolvers\": \"^3.9.0\",\n \"@radix-ui/react-accordion\": \"^1.2.0\",\n \"@radix-ui/react-alert-dialog\": \"^1.1.1\",\n \"@radix-ui/react-aspect-ratio\": \"^1.1.0\",\n \"@radix-ui/react-avatar\": \"^1.1.0\",\n \"@radix-ui/react-checkbox\": \"^1.1.1\",\n \"@radix-ui/react-collapsible\": \"^1.1.0\",\n \"@radix-ui/react-context-menu\": \"^2.2.1\",\n \"@radix-ui/react-dialog\": \"^1.1.2\",\n \"@radix-ui/react-dropdown-menu\": \"^2.1.1\",\n \"@radix-ui/react-hover-card\": \"^1.1.1\",\n \"@radix-ui/react-label\": \"^2.1.0\",\n \"@radix-ui/react-menubar\": \"^1.1.1\",\n \"@radix-ui/react-navigation-menu\": \"^1.2.0\",\n \"@radix-ui/react-popover\": \"^1.1.1\",\n \"@radix-ui/react-progress\": \"^1.1.0\",\n \"@radix-ui/react-radio-group\": \"^1.2.0\",\n \"@radix-ui/react-scroll-area\": \"^1.1.0\",\n \"@radix-ui/react-select\": \"^2.1.1\",\n \"@radix-ui/react-separator\": \"^1.1.0\",\n \"@radix-ui/react-slider\": \"^1.2.0\",\n \"@radix-ui/react-slot\": \"^1.1.0\",\n \"@radix-ui/react-switch\": \"^1.1.0\",\n \"@radix-ui/react-tabs\": \"^1.1.0\",\n \"@radix-ui/react-toast\": \"^1.2.1\",\n \"@radix-ui/react-toggle\": \"^1.1.0\",\n \"@radix-ui/react-toggle-group\": \"^1.1.0\",\n \"@radix-ui/react-tooltip\": \"^1.1.4\",\n \"@tanstack/react-query\": \"^5.56.2\",\n \"class-variance-authority\": \"^0.7.1\",\n \"clsx\": \"^2.1.1\",\n \"cmdk\": \"^1.0.0\",\n \"date-fns\": \"^3.6.0\",\n \"embla-carousel-react\": \"^8.3.0\",\n \"input-otp\": \"^1.2.4\",\n \"lucide-react\": \"^0.462.0\",\n \"next-themes\": \"^0.3.0\",\n \"react\": \"^18.3.1\",\n \"react-day-picker\": \"^8.10.1\",\n \"react-dom\": \"^18.3.1\",\n \"react-hook-form\": \"^7.53.0\",\n \"react-resizable-panels\": \"^2.1.3\",\n \"react-router-dom\": \"^6.26.2\",\n \"recharts\": \"^2.12.7\",\n \"sonner\": \"^1.5.0\",\n \"tailwind-merge\": \"^2.5.2\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"vaul\": \"^0.9.3\",\n \"zod\": \"^3.23.8\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.9.0\",\n \"@tailwindcss/typography\": \"^0.5.15\",\n \"@types/node\": \"^22.5.5\",\n \"@types/react\": \"^18.3.3\",\n \"@types/react-dom\": \"^18.3.0\",\n \"@vitejs/plugin-react-swc\": \"^3.9.0\",\n \"autoprefixer\": \"^10.4.20\",\n \"eslint\": \"^9.9.0\",\n \"eslint-plugin-react-hooks\": \"^5.1.0-rc.0\",\n \"eslint-plugin-react-refresh\": \"^0.4.9\",\n \"globals\": \"^15.9.0\",\n \"postcss\": \"^8.4.47\",\n \"tailwindcss\": \"^3.4.11\",\n \"typescript\": \"^5.5.3\",\n \"typescript-eslint\": \"^8.0.1\",\n \"vite\": \"^6.3.4\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"path": "postcss.config.js",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -135,8 +135,12 @@ async function readFileWithCache(filePath: string): Promise<string | null> {
|
||||
}
|
||||
|
||||
// Read file and update cache
|
||||
const content = await fsAsync.readFile(filePath, "utf-8");
|
||||
fileContentCache.set(filePath, { content, mtime: currentMtime });
|
||||
const rawContent = await fsAsync.readFile(filePath, "utf-8");
|
||||
const content = cleanContent({ content: rawContent, filePath });
|
||||
fileContentCache.set(filePath, {
|
||||
content,
|
||||
mtime: currentMtime,
|
||||
});
|
||||
|
||||
// Manage cache size by clearing oldest entries when it gets too large
|
||||
if (fileContentCache.size > MAX_FILE_CACHE_SIZE) {
|
||||
@@ -157,6 +161,32 @@ async function readFileWithCache(filePath: string): Promise<string | null> {
|
||||
}
|
||||
}
|
||||
|
||||
function cleanContent({
|
||||
content,
|
||||
filePath,
|
||||
}: {
|
||||
content: string;
|
||||
filePath: string;
|
||||
}): string {
|
||||
// Why are we cleaning package.json?
|
||||
// 1. It contains unnecessary information for LLM context
|
||||
// 2. Fields like packageManager cause diffs in e2e test snapshots.
|
||||
if (path.basename(filePath) === "package.json") {
|
||||
try {
|
||||
const { dependencies, devDependencies } = JSON.parse(content);
|
||||
const cleanPackageJson = {
|
||||
dependencies,
|
||||
devDependencies,
|
||||
};
|
||||
return JSON.stringify(cleanPackageJson, null, 2);
|
||||
} catch (error) {
|
||||
logger.error(`Error cleaning package.json: ${filePath}`, error);
|
||||
return content;
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively walk a directory and collect all relevant files
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user