Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prompt for example app name #8

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ Promise.resolve().then(async () => {
initial: true
})

const exampleAppName = generateExampleApp
? (
await prompt({
type: 'text',
name: 'exampleAppName',
message: 'Example app name?',
initial: 'example'
})
).exampleAppName
: null

const reactNativeVersion = generateExampleApp
? (
await prompt({
Expand Down Expand Up @@ -294,8 +305,6 @@ Promise.resolve().then(async () => {

const exampleAppTemplate = exampleTemplates.slice(-1)[0]

const exampleAppName = 'example'

const generateExampleAppOptions = ['--version', reactNativeVersion]

await execa(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ Array [
],
},
},
Object {
"prompts": Object {
"args": Array [
Object {
"initial": "example",
"message": "Example app name?",
"name": "exampleAppName",
"onState": [Function],
"type": "text",
},
],
},
},
Object {
"prompts": Object {
"args": Array [
Expand Down
1 change: 1 addition & 0 deletions tests/init-with-example/init-with-example.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mockPromptResponses = {
license: { license: 'BSD-4-CLAUSE' },
generateExampleApp: { generateExampleApp: true },
reactNativeVersion: { reactNativeVersion: 'react-native@latest' },
exampleAppName: { exampleAppName: 'example' },
showReactNativeOutput: { showReactNativeOutput: true }
}

Expand Down