UNPKG

multi-clasp2

Version:

Google Clasp wrapper to push changes to multiple Apps Script projects at once.

48 lines 2.1 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const common_1 = require("./common"); /** * Get Clasp Arguments. * * @param options.nondev {boolean} If we want to push the last deployed version vs the latest code. * @param options.retry {number} If the push of an App Script fail with it will retry n times * @returns {string} the command arguments */ function getPushClaspArgs(options) { let claspArgs = ""; if (!options) { return claspArgs; } claspArgs += options.force ? " --force" : ""; return claspArgs; } /** * Uploads all files into the script.google.com filesystem. * @param options.watch {boolean} If true, runs `clasp push` when any local file changes. Exit with ^C. * @param options.retry {number} If the push of an App Script fail with it will retry n times */ exports.default = (options) => __awaiter(void 0, void 0, void 0, function* () { const retry = parseInt(options.retry); (0, common_1.foreachClasp)((claspConfig) => __awaiter(void 0, void 0, void 0, function* () { let retVal = false; for (let r = 0; r < retry; r++) { retVal = yield (0, common_1.runClasp)(claspConfig, process.argv[2], getPushClaspArgs(options)); if (retVal) { break; } } if (!retVal) { process.exit(1); } })); }); //# sourceMappingURL=push.js.map