-
Notifications
You must be signed in to change notification settings - Fork 478
Allow expo start --dev-client
in managed projects
#3523
Allow expo start --dev-client
in managed projects
#3523
Conversation
ENG-1130 managed support for expo start --dev-client
We should detect the scheme (and direct the user to add a scheme if missing) based on https://docs.expo.io/versions/latest/config/app/#scheme |
packages/expo-cli/src/schemes.ts
Outdated
lower: true, | ||
}), | ||
}); | ||
if (staticConfigPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit more like this
expo-cli/packages/expo-cli/src/commands/utils/modifyConfigAsync.ts
Lines 30 to 51 in 8b73a07
export async function attemptAddingPluginsAsync( | |
projectRoot: string, | |
exp: Pick<ExpoConfig, 'plugins'>, | |
plugins: string[] | |
): Promise<void> { | |
if (!plugins.length) return; | |
const edits = { | |
plugins: (exp.plugins || []).concat(plugins), | |
}; | |
const modification = await modifyConfigAsync(projectRoot, edits, { | |
skipSDKVersionRequirement: true, | |
}); | |
if (modification.type === 'success') { | |
Log.log(`\u203A Added config plugins: ${plugins.join(', ')}`); | |
} else { | |
const exactEdits = { | |
plugins, | |
}; | |
warnAboutConfigAndThrow(modification.type, modification.message!, exactEdits); | |
} | |
} |
packages/expo-cli/src/schemes.ts
Outdated
config.expo = { ...(config.expo as object), scheme }; | ||
await JsonFile.writeAsync(staticConfigPath, config); | ||
Log.log(`Scheme '${scheme}' updated in ${path.basename(staticConfigPath)}`); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would just ignore the dynamic config and create a potentially unused file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing dynamic config is handled by an earlier if – see https://github.com/expo/expo-cli/pull/3523/files#diff-ef67bc980d05133cc7b87b450cf4a04e1546cae27683bc12a749a925bb79cf09R105
If we land in this else branch it means there's no config (dynamic or static) at all so we just create an app.json.
if in a managed app we run maybe we can modify the config plugin to add a deterministic scheme derived from the project slug, and use that for |
That's a good point from @brentvatne. I have now removed the prompt for scheme and instead added autogeneration of schemes in the I'll add support for the autogenerated schemes to the CLI in a separate pull request. |
Why
It should be possible to use dev client with a managed project.
How
app.json
/app.config.*s
when there are no native project (managed project)Added a prompt for schema when it's not configured.Prompt has a good default.Test Plan
Created a managed project and verified that
expo start --dev-client
started the dev server. Tested with:app.json
including a schema -> started without warningsscheme
-> errorAlso set the
scheme
property inapp.json
to the URI scheme of an app that I had previously built and installed on my Android device. Runningexpod start --dev-client
and pressinga
opened the app.