roku-pkg-cli
Version:
A comprehensive CLI tool for managing multiple Roku projects with automated device discovery, build integration, and package generation. Perfect for CI/CD pipelines with full automation support.
66 lines (65 loc) ⢠2.78 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeCommand = removeCommand;
const inquirer_1 = __importDefault(require("inquirer"));
const config_manager_1 = require("../lib/config-manager");
const chalk_1 = __importDefault(require("chalk"));
function removeCommand(program) {
program
.command('remove [project]')
.description('Remove a project')
.action(async (projectName) => {
const configManager = new config_manager_1.ConfigManager();
const projects = configManager.getProjects();
if (projects.length === 0) {
console.log(chalk_1.default.red('\nNo projects configured.\n'));
return;
}
// Select project if not specified
if (!projectName) {
const { selectedProject } = await inquirer_1.default.prompt([
{
type: 'list',
name: 'selectedProject',
message: 'Select a project to remove:',
choices: projects.map(p => p.name)
}
]);
projectName = selectedProject;
}
const project = configManager.getProject(projectName);
if (!project) {
console.log(chalk_1.default.red(`\nProject '${projectName}' not found.\n`));
return;
}
// Show project details before confirmation
console.log(chalk_1.default.bold(`\nđď¸ Removing ${chalk_1.default.red(project.name)}\n`));
console.log(chalk_1.default.gray('Project details:'));
console.log(chalk_1.default.gray(` Sign Key: ${project.signKey.substring(0, 8)}...`));
console.log(chalk_1.default.gray(` Package: ${project.signPackageLocation}`));
console.log(chalk_1.default.gray(` Output: ${project.outputLocation}\n`));
// Confirm deletion
const { confirmDelete } = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'confirmDelete',
message: `Are you sure you want to remove '${project.name}'?`,
default: false
}
]);
if (!confirmDelete) {
console.log(chalk_1.default.yellow('\nRemoval cancelled.\n'));
return;
}
const removed = configManager.removeProject(project.name);
if (removed) {
console.log(chalk_1.default.green(`\nâ Project '${project.name}' removed successfully\n`));
}
else {
console.log(chalk_1.default.red(`\nFailed to remove project '${project.name}'\n`));
}
});
}