Skip to content

Commit 17d02ff

Browse files
committed
Fix lint errors and skip ghost example dirs in CI scripts
1 parent df7e418 commit 17d02ff

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

scripts/build-all.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ function listExamples(filter = null) {
8383
.filter((dirent) => dirent.isDirectory())
8484
.map((dirent) => dirent.name)
8585
.filter((name) => !SKIPPED_EXAMPLES.has(name))
86+
// Skip ghost dirs left behind by renames or partial cache restores
87+
// (e.g. only `node_modules/` remains). A real example must ship a
88+
// `package.json`.
89+
.filter((name) =>
90+
fs.existsSync(path.join(examplesDir, name, 'package.json'))
91+
)
8692
.sort()
8793

8894
if (!filter) {

scripts/get-examples-for-project.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ function getExamplesForProject(projectName) {
4343
.readdirSync(examplesDir, {withFileTypes: true})
4444
.filter((dirent) => dirent.isDirectory())
4545
.map((dirent) => dirent.name)
46+
// Skip ghost dirs left behind by renames or partial cache restores
47+
// (e.g. only `node_modules/` remains). A real example must ship a
48+
// `package.json`.
49+
.filter((name) =>
50+
fs.existsSync(path.join(examplesDir, name, 'package.json'))
51+
)
4652

4753
const matchingExamples = allExamples.filter((example) =>
4854
pattern.test(example)

scripts/update-template-readmes.mjs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,12 +569,6 @@ const OVERRIDES = {
569569
// Title + headline
570570
// ──────────────────────────────────────────────────────────────────────────
571571

572-
function titleCaseFromSlug(slug) {
573-
return slug
574-
.split('-')
575-
.map((part) => part[0].toUpperCase() + part.slice(1))
576-
.join(' ')
577-
}
578572

579573
function frameworkLabel(framework) {
580574
switch (framework) {
@@ -652,7 +646,7 @@ function deriveHowItWorks(detected) {
652646
} else if (detected.surfaces.has('content')) {
653647
sentences.push(
654648
`A content script mounts ${langPrefix} UI inside a Shadow DOM and ` +
655-
`applies scoped styles so the host page can\'t bleed through.`
649+
`applies scoped styles so the host page can't bleed through.`
656650
)
657651
} else if (detected.surfaces.has('sidebar')) {
658652
sentences.push(
@@ -852,7 +846,9 @@ function processSlug(slug) {
852846
let prev = ''
853847
try {
854848
prev = fs.readFileSync(readmePath, 'utf8')
855-
} catch {}
849+
} catch {
850+
// README doesn't exist yet — treat as empty so we always (re)write.
851+
}
856852
const changed = prev !== readme
857853

858854
const notes = []

0 commit comments

Comments
 (0)