build: move cldr dependency to npm (#33634)

PR Close #33634
This commit is contained in:
Joey Perrott
2019-11-06 11:23:11 -08:00
committed by Andrew Scott
parent 4029c98f16
commit 68380e4af2
7 changed files with 39 additions and 226 deletions

View File

@ -6,27 +6,14 @@
* found in the LICENSE file at https://angular.io/license
*/
const path = require('path');
const fs = require('fs');
module.exports = {
extract: gulp => done => {
if (!fs.existsSync(path.join(__dirname, 'cldr/cldr-data'))) {
throw new Error(`You must run "gulp cldr:download" before you can extract the data`);
}
const extract = require('./cldr/extract');
return extract(gulp, done);
},
download: gulp => done => {
const cldrDownloader = require('cldr-data-downloader');
const cldrDataFolder = path.join(__dirname, 'cldr/cldr-data');
if (!fs.existsSync(cldrDataFolder)) {
fs.mkdirSync(cldrDataFolder);
}
cldrDownloader(path.join(__dirname, 'cldr/cldr-urls.json'), cldrDataFolder, done);
},
closure: gulp => done => {
const {RELATIVE_I18N_DATA_FOLDER} = require('./cldr/extract');
// tslint:disable-next-line:no-console