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

Commit

Permalink
[expo-cli] add --config flag to credentials:manager (#2641)
Browse files Browse the repository at this point in the history
* [expo-cli] add --config flag to credentials:manager

* update CHANGELOG.md

* replace doctor call with getConfig
  • Loading branch information
wkozyra95 authored Sep 15, 2020
1 parent 0809d99 commit 16d43e0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This is the log of notable changes to Expo CLI and related packages.

### 🎉 New features

- [expo-cli] EAS Build: Improve errors and wanrings when deprecating API [#2639](https://github.com/expo/expo-cli/pull/2639)
- [expo-cli] EAS Build: Improve errors and warnings when deprecating API [#2639](https://github.com/expo/expo-cli/pull/2639)
- [expo-cli] support `--config` flag in `expo credentials:manager` [#2641](https://github.com/expo/expo-cli/pull/2641)

### 🐛 Bug fixes

Expand Down
37 changes: 21 additions & 16 deletions packages/expo-cli/src/commands/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,29 @@ type Options = {

export default function (program: CommanderStatic) {
program
.command('credentials:manager')
.command('credentials:manager [path]')
.description('Manage your credentials')
.helpGroup('credentials')
.option('-p --platform <platform>', 'Platform: [android|ios]', /^(android|ios)$/i)
.asyncAction(async (options: Options) => {
const projectDir = process.cwd();
const context = new Context();
await context.init(projectDir, {
nonInteractive: options.parent?.nonInteractive,
});
let mainpage;
if (options.platform === 'android') {
mainpage = new SelectAndroidExperience();
} else if (options.platform === 'ios') {
mainpage = new SelectIosExperience();
} else {
mainpage = new SelectPlatform();
.asyncActionProjectDir(
async (projectDir: string, options: Options) => {
const context = new Context();
await context.init(projectDir, {
nonInteractive: options.parent?.nonInteractive,
});
let mainpage;
if (options.platform === 'android') {
mainpage = new SelectAndroidExperience();
} else if (options.platform === 'ios') {
mainpage = new SelectIosExperience();
} else {
mainpage = new SelectPlatform();
}
await runCredentialsManagerStandalone(context, mainpage);
},
{
checkConfig: false,
skipSDKVersionRequirement: true,
}
await runCredentialsManagerStandalone(context, mainpage);
}, /* skip project validation */ true);
);
}
10 changes: 5 additions & 5 deletions packages/expo-cli/src/credentials/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ export class Context {
this._appleCtxOptions = pick(options, ['appleId', 'appleIdPassword', 'teamId']);
this._nonInteractive = options.nonInteractive;

// Check if we are in project context by looking for a manifest
const status = await Doctor.validateWithoutNetworkAsync(projectDir, {
skipSDKVersionRequirement: true,
});
if (status !== Doctor.FATAL) {
// try to acccess project context
try {
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true });
this._manifest = exp;
this._hasProjectContext = true;
this.logOwnerAndProject();
} catch (error) {
// ignore error
// startcredentials manager without project context
}
}
}

0 comments on commit 16d43e0

Please sign in to comment.