Skip to content

Commit 7cb3ce4

Browse files
aspiersclaude
andcommitted
refactor(scripts): clarify generate-exports permission-set exclusion comment + rename var
Rename jsonFiles -> lexiconDocs (it now holds {filePath, doc} objects, not paths), and update the exclusion comment to describe the content-based check shared with codegen-lexicon-files.js rather than the old permissions/ path (review feedback). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e105b3f commit 7cb3ce4

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

scripts/generate-exports.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,20 @@ function pathToGeneratedType(filePath) {
159159
function generateIndex() {
160160
// Parse each lexicon once, then derive everything from the parsed doc — both
161161
// the permission-set check and the NSID — to avoid re-reading the same file.
162-
const jsonFiles = findJsonFiles(lexiconsDir)
162+
const lexiconDocs = findJsonFiles(lexiconsDir)
163163
.sort()
164164
.map((filePath) => ({
165165
filePath,
166166
doc: JSON.parse(readFileSync(join(lexiconsDir, filePath), "utf-8")),
167167
}))
168-
// Permission-set lexicons (lexicons/**/permissions/*.json) are published
169-
// as-is but have no TS shape — lex gen-api cannot codegen them, so they are
170-
// excluded from `generated/` here just as they are from the gen-* globs in
171-
// package.json. The two exclusions must stay aligned.
168+
// Permission-set lexicons have no TS shape — lex gen-api cannot codegen them
169+
// — so they are excluded from `generated/` here, by the SAME content check
170+
// (`main.type === "permission-set"`) that scripts/codegen-lexicon-files.js
171+
// uses to exclude them from the gen-* CLI invocations. Excluding by content
172+
// (not by path) keeps the two in lock-step regardless of where set files live.
172173
.filter(({ doc }) => doc?.defs?.main?.type !== "permission-set");
173174

174-
const lexicons = jsonFiles.map(({ filePath, doc }) => ({
175+
const lexicons = lexiconDocs.map(({ filePath, doc }) => ({
175176
path: filePath,
176177
importName: pathToImportName(filePath),
177178
namespace: pathToNamespace(filePath),

0 commit comments

Comments
 (0)