Skip to content

Commit

Permalink
Refactor publish command to get Hyperplay cookies at beginning and us…
Browse files Browse the repository at this point in the history
…e on all requests
  • Loading branch information
jiyuu-jin committed Jul 10, 2024
1 parent 56a9e42 commit 9fc79fd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { select } from '../keys';
import { CookieJar } from 'tough-cookie';
import axios from 'axios';
import { wrapper } from 'axios-cookiejar-support';
import { loginAndPublish } from '../api';
import { login, publish } from '../api';
import { uploadRelease } from '../releases';
import { parseYml } from '../yml';
import { FlagOutput } from '@oclif/core/lib/interfaces';
Expand Down Expand Up @@ -120,8 +120,16 @@ export default class Publish extends Command {
this.error(`release ${config.release} exists`);
}

const release = await uploadRelease(valist, config);
CliUx.ux.log(`successfully uploaded files to IPFS: ${release.external_url}`);
const apiURL = 'https://developers.hyperplay.xyz'
const apiClient = wrapper(axios.create({ jar: cookieJar, withCredentials: true, baseURL: apiURL }));
await login(
apiClient,
cookieJar,
wallet
);

const release = await uploadRelease(apiClient, config);
CliUx.ux.log(`Successfully uploaded files to HyperPlay: ${release.external_url}`);

CliUx.ux.action.start('publishing release');
const tx = await valist.createRelease(projectID, config.release, release);
Expand All @@ -133,13 +141,8 @@ export default class Publish extends Command {

// Publish to HyperPlay
if (!flags['skip_hyperplay_publish']) {
const apiURL = 'https://developers.hyperplay.xyz'
const apiClient = wrapper(axios.create({ jar: cookieJar, withCredentials: true, baseURL: apiURL }));
await loginAndPublish(
await publish(
apiClient,
cookieJar,
wallet,
apiURL,
projectID,
fullReleaseName,
flags['channel']
Expand Down

0 comments on commit 9fc79fd

Please sign in to comment.