ryuu
Version:
Domo App Dev Studio CLI, The main tool used to create, edit, and publish app designs to Domo
38 lines • 1.44 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDesignId = getDesignId;
const manifest_1 = require("../util/manifest");
const log_1 = require("../util/log");
const validator_1 = __importDefault(require("validator"));
/**
* Takes up to two args to check for a valid design id and gives priority to
* the first argument
* @param {String} arg1 designId arg that will take priority if both args
* are defined and valid
* @param {String} man object defining the program manifest of the current
* context
* @return {String} Returns id with this priority: arg1, arg2,
* manifest.id, null
* @return {void} Returns void with an error log.
*/
function getDesignId(id, manifestPath) {
if (id) {
if (!validator_1.default.isUUID(id)) {
log_1.log.fail(`The argument ${id} is not a valid design ID`);
return undefined;
}
}
else {
const manifest = manifest_1.ManifestUtils.getManifest(manifestPath);
if (!manifest || !manifest.id) {
log_1.log.fail('No manifest found. Please supply design id using -i or change to a directory with a valid manifest file');
return undefined;
}
id = manifest.id;
}
return id;
}
//# sourceMappingURL=design.js.map