UNPKG

atlassian-connect-express

Version:

Library for building Atlassian Add-ons on top of Express

31 lines (27 loc) 803 B
const utils = require("./utils"); module.exports = function (addon) { const firstPass = utils.replaceTokensInJson( utils.loadJSON(addon.descriptorFilename), "{{localBaseUrl}}", addon.config.localBaseUrl() ); const secondPass = utils.replaceTokensInJson( firstPass, "{{environment}}", addon.config.environment() ); const thirdPass = utils.replaceTokensInJson( secondPass, "{{appKey}}", addon.config.appKey() ); if (addon.config.product().isBitbucket) { // Omit unsupported field for bit bucket apps. delete thirdPass.apiMigrations; } let finalResult = thirdPass; if (typeof addon.config.descriptorTransformer === "function") { finalResult = addon.config.descriptorTransformer()(thirdPass, addon.config); } return finalResult; };