feat: add exclude config to skip directories during type generation #6214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
excludeconfiguration field tosst.config.tsthat allows users to specify directory patterns to skip during type generation. This prevents SST from generatingsst-env.d.ts,sst.pyi, andlib/sst.rbfiles in unwanted locations.Problem
SST recursively scans the entire project tree to generate type files with no way to exclude directories. This causes issues in monorepos with:
external/orvendor/directoriesReal-world example: A monorepo with submodules generates 913+
sst-env.d.tsfiles in ignored directories, creating noise ingit status.Solution
Add an
excludefield that accepts glob patterns:Implementation
Changes Made
Core Filesystem Logic (
internal/fs/fs.go)FindDownWithExcludes()with glob pattern support viafilepath.Match()FindDown()delegates to new function with empty exclude listnode_modulesand dotfile exclusionsConfiguration (
pkg/project/project.go)Exclude []stringfield to App structType Generation Pipeline
FindDownWithExcludes()Comprehensive Tests (
internal/fs/fs_test.go- NEW, 170 lines)testify/assertTest Results
Stats
filepath.Match()Why This Matters
.gitignore,tsconfig.exclude, Jest'stestPathIgnorePatternsNotes
This is the first test file for the
internal/fspackage, establishing testing patterns for filesystem operations. All existing tests continue to pass.