@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
36 lines (35 loc) • 1.59 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.exportCommand = exports.ExportCommand = void 0;
const IToolCommand_1 = require("../IToolCommand");
class ExportCommand extends IToolCommand_1.ToolCommandBase {
metadata = {
name: "export",
description: "Show how to export the current project as a .mcaddon",
aliases: ["exportaddon"],
category: "Project",
requiresProject: true,
isWriteCommand: false,
examples: ["/export", "/exportaddon"],
};
async execute(context, _args, _flags) {
if (!context.project) {
context.output.error("No active project — open a project before running /export.");
return this.error("NO_PROJECT", "No active project");
}
const project = context.project;
const message = `To export '${project.name}' as a .mcaddon, open the project's ` +
`Actions panel and use the "Export" dropdown. The dropdown lets you ` +
`select packs, choose an output folder, and produce .mcaddon / .mcpack files.`;
context.output.info(message);
context.output.info("Tip: from the CLI you can also run `npx mct exportaddon -i <project-folder>`.");
return this.success("Displayed export instructions", {
projectName: project.name,
hint: "Use Project Actions → Export dropdown",
});
}
}
exports.ExportCommand = ExportCommand;
exports.exportCommand = new ExportCommand();