UNPKG

@applicaster/zapplicaster-cli

Version:

CLI Tool for the zapp app and Quick Brick project

54 lines (42 loc) 1.35 kB
const R = require("ramda"); const { resolve } = require("path"); const { inspect } = require("util"); const { runInShellAsync } = require("../../shell"); const logger = require("../../logger"); function pushZappifest({ pluginPath, dryRun, manifestOnly, zappOwnerAccountId, }) { return async function (platform) { const manifestPath = resolve(pluginPath, `manifests/${platform}.json`); const publishCommand = `zappifest publish --manifest ${manifestPath} --account ${zappOwnerAccountId}`; if (dryRun || manifestOnly) { logger.log(`running ${publishCommand}`); logger.log(`with manifest: ${inspect(require(manifestPath))}`); return true; } return await runInShellAsync(publishCommand); }; } async function zappifestPublish(configuration) { const { platforms, pluginPath, dryRun, manifestOnly, zappOwnerAccountId } = configuration; if (dryRun || manifestOnly) { logger.log( "Running with --dry-run or --manifest-only option - not actually pushing to zapp" ); } if (!platforms || !zappOwnerAccountId) { logger.log("Manifest does not exsist, Skipping publishing"); return true; } return Promise.all( R.map( pushZappifest({ pluginPath, dryRun, manifestOnly, zappOwnerAccountId }), platforms ) ); } module.exports = { zappifestPublish };