@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
53 lines (51 loc) • 1.98 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const Log_1 = require("../core/Log");
const GeneratorRegistrations_1 = require("../info/GeneratorRegistrations");
class ProjectUpdateRunner {
constructor(project) {
this.project = project;
}
async updateProject(includeUpdaters, excludeUpdaters) {
const updaters = GeneratorRegistrations_1.default.updaters;
const results = [];
if (!this.project) {
Log_1.default.throwUnexpectedUndefined("PURUP");
return;
}
for (let i = 0; i < updaters.length; i++) {
const updater = updaters[i];
const updaterIds = updater.getUpdateIds();
for (let j = 0; j < updaterIds.length; j++) {
if ((!includeUpdaters || includeUpdaters.includes(updater.id)) &&
(!excludeUpdaters || !excludeUpdaters.includes(updater.id))) {
const localResults = await updater.update(this.project, updaterIds[j]);
results.push(...localResults);
}
}
}
return results;
}
async update(updaterId, updaterIndex) {
const updaters = GeneratorRegistrations_1.default.updaters;
const allResults = [];
if (!this.project) {
Log_1.default.throwUnexpectedUndefined("PURU");
return [];
}
for (let i = 0; i < updaters.length; i++) {
const updater = updaters[i];
if (updater.id === updaterId) {
const results = await updater.update(this.project, updaterIndex);
for (const result of results) {
allResults.push(result);
}
}
}
return allResults;
}
}
exports.default = ProjectUpdateRunner;
//# sourceMappingURL=../maps/updates/ProjectUpdateRunner.js.map