Last active
November 6, 2017 13:23
-
-
Save yoannmoinet/6c161660889ea60d2ab7b561fa5c6945 to your computer and use it in GitHub Desktop.
Remove *.lproj folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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