diff --git a/index.js b/index.js index 16627e0..cfc72f8 100755 --- a/index.js +++ b/index.js @@ -50,13 +50,13 @@ const mapProjectDirToExpoInfo = async (dir) => { }; const logDeprecatedCommand = (cmd, replacementCmd) => { - console.log(''); - console.log(chalk.red(`"${chalk.bold(`exptool ${cmd}`)}" is deprecated.`)); - if (replacementCmd) { - console.log(chalk.red(`Try using ${chalk.bold(replacementCmd)} instead.`)); - } - console.log(`See ${chalk.underline('https://github.com/mglagola/exptool/wiki/Deprecations')} for more info on deprecations.`); - console.log(''); + // console.log(''); + // console.log(chalk.red(`"${chalk.bold(`exptool ${cmd}`)}" is deprecated.`)); + // if (replacementCmd) { + // console.log(chalk.red(`Try using ${chalk.bold(replacementCmd)} instead.`)); + // } + // console.log(`See ${chalk.underline('https://github.com/mglagola/exptool/wiki/Deprecations')} for more info on deprecations.`); + // console.log(''); }; program @@ -64,7 +64,7 @@ program .description('Prints the expo url for a given project and [optional] release channel') .option('-r, --release-channel [channel]', 'Specify release channel (staging, production, etc)') .action(act(async (dir, { releaseChannel }) => { - const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); + const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); const job = F.head(await fetchArtifactJobs(projectManifest, expoState)); const url = `https://expo.io/${job.fullExperienceName}${F.isNil(releaseChannel) ? '' : `?release-channel=${releaseChannel}`}`; console.log(url); @@ -83,7 +83,7 @@ program console.log(chalk.red(message)); return false; } - console.log(packageName); + console.log(packageName); return true; }, true)); @@ -125,20 +125,20 @@ program program .command('wait:build [project-dir]') .description('[Deprecated] Wait for active build to complete') - .option('-i, --interval [sleep-interval-seconds]', 'Sleep interval between checks') + .option('-i, --interval [sleep-interval-seconds]', 'Sleep interval between checks') .option('-t, --timeout [timeout-seconds]', 'Max amount of seconds to wait before timing out') .action(act(async (dir, options) => { logDeprecatedCommand('wait:build', 'exp build:{ios|android}'); - const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); + const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); return await checkIfBuilt(projectManifest, expoState, options); })); program .command('download:artifact [project-dir]') - .description('[Deprecated] Downloads the most recent artifact for a given project') + .description('[Deprecated] Downloads the most recent artifact for a given project') .option('-t, --to-dir [dir]', 'Specify dir to download artifact to. Default is current directory') .action(act(async (dir, { toDir }) => { - const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); + const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); const artifacts = await fetchArtifactJobs(projectManifest, expoState); const downloadToDir = toDir || process.cwd(); await Promise.all(artifacts.map(job => downloadArtifact(resolveHome(downloadToDir), job))); @@ -147,9 +147,9 @@ program program .command('url:artifact [project-dir]') - .description('[Deprecated] Prints the latest url artifact for a given project') + .description('[Deprecated] Prints the latest url artifact for a given project') .action(act(async (dir, options) => { - const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); + const { expoState, projectManifest } = await mapProjectDirToExpoInfo(dir); const job = F.head(await fetchArtifactJobs(projectManifest, expoState)); console.log(job.artifacts.url); return true; diff --git a/lib/expo.js b/lib/expo.js index 59760d2..7ad5066 100644 --- a/lib/expo.js +++ b/lib/expo.js @@ -37,9 +37,8 @@ async function buildStatus (projectManifest, expState = {}) { const res = await rp({ url: 'https://exp.host/--/api/build/[]', headers: { - 'Exp-ClientId': accessToken, - 'Authorization': `Bearer ${auth.idToken}`, - 'Exp-Access-Token': auth.accessToken, + 'Expo-Session': auth.sessionSecret, + 'Exp-Access-Token': accessToken, 'Content-Type': 'application/json', }, method: 'put', @@ -101,9 +100,12 @@ async function checkIfBuilt (projectManifest, expState, { timeout = ARTIFACT_BUI case 'in-progress': console.log(`Artifact still building, checking again in ${interval}s ...`); break; + case 'pending': + console.log(`Artifact building is pending, checking again in ${interval}s ...`); + break; default: - console.log(chalk.red(`Unknown status: ${jobStatus} - aborting!`)); - return false; + console.log(chalk.red(`Unknown status: ${jobStatus}, checking again in ${interval}s ...`)); + break; } startTime = new Date().getTime(); await sleep(secondsToMilliseconds(interval));