@@ -44,15 +44,15 @@ async function generateIconFiles() {
44
44
)
45
45
46
46
if ( spriteUpToDate && typesUpToDate ) {
47
- console . log ( `Icons are up to date` )
47
+ logVerbose ( `Icons are up to date` )
48
48
return
49
49
}
50
50
51
51
logVerbose ( `Generating sprite for ${ inputDirRelative } ` )
52
52
53
- await fsExtra . emptyDir ( outputDir )
53
+ await fsExtra . ensureDir ( outputDir )
54
54
55
- const changedSprite = await generateSvgSprite ( {
55
+ const spriteChanged = await generateSvgSprite ( {
56
56
files,
57
57
inputDir,
58
58
outputPath : spriteFilepath ,
@@ -70,14 +70,14 @@ async function generateIconFiles() {
70
70
export type IconName =
71
71
\t| ${ stringifiedIconNames . join ( '\n\t| ' ) } ;
72
72
`
73
- const changedTypes = await writeIfChanged (
73
+ const typesChanged = await writeIfChanged (
74
74
typeOutputFilepath ,
75
75
typeOutputContent ,
76
76
)
77
77
78
78
logVerbose ( `Manifest saved to ${ path . relative ( cwd , typeOutputFilepath ) } ` )
79
79
80
- const changedIconReadme = await writeIfChanged (
80
+ const readmeChanged = await writeIfChanged (
81
81
path . join ( outputDir , 'README.md' ) ,
82
82
`# Icons
83
83
@@ -86,7 +86,8 @@ This directory contains SVG icons that are used by the app.
86
86
Everything in this directory is generated by \`npm run build:icons\`.
87
87
` ,
88
88
)
89
- if ( changedIconReadme || changedSprite || changedTypes ) {
89
+
90
+ if ( spriteChanged || typesChanged || readmeChanged ) {
90
91
console . log ( `Generated ${ files . length } icons` )
91
92
}
92
93
}
@@ -148,4 +149,5 @@ async function writeIfChanged(filepath: string, newContent: string) {
148
149
. catch ( ( ) => '' )
149
150
if ( currentContent === newContent ) return false
150
151
await fsExtra . writeFile ( filepath , newContent , 'utf8' )
152
+ return true
151
153
}
0 commit comments