Skip to content

Instantly share code, notes, and snippets.

@yoannmoinet
Last active November 6, 2017 13:23
Show Gist options
  • Save yoannmoinet/6c161660889ea60d2ab7b561fa5c6945 to your computer and use it in GitHub Desktop.
Save yoannmoinet/6c161660889ea60d2ab7b561fa5c6945 to your computer and use it in GitHub Desktop.
Remove *.lproj folders
import path from 'path';
import glob from 'glob';
import fs from 'fs-extra';
export const cleanLanguages = (buildPath) => {
// Target only English and French.
const lprojRegEx = /(en|fr)\.lproj/g;
const cwd = path.join(buildPath, `Fenêtre.app/Contents/Resources`);
const lproj = glob.sync('*.lproj', { cwd });
const proms = [];
lproj.forEach((dir) => {
if (!lprojRegEx.test(dir)) {
proms.push(fs.remove(path.join(cwd, dir)));
}
});
return Promise.all(proms);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment