@tensorify.io/cli
Version:
Official CLI for Tensorify.io - Build, test, and deploy machine learning plugins
37 lines âĸ 1.63 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loginCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const auth_service_1 = require("../auth/auth-service");
const session_storage_1 = require("../auth/session-storage");
exports.loginCommand = new commander_1.Command("login")
.description("Authenticate with Tensorify.io")
.option("-d, --dev", "Use development environment")
.action(async (options) => {
try {
console.log(chalk_1.default.blue("đ Starting authentication with Tensorify.io..."));
const isDev = options.dev || process.env.NODE_ENV === "development";
await auth_service_1.authService.login(isDev);
// Save development environment preference
await (0, session_storage_1.updateConfig)({
isDev,
lastUsedEnv: isDev ? "dev" : "prod",
});
if (isDev) {
console.log(chalk_1.default.green("â
Successfully authenticated with development environment!"));
console.log(chalk_1.default.blue("âšī¸ Development environment will be used for subsequent commands"));
}
else {
console.log(chalk_1.default.green("â
Successfully authenticated!"));
}
}
catch (error) {
console.error(chalk_1.default.red("â Authentication failed:"), error.message);
process.exit(1);
}
});
//# sourceMappingURL=login.js.map