UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

52 lines 2.44 kB
"use strict"; 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 (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSentryCLIRC = void 0; // @ts-expect-error - clack is ESM and TS complains about that. It works though const prompts_1 = __importDefault(require("@clack/prompts")); const chalk_1 = __importDefault(require("chalk")); const fs = __importStar(require("fs")); const path = __importStar(require("path")); function createSentryCLIRC(directory, params) { const rcPath = path.join(directory, '.sentryclirc'); fs.writeFileSync(rcPath, '[auth]\ntoken=' + params.auth_token); const gitignorePath = path.join(directory, '.gitignore'); if (!fs.existsSync(gitignorePath)) { prompts_1.default.log.info(`Creating .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`); fs.writeFileSync(gitignorePath, '.sentryclirc'); } else { const gitIgnore = fs.readFileSync(gitignorePath).toString(); if (!gitIgnore.includes('.sentryclirc')) { prompts_1.default.log.info(`Appending .sentryclirc to .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`); fs.appendFileSync(gitignorePath, '\n.sentryclirc\n'); } } } exports.createSentryCLIRC = createSentryCLIRC; //# sourceMappingURL=sentrycli-utils.js.map