@sentry/wizard
Version:
Sentry wizard helping you to configure your project
174 lines • 6.89 kB
JavaScript
"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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = void 0;
// @ts-expect-error - clack is ESM and TS complains about that. It works though
const clack = __importStar(require("@clack/prompts"));
const react_native_wizard_1 = require("./react-native/react-native-wizard");
const clack_1 = require("./utils/clack");
const Constants_1 = require("../lib/Constants");
const Env_1 = require("../lib/Helper/Env");
const Setup_1 = require("../lib/Setup");
const android_wizard_1 = require("./android/android-wizard");
const angular_wizard_1 = require("./angular/angular-wizard");
const apple_wizard_1 = require("./apple/apple-wizard");
const flutter_wizard_1 = require("./flutter/flutter-wizard");
const nextjs_wizard_1 = require("./nextjs/nextjs-wizard");
const nuxt_wizard_1 = require("./nuxt/nuxt-wizard");
const remix_wizard_1 = require("./remix/remix-wizard");
const sourcemaps_wizard_1 = require("./sourcemaps/sourcemaps-wizard");
const sveltekit_wizard_1 = require("./sveltekit/sveltekit-wizard");
const debug_1 = require("./utils/debug");
const version_1 = require("./version");
function preSelectedProjectArgsToObject(args) {
if (!args.preSelectedProject) {
return undefined;
}
return {
authToken: args.preSelectedProject.authToken,
selfHosted: args.preSelectedProject.selfHosted,
project: {
id: args.preSelectedProject.projectId,
keys: [
{
dsn: {
public: args.preSelectedProject.dsn,
},
},
],
organization: {
id: args.preSelectedProject.orgId,
name: args.preSelectedProject.orgName,
slug: args.preSelectedProject.orgSlug,
},
slug: args.preSelectedProject.projectSlug,
},
};
}
async function run(argv) {
const finalArgs = {
...argv,
...(0, Env_1.readEnvironment)(),
};
// Enable debug logs if the user has passed the --debug flag
if (finalArgs.debug) {
(0, debug_1.enableDebugLogs)();
}
let integration = finalArgs.integration;
if (!integration) {
clack.intro(`Sentry Wizard ${version_1.WIZARD_VERSION}`);
integration = await (0, clack_1.abortIfCancelled)(clack.select({
message: 'What do you want to set up?',
options: [
{ value: 'reactNative', label: 'React Native' },
{ value: 'flutter', label: 'Flutter' },
{ value: 'ios', label: 'iOS' },
{ value: 'angular', label: 'Angular' },
{ value: 'android', label: 'Android' },
{ value: 'cordova', label: 'Cordova' },
{ value: 'electron', label: 'Electron' },
{ value: 'nextjs', label: 'Next.js' },
{ value: 'nuxt', label: 'Nuxt' },
{ value: 'remix', label: 'Remix' },
{ value: 'sveltekit', label: 'SvelteKit' },
{ value: 'sourcemaps', label: 'Configure Source Maps Upload' },
],
}));
if (!integration) {
clack.log.error('No integration selected. Exiting.');
return;
}
clack.outro(`Starting ${integration} setup`);
}
const wizardOptions = {
telemetryEnabled: !finalArgs.disableTelemetry,
promoCode: finalArgs.promoCode,
url: finalArgs.url,
orgSlug: finalArgs.org,
projectSlug: finalArgs.project,
saas: finalArgs.saas,
preSelectedProject: preSelectedProjectArgsToObject(finalArgs),
forceInstall: finalArgs.forceInstall,
comingFrom: finalArgs.comingFrom,
ignoreGitChanges: finalArgs.ignoreGitChanges,
};
switch (integration) {
case 'reactNative':
await (0, react_native_wizard_1.runReactNativeWizard)(wizardOptions);
break;
case 'flutter':
await (0, flutter_wizard_1.runFlutterWizard)(wizardOptions);
break;
case 'ios':
await (0, apple_wizard_1.runAppleWizard)({
...wizardOptions,
projectDir: finalArgs.xcodeProjectDir,
});
break;
case 'android':
await (0, android_wizard_1.runAndroidWizard)(wizardOptions);
break;
case 'angular':
await (0, angular_wizard_1.runAngularWizard)(wizardOptions);
break;
case 'nextjs':
await (0, nextjs_wizard_1.runNextjsWizard)(wizardOptions);
break;
case 'nuxt':
await (0, nuxt_wizard_1.runNuxtWizard)(wizardOptions);
break;
case 'remix':
await (0, remix_wizard_1.runRemixWizard)(wizardOptions);
break;
case 'sveltekit':
await (0, sveltekit_wizard_1.runSvelteKitWizard)(wizardOptions);
break;
case 'sourcemaps':
await (0, sourcemaps_wizard_1.runSourcemapsWizard)(wizardOptions);
break;
case 'cordova':
argv.integration = 'cordova';
void (0, Setup_1.run)({
...argv,
url: argv.url ?? '',
integration: Constants_1.Integration.cordova,
platform: argv.platform ?? [],
}, wizardOptions);
break;
case 'electron':
argv.integration = 'electron';
void (0, Setup_1.run)({
...argv,
url: argv.url ?? '',
integration: Constants_1.Integration.electron,
platform: argv.platform ?? [],
}, wizardOptions);
break;
default:
clack.log.error('No setup wizard selected!');
}
}
exports.run = run;
//# sourceMappingURL=run.js.map