Skip to content

Commit d635e2d

Browse files
committed
Compile dist/
1 parent d50f6d9 commit d635e2d

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

dist/main/index.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,16 @@ function init() {
199199
}
200200

201201
function run() {
202+
if (!fs.existsSync(diskCachePath)) {
203+
return
204+
}
205+
202206
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
203207
.filter(d => d.isFile())
204208
.map(d => {
205209
const file = path.join(d.path, d.name)
206-
const stats = fs.statSync(file)
207-
return { file, mtime: stats.mtime, size: stats.size }
210+
const { mtime, size} = fs.statSync(file)
211+
return { file, mtime, size }
208212
})
209213
.sort((a, b) => b.mtime - a.mtime)
210214

@@ -232,14 +236,20 @@ function cacheChanged() {
232236
}
233237

234238
function computeDiskCacheHash() {
235-
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
236-
.filter(d => d.isFile())
237-
.map(d => d.path)
238-
.sort()
239+
let hash = crypto.createHash('sha256')
240+
241+
if (fs.existsSync(diskCachePath)) {
242+
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
243+
.filter(d => d.isFile())
244+
.map(d => d.path)
245+
.sort()
239246

240-
core.info(`Collected ${files.length} files`)
247+
hash.update(files.join('\n'))
248+
249+
core.info(`Collected ${files.length} files`)
250+
}
241251

242-
return crypto.createHash('sha256').update(files.join('\n')).digest('hex')
252+
return hash.digest('hex')
243253
}
244254

245255
module.exports = {

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,16 @@ function init() {
199199
}
200200

201201
function run() {
202+
if (!fs.existsSync(diskCachePath)) {
203+
return
204+
}
205+
202206
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
203207
.filter(d => d.isFile())
204208
.map(d => {
205209
const file = path.join(d.path, d.name)
206-
const stats = fs.statSync(file)
207-
return { file, mtime: stats.mtime, size: stats.size }
210+
const { mtime, size} = fs.statSync(file)
211+
return { file, mtime, size }
208212
})
209213
.sort((a, b) => b.mtime - a.mtime)
210214

@@ -232,14 +236,20 @@ function cacheChanged() {
232236
}
233237

234238
function computeDiskCacheHash() {
235-
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
236-
.filter(d => d.isFile())
237-
.map(d => d.path)
238-
.sort()
239+
let hash = crypto.createHash('sha256')
240+
241+
if (fs.existsSync(diskCachePath)) {
242+
const files = fs.readdirSync(diskCachePath, { withFileTypes: true, recursive: true })
243+
.filter(d => d.isFile())
244+
.map(d => d.path)
245+
.sort()
239246

240-
core.info(`Collected ${files.length} files`)
247+
hash.update(files.join('\n'))
248+
249+
core.info(`Collected ${files.length} files`)
250+
}
241251

242-
return crypto.createHash('sha256').update(files.join('\n')).digest('hex')
252+
return hash.digest('hex')
243253
}
244254

245255
module.exports = {

dist/post/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)