-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Prompt fallback if connection to Sentry fails
* feat: Prompt for missing paramters as fallback * feat: Rename projectType to integration Add quiet mode * fix: Code Review changes * ref: Rename steps to integrations
- Loading branch information
Showing
27 changed files
with
344 additions
and
3,355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { IArgs, ProjectType } from './lib/Constants'; | ||
export { IArgs, Integration } from './lib/Constants'; | ||
export * from './lib/Setup'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Answers, prompt, Question } from 'inquirer'; | ||
import * as _ from 'lodash'; | ||
import { getIntegrationChoices, Integration } from '../Constants'; | ||
import { dim, green } from '../Helper/Logging'; | ||
import { BaseStep } from './BaseStep'; | ||
import { Cordova } from './Integrations/Cordova'; | ||
import { GenericJavascript } from './Integrations/GenericJavascript'; | ||
import { GenericNode } from './Integrations/GenericNode'; | ||
import { ReactNative } from './Integrations/ReactNative'; | ||
|
||
let projectPackage: any = {}; | ||
|
||
try { | ||
// If we run directly in setup-wizard | ||
projectPackage = require('../../package.json'); | ||
} catch { | ||
projectPackage = require(`${process.cwd()}/package.json`); | ||
} | ||
|
||
export class ChooseIntegration extends BaseStep { | ||
public async emit(answers: Answers) { | ||
// If we receive project type as an arg we skip asking | ||
let integrationPrompt = null; | ||
if (this.argv.integration) { | ||
integrationPrompt = { integration: this.argv.integration }; | ||
} else { | ||
if (this.argv.quiet) { | ||
throw new Error('You need to choose a integration'); | ||
} | ||
integrationPrompt = this.tryDetectingIntegration(); | ||
integrationPrompt = await prompt([ | ||
{ | ||
choices: getIntegrationChoices(), | ||
default: integrationPrompt, | ||
message: 'What integration do you want to set up?', | ||
name: 'integration', | ||
type: 'list', | ||
}, | ||
]); | ||
} | ||
|
||
let integration = null; | ||
switch (integrationPrompt.integration) { | ||
case Integration.reactNative: | ||
integration = new ReactNative(this.argv); | ||
break; | ||
case Integration.cordova: | ||
integration = new Cordova(this.argv); | ||
break; | ||
case Integration.node: | ||
integration = new GenericNode(this.argv); | ||
break; | ||
default: | ||
integration = new GenericJavascript(this.argv); | ||
break; | ||
} | ||
|
||
return { integration }; | ||
} | ||
|
||
public tryDetectingIntegration(): Integration | undefined { | ||
if (_.has(projectPackage, 'dependencies.react-native')) { | ||
return Integration.reactNative; | ||
} | ||
if (_.has(projectPackage, 'dependencies.cordova')) { | ||
return Integration.cordova; | ||
} | ||
return; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.