@spaship/sync-service
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -12,6 +12,2 @@ const fsp = require("fs").promises; | ||
async function deploy({ name, spaArchive, appPath, ref } = {}) { | ||
console.log( | ||
`[deploy] deploying "${name}", bundle saved to ${spaArchive}, extracting...` | ||
); | ||
// create a dir in the tmp_dir location, but keep the random archive name | ||
@@ -22,4 +18,2 @@ let tmpDir = `${spaArchive}-extracted`; | ||
console.log(`created tmp dir ${tmpDir}`); | ||
// extract the archive | ||
@@ -42,3 +36,2 @@ await decompress(spaArchive, tmpDir); | ||
if (isNpmPack) { | ||
console.log(`detected npm pack archive, moving into package/`); | ||
tmpDir = path.join(tmpDir, "package"); | ||
@@ -57,7 +50,8 @@ } | ||
const valid = common.config.validate(spaConfig); | ||
console.log("VALID?", valid); | ||
const validation = common.config.validate(spaConfig); | ||
if (!valid) { | ||
throw new Error("spa config is not valid"); | ||
if (!validation.valid) { | ||
throw new Error( | ||
`spaship.yaml is not valid: ${JSON.stringify(validation.errors)}` | ||
); | ||
} | ||
@@ -98,7 +92,7 @@ | ||
}); | ||
console.log( | ||
`first deploy of ${spaConfig.name}, adding deploy key ${deploykey}` | ||
); | ||
} | ||
// write htaccess file | ||
await common.htaccess.write(tmpDir, spaConfig); | ||
// deploy if: | ||
@@ -118,5 +112,5 @@ // no existing deploy key, or | ||
console.log(`[deploy] extracted "${name}" to ${destDir}, deploy complete.`); | ||
console.log(`[deploy] deployed "${spaConfig.name}" to ${destDir}`); | ||
} | ||
module.exports = deploy; |
{ | ||
"name": "@spaship/sync-service", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "The file synchronization service for the SPAship platform.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/spaship/sync-service", |
@@ -28,4 +28,3 @@ const path = require("path"); | ||
.then((result, err) => { | ||
console.log(`extracted successfully`); | ||
res.send("SPA uploaded successfully."); | ||
res.send("SPA deployed successfully."); | ||
}) | ||
@@ -35,3 +34,2 @@ .catch(err => { | ||
res.send("Deploy failed. " + err); | ||
console.log("booooo"); | ||
console.log(err); | ||
@@ -38,0 +36,0 @@ }); |
33926
426