Skip to content

Commit

Permalink
[eas-cli] add init:onboarding flow for no gh repo connected (#2373)
Browse files Browse the repository at this point in the history
* [eas-cli] add `init:onboarding` flow for no gh repo connected

* fix types

* don't wait
  • Loading branch information
szdziedzic authored May 13, 2024
1 parent e1ebcc0 commit ff9d533
Show file tree
Hide file tree
Showing 25 changed files with 369 additions and 85 deletions.
12 changes: 12 additions & 0 deletions packages/eas-cli/graphql.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/eas-cli/src/__tests__/commands/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function getMockAppFragment(): AppFragment {
return {
id: mockProjectId,
slug: 'testapp',
name: 'testapp',
fullName: '@testuser/testpp',
ownerAccount: {
id: 'test-account-id',
Expand Down
1 change: 1 addition & 0 deletions packages/eas-cli/src/build/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function collectMetadataAsync<T extends Platform>(
workflow: ctx.workflow,
projectDir: ctx.projectDir,
env: ctx.buildProfile.env,
cwd: ctx.projectDir,
})) ?? undefined,
reactNativeVersion: await getReactNativeVersionAsync(ctx.projectDir),
...channelObject,
Expand Down
19 changes: 15 additions & 4 deletions packages/eas-cli/src/build/runBuildAndSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export async function runBuildAndSubmitAsync(
flags: BuildFlags,
actor: Actor,
getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn
): Promise<void> {
): Promise<{
buildIds: string[];
}> {
await vcsClient.ensureRepoExistsAsync();
await ensureRepoIsCleanAsync(vcsClient, flags.nonInteractive);

Expand Down Expand Up @@ -213,7 +215,9 @@ export async function runBuildAndSubmitAsync(
}

if (flags.localBuildOptions.localBuildMode === LocalBuildMode.LOCAL_BUILD_PLUGIN) {
return;
return {
buildIds: startedBuilds.map(({ build }) => build.id),
};
}

if (flags.localBuildOptions.localBuildMode === LocalBuildMode.INTERNAL) {
Expand Down Expand Up @@ -269,14 +273,18 @@ export async function runBuildAndSubmitAsync(
}

if (flags.localBuildOptions.localBuildMode) {
return;
return {
buildIds: startedBuilds.map(({ build }) => build.id),
};
}

if (!flags.wait) {
if (flags.json) {
printJsonOnlyOutput(startedBuilds.map(buildInfo => buildInfo.build));
}
return;
return {
buildIds: startedBuilds.map(({ build }) => build.id),
};
}

const { accountName } = Object.values(buildCtxByPlatform)[0];
Expand Down Expand Up @@ -317,6 +325,9 @@ export async function runBuildAndSubmitAsync(
}
exitWithNonZeroCodeIfSomeSubmissionsDidntFinish(completedSubmissions);
}
return {
buildIds: startedBuilds.map(({ build }) => build.id),
};
}

async function prepareAndStartBuildAsync({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@notnotbrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'notnotbrent' } as any,
});
Expand All @@ -100,6 +101,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@notnotbrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'notnotbrent' } as any,
});
Expand All @@ -124,6 +126,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@totallybrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'totallybrent' } as any,
});
Expand Down Expand Up @@ -172,6 +175,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@totallybrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'totallybrent' } as any,
});
Expand All @@ -196,6 +200,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@notnotbrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'notnotbrent' } as any,
});
Expand Down Expand Up @@ -265,6 +270,7 @@ describe(getProjectIdAsync, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
fullName: '@notnotbrent/test',
name: 'test',
slug: 'test',
ownerAccount: { name: 'notnotbrent' } as any,
});
Expand Down
17 changes: 17 additions & 0 deletions packages/eas-cli/src/commands/project/__tests__/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ describe(ProjectInit.name, () => {
it('is no-op if already configured for id', async () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
name: 'testing-123',
slug: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
Expand All @@ -121,6 +122,7 @@ describe(ProjectInit.name, () => {
it('prompts to overwrite when different', async () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
name: 'testing-123',
slug: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
Expand All @@ -135,6 +137,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand All @@ -152,6 +155,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand Down Expand Up @@ -186,6 +190,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand All @@ -198,6 +203,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand All @@ -223,6 +229,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand All @@ -247,6 +254,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand All @@ -273,6 +281,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand All @@ -288,6 +297,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand All @@ -302,6 +312,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand Down Expand Up @@ -329,6 +340,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand All @@ -355,6 +367,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand Down Expand Up @@ -384,6 +397,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand All @@ -398,6 +412,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-124',
name: 'testing-123',
fullName: '@jester2/testing-124',
ownerAccount: jester2.accounts[0],
});
Expand Down Expand Up @@ -437,6 +452,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '1234',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand Down Expand Up @@ -464,6 +480,7 @@ describe(ProjectInit.name, () => {
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
id: '0129',
slug: 'testing-123',
name: 'testing-123',
fullName: '@jester/testing-123',
ownerAccount: jester.accounts[0],
});
Expand Down
Loading

0 comments on commit ff9d533

Please sign in to comment.