Skip to content

Commit

Permalink
prompt for example app name (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
brodybits committed Feb 27, 2020
1 parent 3ded5ff commit 94a5480
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
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

0 comments on commit 94a5480

Please sign in to comment.