bedrock-development
Version:
APIs for creating and editing files related to Minecraft Bedrock development.
33 lines (32 loc) • 1.7 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 _a;
import { chalk, getConfig, setConfig } from "../../utils.js";
import { CommandMap } from "../command_map.js";
CommandMap.addCommand("root.format.addon", {
parent: (_a = CommandMap.getCommandEntry("root.format")) === null || _a === void 0 ? void 0 : _a.command,
commandOptions(command) {
command
.name("addon")
.description("converts a project into addon format")
.argument("<name>", "addon namespace as <team_name>_<project_name>");
},
commandAction: triggerAddonFormatting,
});
// TODO: Have this function actually update a project to the addon rules.
function triggerAddonFormatting(name) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const config = (_a = getConfig()) !== null && _a !== void 0 ? _a : { addon_namespace: name };
config.addon_namespace = name;
console.log(`${chalk.green(`Set addon namespace (${config.addon_namespace}) to config file`)}`);
setConfig(config);
});
}