@appsemble/cli
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -25,3 +25,2 @@ #!/usr/bin/env node | ||
global: true, | ||
demand: true, | ||
}) | ||
@@ -28,0 +27,0 @@ .fail((msg, error = msg) => { |
@@ -5,2 +5,3 @@ const path = require('path'); | ||
const CLIError = require('../util/CLIError'); | ||
const extensionFromConfig = require('../util/extensionFromConfig'); | ||
@@ -27,2 +28,6 @@ const loadConfig = require('../util/loadConfig'); | ||
}) | ||
.option('ignore-duplicate', { | ||
description: 'Ignore duplicate ID errors. This is useful for example for automated deployments in continuous integration.', | ||
type: 'boolean', | ||
}) | ||
.positional('project', { | ||
@@ -51,5 +56,13 @@ description: 'The path to the extension project directory.', | ||
log.info('Updated extension'); | ||
await post(`/extensions/${extension.id}/versions`, version); | ||
try { | ||
await post(`/extensions/${extension.id}/versions`, version); | ||
} catch (error) { | ||
if (error instanceof CLIError && error.type === 'DuplicateIDError') { | ||
log.warn(`Ignoring DuplicateIDError: ${error.message}`); | ||
return; | ||
} | ||
throw error; | ||
} | ||
log.info('Created new version'); | ||
}, | ||
}; |
@@ -8,2 +8,8 @@ /** | ||
*/ | ||
module.exports = class CLIError extends Error {}; | ||
module.exports = class CLIError extends Error { | ||
constructor(message, details) { | ||
super(message); | ||
Object.assign(this, details); | ||
Error.captureStackTrace(this, CLIError); | ||
} | ||
}; |
@@ -34,6 +34,7 @@ const { | ||
} | ||
const responseBody = JSON.parse(response.body); | ||
if (response.statusCode >= 400) { | ||
throw new CLIError(JSON.parse(response.body).reason); | ||
throw new CLIError(responseBody.reason, responseBody); | ||
} | ||
return JSON.parse(response.body); | ||
return responseBody; | ||
} | ||
@@ -40,0 +41,0 @@ |
{ | ||
"name": "@appsemble/cli", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A CLI for the Appsemble extension platform", | ||
@@ -5,0 +5,0 @@ "homepage": "https://www.appsemble.com", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12001
335