fauna-gql-upload
Version:
Manage your FaunaDB resources in within your project and upload them using a single command
39 lines (38 loc) • 1.2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
exports.__esModule = true;
var index_1 = require("./index");
var getConfig_1 = require("./util/getConfig");
var yargs_1 = __importDefault(require("yargs"));
var init_1 = __importDefault(require("./lib/init"));
var resources = [
"schema",
"data",
"functions",
"indexes",
"providers",
"roles"
];
function _upload() {
var override = getConfig_1.argv.override;
var useResources = resources.filter(function (resource) { return getConfig_1.argv[resource]; });
(0, index_1.upload)({
override: override,
// Pass empty array if --ignore-all is provided,
resources: useResources.length > 0 ? useResources : undefined
});
}
// Define commands
yargs_1["default"]
// Command for initializing FGU
.command("init", "Initialize FGU in the current directory", {}, init_1["default"])
// Default command
.command(["upload", "$0"], "Upload resources", {}, _upload)
.demandCommand()
.argv;
process.addListener("unhandledRejection", function (e) {
throw e;
});