Skip to content

Commit 6f5ec59

Browse files
committed
don't log from build-icons if nothing changed
1 parent ec86b9c commit 6f5ec59

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

other/build-icons.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ async function generateIconFiles() {
4444
)
4545

4646
if (spriteUpToDate && typesUpToDate) {
47-
console.log(`Icons are up to date`)
47+
logVerbose(`Icons are up to date`)
4848
return
4949
}
5050

5151
logVerbose(`Generating sprite for ${inputDirRelative}`)
5252

53-
await fsExtra.emptyDir(outputDir)
53+
await fsExtra.ensureDir(outputDir)
5454

55-
const changedSprite = await generateSvgSprite({
55+
const spriteChanged = await generateSvgSprite({
5656
files,
5757
inputDir,
5858
outputPath: spriteFilepath,
@@ -70,14 +70,14 @@ async function generateIconFiles() {
7070
export type IconName =
7171
\t| ${stringifiedIconNames.join('\n\t| ')};
7272
`
73-
const changedTypes = await writeIfChanged(
73+
const typesChanged = await writeIfChanged(
7474
typeOutputFilepath,
7575
typeOutputContent,
7676
)
7777

7878
logVerbose(`Manifest saved to ${path.relative(cwd, typeOutputFilepath)}`)
7979

80-
const changedIconReadme = await writeIfChanged(
80+
const readmeChanged = await writeIfChanged(
8181
path.join(outputDir, 'README.md'),
8282
`# Icons
8383
@@ -86,7 +86,8 @@ This directory contains SVG icons that are used by the app.
8686
Everything in this directory is generated by \`npm run build:icons\`.
8787
`,
8888
)
89-
if (changedIconReadme || changedSprite || changedTypes) {
89+
90+
if (spriteChanged || typesChanged || readmeChanged) {
9091
console.log(`Generated ${files.length} icons`)
9192
}
9293
}
@@ -148,4 +149,5 @@ async function writeIfChanged(filepath: string, newContent: string) {
148149
.catch(() => '')
149150
if (currentContent === newContent) return false
150151
await fsExtra.writeFile(filepath, newContent, 'utf8')
152+
return true
151153
}

0 commit comments

Comments
 (0)