lambdaorm-cli
Version:
The lambdaorm command line interface
42 lines • 1.96 kB
JavaScript
;
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 });
exports.Export = void 0;
const path_1 = __importDefault(require("path"));
class Export {
// eslint-disable-next-line no-useless-constructor
constructor(service) {
this.service = service;
}
execute(workspace_1, target_1, stage_1, url_1) {
return __awaiter(this, arguments, void 0, function* (workspace, target, stage, url, force = false) {
const orm = this.service.orm.create({ workspace, url });
try {
yield orm.init();
const stageName = yield orm.getStageName(stage);
const exportFile = path_1.default.join(target, stageName + '-export.json');
const data = yield orm.stage.export(stageName, force);
yield this.service.helper.fs.write(exportFile, JSON.stringify(data));
}
catch (error) {
console.error(`error: ${error}`);
}
finally {
yield orm.end();
}
});
}
}
exports.Export = Export;
//# sourceMappingURL=export.js.map