Summary
smrtPlugin still has legacy build behavior that writes a generated test-manifest-stub.ts into src/manifest whenever that directory exists. This dirties working trees in consumer packages and mixes generated build artifacts into tracked source.
Current behavior
In packages/core/src/vite-plugin/index.ts, closeBundle() does this:
- writes
dist/manifest.json
- checks whether
src/manifest/ exists
- if it does, writes
src/manifest/test-manifest-stub.ts
This means a package can end up with a modified tracked source file just from running a build.
Why this is a problem
- Generated build/test artifacts should not be written into
src/
- It creates noisy dirty worktrees
- It is easy for packages to accidentally keep legacy
src/manifest directories around
- The behavior is surprising because SMRT already prefers
.smrt/manifest.json and dist/manifest.json in newer flows
Reproduction
- In a package using
smrtPlugin, create src/manifest/
- Run
vite build
- Observe
src/manifest/test-manifest-stub.ts being generated by the plugin
- If that file is tracked, the checkout is now dirty
Evidence
Current logic in packages/core/src/vite-plugin/index.ts:
const manifestDir = resolve(projectRoot, "src/manifest")
if (existsSync(manifestDir)) { ... writeFileSync(resolve(manifestDir, "test-manifest-stub.ts"), stub) }
Expected behavior
Build output should stay in build/test output locations, not in src/.
Proposed fix
One of:
- Remove this legacy
src/manifest/test-manifest-stub.ts generation from closeBundle() entirely
- Generate the stub into
.smrt/ or dist/ instead
- Make the stub output path explicit/configurable and default it away from
src/
I would lean toward removing the implicit src/manifest write entirely unless there is still a hard compatibility requirement.
Context
This came up in anytown.ai while cleaning up a package that kept getting dirtied by a generated src/manifest/test-manifest-stub.ts on local builds. Removing the stale src/manifest/ directory fixes that package locally, but the root cause is still in smrt-core.
Summary
smrtPluginstill has legacy build behavior that writes a generatedtest-manifest-stub.tsintosrc/manifestwhenever that directory exists. This dirties working trees in consumer packages and mixes generated build artifacts into tracked source.Current behavior
In
packages/core/src/vite-plugin/index.ts,closeBundle()does this:dist/manifest.jsonsrc/manifest/existssrc/manifest/test-manifest-stub.tsThis means a package can end up with a modified tracked source file just from running a build.
Why this is a problem
src/src/manifestdirectories around.smrt/manifest.jsonanddist/manifest.jsonin newer flowsReproduction
smrtPlugin, createsrc/manifest/vite buildsrc/manifest/test-manifest-stub.tsbeing generated by the pluginEvidence
Current logic in
packages/core/src/vite-plugin/index.ts:const manifestDir = resolve(projectRoot, "src/manifest")if (existsSync(manifestDir)) { ... writeFileSync(resolve(manifestDir, "test-manifest-stub.ts"), stub) }Expected behavior
Build output should stay in build/test output locations, not in
src/.Proposed fix
One of:
src/manifest/test-manifest-stub.tsgeneration fromcloseBundle()entirely.smrt/ordist/insteadsrc/I would lean toward removing the implicit
src/manifestwrite entirely unless there is still a hard compatibility requirement.Context
This came up in
anytown.aiwhile cleaning up a package that kept getting dirtied by a generatedsrc/manifest/test-manifest-stub.tson local builds. Removing the stalesrc/manifest/directory fixes that package locally, but the root cause is still insmrt-core.