UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

77 lines (76 loc) 3.58 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.deployCommand = exports.DeployCommand = void 0; const IToolCommand_1 = require("../IToolCommand"); const CreatorToolsHost_1 = __importStar(require("../../CreatorToolsHost")); class DeployCommand extends IToolCommand_1.ToolCommandBase { metadata = { name: "deploy", description: "Show how to deploy the current project to a Minecraft instance", aliases: ["dp"], category: "Project", requiresProject: true, isWriteCommand: false, examples: ["/deploy", "/dp"], }; async execute(context, _args, _flags) { if (!context.project) { context.output.error("No active project — open a project before running /deploy."); return this.error("NO_PROJECT", "No active project"); } const isWebOnly = CreatorToolsHost_1.default.hostType === CreatorToolsHost_1.HostType.web || CreatorToolsHost_1.default.hostType === CreatorToolsHost_1.HostType.webPlusServices; if (isWebOnly) { context.output.warn("Web builds cannot deploy to your Minecraft installation — deployment requires filesystem access."); context.output.info("Open this project in the Electron desktop app, the VS Code extension, or run the CLI " + "(`npx mct deploy`) to push packs to com.mojang."); } else { context.output.info(`To deploy '${context.project.name}', open the project's Actions panel and use the ` + `"Deploy" dropdown to push to your local Minecraft installation, a dedicated server, ` + `or another configured target.`); context.output.info("Tip: from the CLI you can also run `npx mct deploy -i <project-folder>`."); } return this.success("Displayed deploy instructions", { projectName: context.project.name, hostType: CreatorToolsHost_1.default.hostType, hint: "Use Project Actions → Deploy dropdown", }); } } exports.DeployCommand = DeployCommand; exports.deployCommand = new DeployCommand();