forge-deploy-cli
Version:
Professional CLI for local deployments with automatic subdomain routing, SSL certificates, and infrastructure management
46 lines • 2.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopCommand = void 0;
const chalk_1 = __importDefault(require("chalk"));
const commander_1 = require("commander");
const localDeployment_1 = require("../services/localDeployment");
const config_1 = require("../services/config");
exports.stopCommand = new commander_1.Command('stop')
.description('Stop a local deployment')
.argument('[deployment-id]', 'Deployment ID to stop (optional, defaults to current project)')
.action(async (deploymentId) => {
try {
const configService = new config_1.ConfigService();
// If no deployment ID provided, try to get from current project
if (!deploymentId) {
const config = await configService.getConfig();
deploymentId = config.deploymentId;
if (!deploymentId) {
console.log(chalk_1.default.red('No deployment ID specified and no current project deployment found'));
console.log(chalk_1.default.gray('Usage: forge stop <deployment-id>'));
process.exit(1);
}
}
console.log(chalk_1.default.blue(`Stopping deployment: ${deploymentId}`));
const deployment = await localDeployment_1.LocalDeploymentManager.getDeployment(deploymentId);
if (!deployment) {
console.log(chalk_1.default.red('Local deployment not found'));
console.log(chalk_1.default.gray('Use "forge status" to see available deployments'));
process.exit(1);
}
if (deployment.status === 'stopped') {
console.log(chalk_1.default.yellow('Deployment is already stopped'));
return;
}
await localDeployment_1.LocalDeploymentManager.stopDeployment(deploymentId);
console.log(chalk_1.default.green('Deployment stopped successfully'));
}
catch (error) {
console.log(chalk_1.default.red(`Failed to stop deployment: ${error}`));
process.exit(1);
}
});
//# sourceMappingURL=stop.js.map