expo / turtle

Standalone app builder service
MIT License
385 stars 29 forks source link

Allow to pass --app-json flag to get a local manifest #253

Closed Newbie012 closed 4 years ago

Newbie012 commented 4 years ago

Feature Request

Allow to pass --app-json flag to get the local manifest (including versionCode and buildNumber). This way, we won't need to publish our app each time before delpoyment.

Motivation Behind Feature

Since turtle-cli reads the manifest either from --public-url or expo servers, I have to expo publish each time so the build will use the latest versions and the other properties. I'm trying to be less dependant on expo servers as much as I can, and at the same time I don't want to upload my manifest to a public URL each time before deployment.

Feature Description

I'm not an expo / turtle-cli expert, but it looks to me that we can modify this piece of code:

const url = getExperienceUrl(job.experienceName, job.config.publicUrl);

const manifest = await ExponentTools.getManifestAsync(url, {
  'Exponent-SDK-Version': sdkVersion,
  'Exponent-Platform': platform,
  'Expo-Release-Channel': releaseChannel,
  'Accept': 'application/expo+json,application/json',
});

to something like:


async function getLocalAppJson() {
  const appJsonPath= cmd.appJson || process.env.EXPO_APP_JSON;

  if (!appJsonPath) {
    return;
  }

  return fs.readFile(appJsonPath)
    .then(raw => JSON.parse(raw).expo)
    .catch(err => {
      throw new ErrorWithCommandHelp("Failed to get local manifest from app.json, bla bla...");
    });
}

const localAppJson = await getLocalAppJson(); 
let manifest;

if (localAppJson) {
  manifest = localAppJson)
} else {
  const url = getExperienceUrl(job.experienceName, job.config.publicUrl);

  manifest = await ExponentTools.getManifestAsync(url, ...);
}

Obviously, it won't be written like that, but you get the point

Alternatives or Workarounds

 # version bump
npx standard-version

 # publish app with manifest
expo publish <--- CAN BE AVOIDED

# publish to android
npx turtle build:android ...

# publish to ios
npx turtle build:ios ...

# deploy with fastlane
...
wkozyra95 commented 4 years ago

app.json and manifest are not the same(but very similar). To implement the functionality you want we would need to move a significant part of publishing logic here. We are currently working on a new build service and don't want to put development time into features for the old version.

If you don't want to publish just use expo export and a local python server to host it. You will need https, so I would suggest ngrok for that. You should disable OTA updates if you are doing it.

Newbie012 commented 4 years ago

I understand, if there's a way I can contribute, then I'll be more than happy to :)