Skip to content

Commit b31e598

Browse files
committed
feat: Fix version detection
1 parent 52a5c85 commit b31e598

File tree

8 files changed

+35
-12
lines changed

8 files changed

+35
-12
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
[![deps dev](https://david-dm.org/getsentry/sentry-wizard/dev-status.svg)](https://david-dm.org/getsentry/sentry-wizard?type=dev&view=list)
1717
[![deps peer](https://david-dm.org/getsentry/sentry-wizard/peer-status.svg)](https://david-dm.org/getsentry/sentry-wizard?type=peer&view=list)
1818

19+
# Usage
20+
21+
Install it with `npm` or `yarn`
22+
23+
```
24+
npm install @sentry/wizard
25+
```
26+
27+
Call `sentry-wizard` in your project and follow the instructions.
1928

2029
# Options
2130
```

lib/Constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// Key value should be the same here
12
export enum ProjectType {
2-
reactNative = 'react-native',
3+
reactNative = 'reactNative',
34
browser = 'browser',
45
node = 'node'
56
}

lib/Helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function prepareMessage(msg: any) {
88
return msg;
99
}
1010
if (msg instanceof Error) {
11-
return `${msg.name}: ${msg.message} ${msg.stack || ''}`;
11+
return `${msg.stack || ''}`;
1212
}
1313
return JSON.stringify(msg, null, '\t');
1414
}

lib/steps/Initial.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
import { Answers } from 'inquirer';
2+
import * as _ from 'lodash';
23
import { dim } from '../Helper';
34
import { BaseStep } from './Step';
45

56
let wizardPackage: any = {};
6-
let projectPackage: any = {};
7+
let sentryCliPackage: any = {};
78

89
try {
9-
// If we run directly in setup-wizard
10-
projectPackage = require('../../package.json');
11-
} catch {
12-
projectPackage = require(`${process.cwd()}/package.json`);
1310
wizardPackage = require(`${process.cwd()}/node_modules/@sentry/wizard/package.json`);
11+
} catch {
12+
// We don't need to have this
13+
}
14+
15+
try {
16+
sentryCliPackage = require(`${process.cwd()}/node_modules/sentry-cli-binary/package.json`);
17+
} catch {
18+
// We don't need to have this
1419
}
1520

1621
export class Initial extends BaseStep {
1722
public async emit(answers: Answers) {
1823
dim('Running Sentry Setup Wizard...');
1924
// TODO: get sentry cli version
20-
const sentryCliVersion = 'TODO';
21-
dim(`version: ${wizardPackage.version} | sentry-cli version: ${sentryCliVersion}`);
25+
dim(
26+
`version: ${_.get(wizardPackage, 'version', 'DEV')} | sentry-cli version: ${_.get(
27+
sentryCliPackage,
28+
'version',
29+
'DEV'
30+
)}`
31+
);
2232
return {};
2333
}
2434
}

lib/steps/OpenSentry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class OpenSentry extends BaseStep {
2727

2828
return { hash: data.hash };
2929
} catch (e) {
30+
e.message = `Could not connect to wizard @ ${baseUrl} try --url \n${e.message}`;
3031
throw e;
3132
}
3233
}

lib/steps/Welcome.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class Welcome extends BaseStep {
88
if (Welcome.didShow) {
99
return {};
1010
}
11-
green('Sentry Setup Wizard will help to configure your project');
11+
green('Sentry Wizard will you help to configure your project');
1212
dim('Thank you for using Sentry :)');
1313
Welcome.didShow = true;
1414
return {};

lib/steps/configure/ReactNative.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class ReactNative extends BaseStep {
6464
// rm 0.49 introduced an App.js for both platforms
6565
await patchMatchingFile('App.js', this.patchAppJs.bind(this));
6666
await this.addSentryProperties(platform, sentryCliProperties);
67-
green(`Successfully setup ${platform}`);
67+
green(`Successfully setup ${platform} for react-native`);
6868
} catch (e) {
6969
red(e);
7070
}
@@ -86,7 +86,7 @@ export class ReactNative extends BaseStep {
8686
);
8787
await patchMatchingFile('**/AppDelegate.m', this.unpatchAppDelegate.bind(this));
8888
await patchMatchingFile('**/app/build.gradle', this.unpatchBuildGradle.bind(this));
89-
green(`Successfully removed Sentry`);
89+
green(`Successfully removed Sentry from your react-native project`);
9090
return {};
9191
}
9292

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "@sentry/wizard",
33
"version": "0.1.0",
4+
"homepage": "https://github.com/getsentry/sentry-wizard",
5+
"repository": "https://github.com/getsentry/sentry-wizard",
46
"description": "Sentry wizard helping you to configure your project",
57
"bin": {
68
"sentry-wizard": "./dist/index.js"

0 commit comments

Comments
 (0)