Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

[xdl] clean up Expo.plist artifacts left behind by IosPlist util #2028

Merged
merged 1 commit into from
Apr 28, 2020

Conversation

esamelson
Copy link
Contributor

The IosPlist util leaves behind some artifacts (*.json, *.plist.bak) which may be confusing to users who aren't expecting them.

In particular, users running expo publish in a bare workflow project with expo-updates may find these extra files (which come from modifying the data in the Expo.plist config file) confusing. Their utility is limited -- since most people are using version control there's no need to have separate backup files in the same folder. So in this case we should just delete those files after the IosPlist.modifyAsync operation completes successfully.

Test plan

expo init, bare-minimum template, expo publish

  • latest expo-cli expo publish produces Expo.json and Expo.plist.bak files in the Supporting dir
  • after this change, expo publish no longer produces those files
  • deleting files that don't exist with fs.removeSync is a no-op


// delete artifacts sometimes left behind by IosPlist util
fs.removeSync(path.join(supportingDirectory, 'Expo.json'));
fs.removeSync(path.join(supportingDirectory, 'Expo.plist.bak'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be able to use

async function cleanBackupAsync(plistPath: string, plistName: string, restoreOriginal = true) {
let plistFilename = _getNormalizedPlistFilename(plistName);
let configPlistName = path.join(plistPath, plistFilename);
let configFilename = path.join(plistPath, `${plistName}.json`);
const backupPlistPath = `${configPlistName}.bak`;
if (restoreOriginal && (await fs.pathExists(backupPlistPath))) {
await fs.copy(backupPlistPath, configPlistName);
}
await fs.remove(backupPlistPath);
await fs.remove(configFilename);
}
instead

@brentvatne brentvatne merged commit 3a80bb4 into master Apr 28, 2020
@brentvatne brentvatne deleted the @eric/cleanup-plist-files branch April 28, 2020 19:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants