sleeveforarm
Version:
Making Azure Easy
71 lines • 2.96 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Yargs = require("yargs");
const CliUtilities = require("./cliUtilities");
const Resource = require("./resource");
// tslint:disable-next-line:no-unused-expression
Yargs
.command("init", "Initialize a new Sleeve project", {}, function (argv) {
return __awaiter(this, void 0, void 0, function* () {
CliUtilities.setLoggingIfNeeded(argv);
yield CliUtilities.init(process.cwd());
});
})
.command("setup", "Setup a new instance of a resource", function (moreYargs) {
return moreYargs.option("n", {
alias: "resourceName",
describe: "Name of the resource to setup and the directory it will be created \
in"
})
.option("t", {
alias: "resourceType",
choices: ["webapp-node", "mySqlAzure"],
describe: "Type of resource to setup"
});
}, function (argv) {
return __awaiter(this, void 0, void 0, function* () {
CliUtilities.setLoggingIfNeeded(argv);
const targetPath = yield CliUtilities.setup(process.cwd(), argv.resourceName, argv.resourceType);
console.log(`Resource created in ${targetPath}`);
});
})
.command("deploy", "Deploy resources in current project", function (moreYargs) {
return moreYargs.option("t", {
alias: "deploymentType",
choices: [Resource.DeployType.LocalDevelopment,
Resource.DeployType.Production],
describe: "Set deployment type to either local deployment or \
deploy to Azure production"
});
}, function (argv) {
return __awaiter(this, void 0, void 0, function* () {
CliUtilities.setLoggingIfNeeded(argv);
yield CliUtilities.deployResources(process.cwd(), argv.deploymentType);
});
})
.option("v", {
alias: "verbose",
describe: "Outputs logs to file and screen"
})
.command("manage", "Manage resources in deployed environments", {}, function (argv) {
return __awaiter(this, void 0, void 0, function* () {
CliUtilities.setLoggingIfNeeded(argv);
yield CliUtilities.manageResource(process.cwd());
});
})
.command("*", "", {}, function (argv) {
Yargs.showHelp();
})
.help(true)
.strict()
.version()
.argv;
//# sourceMappingURL=cli.js.map