Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion VueApp/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
}
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
Expand Down
5 changes: 5 additions & 0 deletions scripts/build-dotnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const logger = createLogger("BUILD")

const artifactsPath = ".artifacts-precommit"

// Default execFileSync maxBuffer is 1 MB; full build output with all warnings can exceed
// that, which would surface as a false "build failed" instead of the real result.
const MAX_BUILD_OUTPUT = 10_485_760

// Check if either project needs rebuild
const webNeedsBuild = needsBuild("web", "Viper.csproj")
const testNeedsBuild = needsBuild("test", "Viper.test.csproj")
Expand Down Expand Up @@ -52,6 +56,7 @@ try {
{
encoding: "utf8",
timeout: 120_000,
maxBuffer: MAX_BUILD_OUTPUT,
stdio: ["inherit", "pipe", "pipe"],
env: { ...env, DOTNET_USE_COMPILER_SERVER: "1" },
},
Expand Down
29 changes: 29 additions & 0 deletions scripts/lib/build-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,30 @@ function getCachedBuildOutput(projectName) {
return cacheEntry.output || ""
}

/**
* Remove static-web-asset manifest and dswa caches under an obj/ root, leaving
* NuGet restore state and compiled output intact so an active `dotnet watch`
* session only has to redo its static-web-assets step.
* @param {string} objRoot - Path to a project's obj/ directory
*/
function clearStaticWebAssetCache(objRoot) {
if (!fs.existsSync(objRoot)) return
for (const config of fs.readdirSync(objRoot)) {
// Walk Debug/ and Release/ (skip files like project.assets.json at the root)
const configDir = path.join(objRoot, config)
if (!fs.statSync(configDir).isDirectory()) continue
for (const tfm of fs.readdirSync(configDir)) {
const tfmDir = path.join(configDir, tfm)
if (!fs.statSync(tfmDir).isDirectory()) continue
for (const entry of fs.readdirSync(tfmDir)) {
if (entry.startsWith("staticwebassets") || entry.endsWith(".dswa.cache.json")) {
fs.rmSync(path.join(tfmDir, entry), { recursive: true, force: true })
}
}
}
}
}

/**
* Clear the build cache for a specific project or all projects
* @param {string} [projectName] - Optional project name to clear, or undefined to clear all
Expand All @@ -308,6 +332,11 @@ function clearBuildCache(projectName) {
fs.rmSync(artifactsDir, { recursive: true, force: true })
}
}
// Clear stale static-web-asset state in web/obj — survives across artifact-path
// isolation and causes confusing "asset can not be found" errors when Vite bundle
// hashes change. Narrowly scoped so a running `npm run dev` session doesn't have
// to redo a full restore.
clearStaticWebAssetCache(path.join(process.cwd(), "web", "obj"))
// Clear ESLint cache
const eslintCache = path.join(process.cwd(), "VueApp", ".eslintcache")
if (fs.existsSync(eslintCache)) {
Expand Down
Loading