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

[cli] add support back for owner field when cred checking #1941

Merged
merged 6 commits into from
Apr 25, 2020

Conversation

quinlanj
Copy link
Member

@quinlanj quinlanj commented Apr 21, 2020

why

We used to support builds where if User A gave User B permission to build their app, User B would be able to build User A's app. However, User B would need to specify UserA was the owner of the app in the owner field of the app.json.

When we moved to the new credential checker, we overlooked this use case. We add it back now by doing the following:

  • Add username field to credential's IosApi
  • Add owner in the api's request body or query parameter as appropriate

todo

@quinlanj quinlanj changed the title [DO NOT MERGE][cli] add support back for owner field when cred checking Apr 22, 2020
@@ -31,7 +32,8 @@ export async function fetchAndroidKeystoreAsync(projectDir: string): Promise<voi
await maybeRenameExistingFile(projectDir, keystoreFilename);
const backupKeystoreOutputPath = path.resolve(projectDir, keystoreFilename);

const view = new DownloadKeystore(ctx.manifest.slug);
invariant(ctx.manifest.slug, 'app.json slug field must be set');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in current expo-cli versions we set the slug automatically if it's not provided in app.json, so it would certainly be weird to get into this state! good to have that invariant

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were we encountering cases where slug was not set?

Copy link
Member Author

@quinlanj quinlanj Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i changed the type of manifest from any to ExpoConfig in context.ts, and slug could be undefined in this case - so i added invariant checks to get rid of the errors

@@ -64,6 +70,9 @@ export class Context {
const { exp } = getConfig(projectDir);
this._manifest = exp;
this._hasProjectContext = true;
this._iosApiClient = new IosApi(this.user).withProjectContext(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use some more context on what's going on here - why do create an api client if the status is fatal? and why not with the project context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i updated this with better comments -- basically we use Doctor.validateWithoutNetworkAsync to check whether there is a manifest in the project directory. If there is (we get a non fatal response), we initialize the necesary project context things, else we do a normal initialization

@codecov-io
Copy link

codecov-io commented Apr 24, 2020

Codecov Report

Merging #1941 into master will increase coverage by 0.39%.
The diff coverage is 98.34%.

Flag Coverage Δ
#babelPresetCli 100.00% <ø> (ø)
#config 60.64% <ø> (ø)
#expoCli 29.09% <98.34%> (+5.56%) ⬆️
#expoCodemod 83.81% <ø> (ø)
#jsonFile 65.49% <ø> (ø)
#metroConfig 58.83% <ø> (ø)
#packageManager 16.67% <ø> (ø)
#plist 70.64% <ø> (ø)
#pwa 34.32% <ø> (ø)
#schemer 69.88% <ø> (ø)
#uriScheme 32.05% <ø> (ø)
#webpackConfig 53.41% <ø> (ø)
#xdl 23.37% <ø> (?)
@@            Coverage Diff             @@
##           master    #1941      +/-   ##
==========================================
+ Coverage   44.52%   44.90%   +0.39%     
==========================================
  Files          99      103       +4     
  Lines        3956     4283     +327     
  Branches      976     1036      +60     
==========================================
+ Hits         1761     1923     +162     
- Misses       1513     1635     +122     
- Partials      682      725      +43     
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants