Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Commit

Permalink
Ability to stdout standalone app url via url:ipa and url:apk cmds
Browse files Browse the repository at this point in the history
@fson - Per our discussion to merge some of [exptool](https://github.com/mglagola/exptool) functionality with `exp`!

This functionality will allow for commands like:
```bash
curl -o app.ipa "$(exp url:ipa)"
curl -o app.apk "$(exp url:apk)"
```

Closes #103

fbshipit-source-id: bc7289a
  • Loading branch information
mglagola authored and expbot committed Mar 6, 2018
1 parent cd394f1 commit aef1b53
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/commands/url.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import chalk from 'chalk';
import fp from 'lodash/fp';

import { Project, UrlUtils } from 'xdl';

import CommandError from '../CommandError';
import log from '../log';
import urlOpts from '../urlOpts';

const logArtifactUrl = (platform) => async (projectDir, options) => {
const res = await Project.buildAsync(projectDir, { current: false, mode: 'status' });
const url = fp.compose(
fp.get(['artifacts', 'url']),
fp.head,
fp.filter(job => platform && job.platform === platform),
fp.getOr([], 'jobs')
)(res);
if (url) {
log.nested(url);
} else {
throw new Error(`No ${platform} binary file found. Use "exp build:${platform}" to create one.`);
}
}

async function action(projectDir, options) {
await urlOpts.optsAsync(projectDir, options);

Expand Down Expand Up @@ -35,4 +51,16 @@ export default program => {
.allowOffline()
.allowNonInteractive()
.asyncActionProjectDir(action, /* skipProjectValidation: */ true, /* skipAuthCheck: */ true);

program
.command('url:ipa [project-dir]')
.description('Displays the standalone iOS binary URL you can use to download your app binary')
.allowNonInteractive()
.asyncActionProjectDir(logArtifactUrl('ios'), true);

program
.command('url:apk [project-dir]')
.description('Displays the standalone Android binary URL you can use to download your app binary')
.allowNonInteractive()
.asyncActionProjectDir(logArtifactUrl('android'), true);
};

0 comments on commit aef1b53

Please sign in to comment.