UNPKG

@rnv/engine-core

Version:
38 lines 1.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var questionHelpers_1 = require("../questionHelpers"); var getContext_1 = require("../../../getContext"); var Question = function (data) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { var c, _a, id, ci, inputs, validator, result; return tslib_1.__generator(this, function (_b) { switch (_b.label) { case 0: c = (0, getContext_1.getContext)(); _a = c.program.opts(), id = _a.id, ci = _a.ci; inputs = data.inputs; validator = function (appId) { return (typeof appId === 'string' && !!appId.match(/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/)) || 'Please enter a valid app ID (com.test.app)'; }; return [4 /*yield*/, (0, questionHelpers_1.validateAndAssign)({ value: id, validFn: validator, name: 'inputAppID', defaultVal: function () { var _a; inputs.appID = "com.mycompany.".concat((_a = inputs.projectName) === null || _a === void 0 ? void 0 : _a.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()); return inputs.appID; }, message: "What's your App ID?", warning: "Command contains invalid appId : ".concat(id), }, ci)]; case 1: result = _b.sent(); inputs.appID = result ? result.replace(/\s+/g, '-').toLowerCase() : inputs.appID; return [2 /*return*/]; } }); }); }; exports.default = Question; //# sourceMappingURL=appID.js.map