Skip to content

Commit

Permalink
bug: Fix some logging bugs and add output
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Feb 13, 2020
1 parent 8045993 commit d9fb789
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ async function doDeploy () {
const token = core.getInput('api-token')
const distDir = path.join(process.cwd(), core.getInput('dist-dir'))
const cleanup = core.getInput('cleanup')
console.log(typeof cleanup)

const client = new Neocities(token)

Expand All @@ -30,8 +31,9 @@ function statsHandler (opts = {}) {
case 'inspecting': {
switch (stats.status) {
case 'start': {
core.startGroup('Inspecting')
console.log(`Inspecting local (${opts.distDir}) and remote files...`)
core.startGroup('Inspecting files')
console.log('Inspecting local and remote files...')
console.log(`Dist directory: ${opts.distDir})`)
break
}
case 'progress': {
Expand Down Expand Up @@ -63,7 +65,7 @@ function statsHandler (opts = {}) {
const { tasks: { diffing } } = stats
console.log(`Done diffing local and remote files in ${prettyTime([0, stats.timer.elapsed])}`)
console.log(`${diffing.uploadCount} files to upload`)
console.log(`${diffing.deleteCount} ` + opts.cleanup ? 'files to delete' : 'orphaned files')
console.log(`${diffing.deleteCount} ` + (opts.cleanup ? 'files to delete' : 'orphaned files'))
console.log(`${diffing.skipCoount} files to skip`)
core.endGroup()
break
Expand All @@ -75,15 +77,15 @@ function statsHandler (opts = {}) {
switch (stats.status) {
case 'start': {
core.startGroup('Applying diff')
console.log('Uploading changes' + opts.cleanup ? ' and deleting orphaned files...' : '...')
console.log('Uploading changes' + (opts.cleanup ? ' and deleting orphaned files...' : '...'))
break
}
case 'progress': {
break
}
case 'stop': {
const { tasks: { uploadFiles, deleteFiles, skippedFiles } } = stats
console.log('Done uploading changes' + opts.cleanup ? ' and deleting orphaned files' : '' + ` in ${prettyTime([0, stats.timer.elapsed])}`)
console.log('Done uploading changes' + (opts.cleanup ? ' and deleting orphaned files' : '') + ` in ${prettyTime([0, stats.timer.elapsed])}`)
console.log(`Average upload speed: ${prettyBytes(uploadFiles.speed)}/s`)
if (opts.cleanup) console.log(`Average delete speed: ${prettyBytes(deleteFiles.speed)}/s`)
console.log(`Skipped ${skippedFiles.count} files (${prettyBytes(skippedFiles.size)})`)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@actions/core": "1.2.2",
"@actions/github": "2.1.0",
"async-neocities": "1.0.0",
"async-neocities": "1.0.1",
"pretty-bytes": "^5.3.0",
"pretty-time": "^1.1.0"
},
Expand Down

0 comments on commit d9fb789

Please sign in to comment.