Skip to content

Commit

Permalink
Remove dev sync command (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
danerwilliams committed Aug 17, 2023
1 parent 65c0ce6 commit 97db1e1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
58 changes: 0 additions & 58 deletions apps/cli/src/background_tasks/fetch_pr_info.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import { getPrInfoForBranches, TPRInfoToUpsert } from '../lib/api/pr_info';
import { TContext } from '../lib/context';
import {
getMetadataRefList,
readMetadataRef,
} from '../lib/engine/metadata_ref';
import { prInfoConfigFactory } from '../lib/spiffy/pr_info_spf';
import { repoConfigFactory, TRepoConfig } from '../lib/spiffy/repo_config_spf';
import { TUserConfig, userConfigFactory } from '../lib/spiffy/user_config_spf';
import { spawnDetached } from '../lib/utils/spawn';

export function refreshPRInfoInBackground(context: TContext): void {
Expand All @@ -27,53 +19,3 @@ export function refreshPRInfoInBackground(context: TContext): void {
spawnDetached(__filename);
}
}

export async function getPrInfoToUpsert({
userConfig,
repoConfig,
}: {
userConfig: TUserConfig;
repoConfig: TRepoConfig;
}): Promise<TPRInfoToUpsert> {
const { authToken, repoName, repoOwner } = {
authToken: userConfig.getAuthToken(),
repoName: repoConfig.getRepoName(),
repoOwner: repoConfig.getRepoOwner(),
};
if (!authToken || !repoName || !repoOwner) {
return [];
}
const branchNamesWithExistingPrNumbers = Object.keys(
getMetadataRefList()
).map((branchName) => ({
branchName,
prNumber: readMetadataRef(branchName)?.prInfo?.number,
}));
return await getPrInfoForBranches(
branchNamesWithExistingPrNumbers,
{
authToken,
repoName,
repoOwner,
},
userConfig
);
}

async function refreshPRInfo(): Promise<void> {
try {
const prInfoToUpsert = await getPrInfoToUpsert({
userConfig: userConfigFactory.load(),
repoConfig: repoConfigFactory.load(),
});
prInfoConfigFactory
.load()
.update((data) => (data.prInfoToUpsert = prInfoToUpsert));
} catch (err) {
prInfoConfigFactory.load().delete();
}
}

if (process.argv[1] === __filename) {
void refreshPRInfo();
}
18 changes: 0 additions & 18 deletions apps/cli/src/commands/dev-commands/sync.ts

This file was deleted.

0 comments on commit 97db1e1

Please sign in to comment.