This commit is contained in:
Bret Comnes
2020-02-10 13:51:34 -07:00
parent 5c24e7da80
commit fc9f4dc3ad
5 changed files with 35 additions and 30 deletions

View File

@@ -1,27 +1,27 @@
{ {
"_from": "@actions/core@^1.2.2", "_from": "@actions/core@1.2.2",
"_id": "@actions/core@1.2.2", "_id": "@actions/core@1.2.2",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==", "_integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==",
"_location": "/@actions/core", "_location": "/@actions/core",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "range", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/core@^1.2.2", "raw": "@actions/core@1.2.2",
"name": "@actions/core", "name": "@actions/core",
"escapedName": "@actions%2fcore", "escapedName": "@actions%2fcore",
"scope": "@actions", "scope": "@actions",
"rawSpec": "^1.2.2", "rawSpec": "1.2.2",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^1.2.2" "fetchSpec": "1.2.2"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz", "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"_shasum": "3c4848d50378f9e3bcb67bcf97813382ec7369ee", "_shasum": "3c4848d50378f9e3bcb67bcf97813382ec7369ee",
"_spec": "@actions/core@^1.2.2", "_spec": "@actions/core@1.2.2",
"_where": "/Users/bret/repos/deploy-to-neocities", "_where": "/Users/bret/repos/deploy-to-neocities",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"

View File

@@ -1,27 +1,27 @@
{ {
"_from": "@actions/github@^2.1.0", "_from": "@actions/github@2.1.0",
"_id": "@actions/github@2.1.0", "_id": "@actions/github@2.1.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-G4ncMlh4pLLAvNgHUYUtpWQ1zPf/VYqmRH9oshxLabdaOOnp7i1hgSgzr2xne2YUaSND3uqemd3YYTIsm2f/KQ==", "_integrity": "sha512-G4ncMlh4pLLAvNgHUYUtpWQ1zPf/VYqmRH9oshxLabdaOOnp7i1hgSgzr2xne2YUaSND3uqemd3YYTIsm2f/KQ==",
"_location": "/@actions/github", "_location": "/@actions/github",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "range", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/github@^2.1.0", "raw": "@actions/github@2.1.0",
"name": "@actions/github", "name": "@actions/github",
"escapedName": "@actions%2fgithub", "escapedName": "@actions%2fgithub",
"scope": "@actions", "scope": "@actions",
"rawSpec": "^2.1.0", "rawSpec": "2.1.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^2.1.0" "fetchSpec": "2.1.0"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.0.tgz", "_resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.0.tgz",
"_shasum": "ca36cfb146b4c8955f3d5f88d8dde5f89194de21", "_shasum": "ca36cfb146b4c8955f3d5f88d8dde5f89194de21",
"_spec": "@actions/github@^2.1.0", "_spec": "@actions/github@2.1.0",
"_where": "/Users/bret/repos/deploy-to-neocities", "_where": "/Users/bret/repos/deploy-to-neocities",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"

View File

@@ -153,16 +153,21 @@ class NeocitiesAPIClient {
statsCb: () => {}, statsCb: () => {},
...opts ...opts
} }
const getRemoteFiles = this.list()
const [localFiles, remoteFiles] = Promise.all([ const [localFiles, remoteFiles] = Promise.all([
afw.allFiles(path.join(folder), { shaper: f => f }), afw.allFiles(path.join(folder), { shaper: f => f }),
this.list() getRemoteFiles
]) ])
const { filesToUpload, filesToDelete, filesSkipped } = await neocitiesLocalDiff(remoteFiles, localFiles) const { filesToUpload, filesToDelete, filesSkipped } = await neocitiesLocalDiff(remoteFiles, localFiles)
opts.statsCb({ filesToUpload, filesToDelete, filesSkipped }) opts.statsCb({ filesToUpload, filesToDelete, filesSkipped })
const work = [this.upload(filesToUpload)] const work = []
if (opts.cleanup) work.push(this.delete(filesToDelete)) const uploadJob = this.upload(filesToUpload)
work.push(uploadJob)
if (opts.cleanup) {
const deleteJob = this.delete(filesToDelete)
work.push(deleteJob)
}
await work await work

View File

@@ -1,26 +1,26 @@
{ {
"_from": "async-neocities-tmp@^0.0.4", "_from": "async-neocities-tmp@0.0.5",
"_id": "async-neocities-tmp@0.0.4", "_id": "async-neocities-tmp@0.0.5",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-sJMy3T04IDDxAVBZkqGcGy9NjFMW/rdCA8LC7tCgWYQA6/cGhjrnB85EVcjNWqjekEuogSTwrurblp7ZQxU5ww==", "_integrity": "sha512-jEu2qT3rpMa7P+aRHdhnF7lNBHJJpV+Bf3FoypIqSNn0gCi1FG+0ujsZ8eMbR/k0hu709Ar4r6WaVGDvp3npYQ==",
"_location": "/async-neocities-tmp", "_location": "/async-neocities-tmp",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "range", "type": "version",
"registry": true, "registry": true,
"raw": "async-neocities-tmp@^0.0.4", "raw": "async-neocities-tmp@0.0.5",
"name": "async-neocities-tmp", "name": "async-neocities-tmp",
"escapedName": "async-neocities-tmp", "escapedName": "async-neocities-tmp",
"rawSpec": "^0.0.4", "rawSpec": "0.0.5",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "^0.0.4" "fetchSpec": "0.0.5"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/async-neocities-tmp/-/async-neocities-tmp-0.0.4.tgz", "_resolved": "https://registry.npmjs.org/async-neocities-tmp/-/async-neocities-tmp-0.0.5.tgz",
"_shasum": "f0a2075db8899d149ccf3b8c2fc1893505e7ef3f", "_shasum": "dca9ee7fbb2847aebc29d3cb6e4981845abaca39",
"_spec": "async-neocities-tmp@^0.0.4", "_spec": "async-neocities-tmp@0.0.5",
"_where": "/Users/bret/repos/deploy-to-neocities", "_where": "/Users/bret/repos/deploy-to-neocities",
"author": { "author": {
"name": "Bret Comnes", "name": "Bret Comnes",
@@ -68,5 +68,5 @@
"dist" "dist"
] ]
}, },
"version": "0.0.4" "version": "0.0.5"
} }

View File

@@ -30,9 +30,9 @@
"tap": "^14.10.5" "tap": "^14.10.5"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.2.2", "@actions/core": "1.2.2",
"@actions/github": "^2.1.0", "@actions/github": "2.1.0",
"async-neocities-tmp": "^0.0.4" "async-neocities-tmp": "0.0.5"
}, },
"standard": { "standard": {
"ignore": [ "ignore": [