| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 09:01:23 -07:00
										 |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  | const fs = require('fs'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |   extract: gulp => done => { | 
					
						
							| 
									
										
										
										
											2020-10-20 09:01:23 -07:00
										 |  |  |     if (!fs.existsSync(path.join(__dirname, 'cldr/cldr-data'))) { | 
					
						
							|  |  |  |       throw new Error(`You must run "gulp cldr:download" before you can extract the data`); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  |     const extract = require('./cldr/extract'); | 
					
						
							|  |  |  |     return extract(gulp, done); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 09:01:23 -07:00
										 |  |  |   download: gulp => done => { | 
					
						
							|  |  |  |     const cldrDownloader = require('cldr-data-downloader'); | 
					
						
							|  |  |  |     const cldrDataFolder = path.join(__dirname, 'cldr/cldr-data'); | 
					
						
							|  |  |  |     if (fs.existsSync(cldrDataFolder)) { | 
					
						
							|  |  |  |       fs.rmdirSync(cldrDataFolder, {recursive: true}); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       fs.mkdirSync(cldrDataFolder); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     cldrDownloader(path.join(__dirname, 'cldr/cldr-urls.json'), cldrDataFolder, {}, done); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-21 19:11:07 +02:00
										 |  |  |   closure: gulp => done => { | 
					
						
							|  |  |  |     const {RELATIVE_I18N_DATA_FOLDER} = require('./cldr/extract'); | 
					
						
							| 
									
										
										
										
											2017-09-22 19:51:03 +02:00
										 |  |  |     // tslint:disable-next-line:no-console
 | 
					
						
							| 
									
										
										
										
											2017-08-21 19:11:07 +02:00
										 |  |  |     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); | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2017-07-20 10:54:07 +02:00
										 |  |  | }; |