Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Default to bundleIdentifier value for package when prompted in eject
Browse files Browse the repository at this point in the history
  • Loading branch information
brentvatne committed Apr 14, 2020
1 parent 2e130d6 commit e30000e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/expo-cli/src/commands/eject/Eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ async function createNativeProjectsFromTemplateAsync(projectRoot: string): Promi
appJson.expo.ios = appJson.expo.ios ?? {};
appJson.expo.ios.bundleIdentifier = bundleIdentifier;

let packageName = await getOrPromptForPackage(projectRoot);
let packageName = await getOrPromptForPackage(projectRoot, bundleIdentifier);
appJson.expo.android = appJson.expo.android ?? {};
appJson.expo.android.package = packageName;

Expand Down Expand Up @@ -420,7 +420,10 @@ async function promptForNativeAppNameAsync(projectRoot: string): Promise<string>
return name!;
}

async function getOrPromptForBundleIdentifier(projectRoot: string): Promise<string> {
async function getOrPromptForBundleIdentifier(
projectRoot: string,
defaultValue?: string
): Promise<string> {
let { exp } = getConfig(projectRoot);

if (exp.ios?.bundleIdentifier) {
Expand All @@ -438,6 +441,7 @@ async function getOrPromptForBundleIdentifier(projectRoot: string): Promise<stri
const { bundleIdentifier } = await prompt([
{
name: 'bundleIdentifier',
default: defaultValue,
message: `What would you like your bundle identifier to be?`,
validate: (value: string) => /^[a-zA-Z][a-zA-Z0-9\-.]+$/.test(value),
},
Expand All @@ -447,7 +451,7 @@ async function getOrPromptForBundleIdentifier(projectRoot: string): Promise<stri
return bundleIdentifier;
}

async function getOrPromptForPackage(projectRoot: string): Promise<string> {
async function getOrPromptForPackage(projectRoot: string, defaultValue?: string): Promise<string> {
let { exp } = getConfig(projectRoot);

if (exp.android?.package) {
Expand All @@ -465,6 +469,7 @@ async function getOrPromptForPackage(projectRoot: string): Promise<string> {
const { packageName } = await prompt([
{
name: 'packageName',
default: defaultValue,
message: `What would you like your package to be named?`,
validate: (value: string) => /^[a-zA-Z][a-zA-Z0-9\-.]+$/.test(value),
},
Expand Down

0 comments on commit e30000e

Please sign in to comment.