zcatalyst-cli
Version:
Command Line Tool for CATALYST
62 lines (61 loc) • 3.56 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = __importDefault(require("../internal/command"));
const constants_1 = require("../util_modules/constants");
exports.default = new command_1.default('serve')
.description('Serve Basic I/O and Advanced I/O functions, Appsail and the client, to test them locally')
.option('--http <port>', 'start the server at specified port ')
.option('--debug <type:port>', 'the functions are invoked from local environment enabling debugging options on provided ports ' +
`(example: advancedio:<name>:${constants_1.DEFAULT.serve_port.debug.advancedio},basicio:${constants_1.DEFAULT.serve_port.debug.basicio})`)
.option('--proxy <url>', 'proxy url to proxy any unknown request to the given url ' +
'(e.g. "http://localhost:8080")')
.option('--only <targets>', 'only serve specified, comma-separated targets (e.g. "client,functions:f1")')
.option('--no-watch', 'disable watching the files for changes')
.option('--except <targets>', 'serve all targets except specified (e.g. "client")')
.option('--ignore-scripts', 'ignore the pre and post lifecycle scripts')
.option('--no-open', 'disable opening the client automatically when served')
.needs('auth', constants_1.NEEDED_SCOPES.SERVE)
.needs('config')
.needs('rc')
.action(() => __awaiter(void 0, void 0, void 0, function* () {
const optionFilter = yield Promise.resolve().then(() => __importStar(require('../option-filter')));
optionFilter.filterTargets();
optionFilter.filterPorts();
const serve = (yield Promise.resolve().then(() => __importStar(require('../serve')))).default;
return serve();
}));