feat(common): generate closure-locale.ts to tree shake locale data (#18907)

Closure will only keep the data for the locale defined in `goog.LOCALE`

PR Close #18907
This commit is contained in:
Olivier Combe
2017-08-21 19:11:07 +02:00
committed by Miško Hevery
parent 4c5aac8cd5
commit 48789360b1
8 changed files with 2511 additions and 4 deletions

View File

@ -25,5 +25,16 @@ module.exports = {
fs.mkdirSync(cldrDataFolder);
}
cldrDownloader(path.join(__dirname, 'cldr/cldr-urls.json'), cldrDataFolder, done);
}
},
closure: gulp => done => {
const {RELATIVE_I18N_DATA_FOLDER} = require('./cldr/extract');
console.log(RELATIVE_I18N_DATA_FOLDER, fs.existsSync(RELATIVE_I18N_DATA_FOLDER));
if (!fs.existsSync(RELATIVE_I18N_DATA_FOLDER)) {
throw new Error(
`You must run "gulp cldr:extract" before you can create the closure-locale.ts file`);
}
const localeAll = require('./cldr/closure');
return localeAll(gulp, done);
},
};