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 bca437617f
commit 42d394973d
7 changed files with 39 additions and 226 deletions

View File

@ -56,5 +56,4 @@ gulp.task('changelog', loadTask('changelog'));
gulp.task('changelog:zonejs', loadTask('changelog-zonejs'));
gulp.task('check-env', () => {/* this is a noop because the env test ran already above */});
gulp.task('cldr:extract', loadTask('cldr', 'extract'));
gulp.task('cldr:download', loadTask('cldr', 'download'));
gulp.task('cldr:gen-closure-locale', loadTask('cldr', 'closure'));

View File

@ -136,7 +136,7 @@
"check-side-effects": "0.0.21",
"clang-format": "1.0.41",
"cldr": "4.10.0",
"cldr-data-downloader": "0.3.2",
"cldr-data": "33.0.0",
"cldrjs": "0.5.0",
"conventional-changelog": "^2.0.3",
"cors": "2.8.4",

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

View File

@ -1,84 +0,0 @@
// tslint:disable:file-header
/**
* Npm module for Unicode CLDR JSON data
*
* @license
* Copyright 2013 Rafael Xavier de Souza
* Released under the MIT license
* https://github.com/rxaviers/cldr-data-npm/blob/master/LICENSE-MIT
*/
'use strict';
const JSON_EXTENSION = /^(.*)\.json$/;
const assert = require('assert');
const _fs = require('fs');
const _path = require('path');
function argsToArray(arg) {
return [].slice.call(arg, 0);
}
function jsonFiles(dirName) {
const fileList = _fs.readdirSync(_path.join(__dirname, 'cldr-data', dirName));
return fileList.reduce(function(sum, file) {
if (JSON_EXTENSION.test(file)) {
return sum.concat(file.match(JSON_EXTENSION)[1]);
}
}, []);
}
function cldrData(path /*, ...*/) {
assert(
typeof path === 'string', 'must include path (e.g., ' +
'"main/en/numbers" or "supplemental/likelySubtags")');
if (arguments.length > 1) {
return argsToArray(arguments).reduce(function(sum, path) {
sum.push(cldrData(path));
return sum;
}, []);
}
return require('./cldr-data/' + path);
}
function mainPathsFor(locales) {
return locales.reduce(function(sum, locale) {
const mainFiles = jsonFiles(_path.join('main', locale));
mainFiles.forEach(function(mainFile) { sum.push(_path.join('main', locale, mainFile)); });
return sum;
}, []);
}
function supplementalPaths() {
const supplementalFiles = jsonFiles('supplemental');
return supplementalFiles.map(function(supplementalFile) {
return _path.join('supplemental', supplementalFile);
});
}
Object.defineProperty(
cldrData, 'availableLocales',
{get: function() { return cldrData('availableLocales').availableLocales; }});
cldrData.all = function() {
const paths = supplementalPaths().concat(mainPathsFor(this.availableLocales));
return cldrData.apply({}, paths);
};
cldrData.entireMainFor = function(locale /*, ...*/) {
assert(
typeof locale === 'string', 'must include locale (e.g., ' +
'"en")');
return cldrData.apply({}, mainPathsFor(argsToArray(arguments)));
};
cldrData.entireSupplemental = function() {
return cldrData.apply({}, supplementalPaths());
};
module.exports = cldrData;

View File

@ -1,22 +0,0 @@
{
"core": [
"https://github.com/unicode-cldr/cldr-core/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-segments-modern/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-dates-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-buddhist-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-chinese-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-coptic-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-dangi-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-ethiopic-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-hebrew-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-indian-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-islamic-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-japanese-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-persian-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-cal-roc-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-localenames-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-misc-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-numbers-full/archive/33.0.0.zip",
"https://github.com/unicode-cldr/cldr-units-full/archive/33.0.0.zip"
]
}

View File

@ -44,7 +44,7 @@ const HEADER = `/**
// tslint:disable:no-console
module.exports = (gulp, done) => {
const cldrData = require('./cldr-data');
const cldrData = require('cldr-data');
const LOCALES = cldrData.availableLocales;
console.log(`Loading CLDR data...`);

141
yarn.lock
View File

@ -967,21 +967,16 @@ add-stream@^1.0.0:
resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
integrity sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=
adm-zip@0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.4.tgz#a61ed5ae6905c3aea58b3a657d25033091052736"
integrity sha1-ph7VrmkFw66lizplfSUDMJEFJzY=
adm-zip@0.4.11, adm-zip@^0.4.9, adm-zip@~0.4.3, adm-zip@~0.4.x:
version "0.4.11"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.11.tgz#2aa54c84c4b01a9d0fb89bb11982a51f13e3d62a"
integrity sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==
adm-zip@^0.4.11:
version "0.4.13"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a"
integrity sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==
adm-zip@^0.4.9, adm-zip@~0.4.3, adm-zip@~0.4.x:
version "0.4.11"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.11.tgz#2aa54c84c4b01a9d0fb89bb11982a51f13e3d62a"
integrity sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==
after@0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"
@ -2295,20 +2290,27 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"
cldr-data-downloader@0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/cldr-data-downloader/-/cldr-data-downloader-0.3.2.tgz#8d0c98346d16486252fdc9afa36a46542fe4652f"
integrity sha1-jQyYNG0WSGJS/cmvo2pGVC/kZS8=
cldr-data-downloader@0.3.x:
version "0.3.5"
resolved "https://registry.yarnpkg.com/cldr-data-downloader/-/cldr-data-downloader-0.3.5.tgz#f5445cb9d222bf7fa8426c62e0ae9d7d4897b243"
integrity sha512-uyIMa1K98DAp/PE7dYpq2COIrkWn681Atjng1GgEzeJzYb1jANtugtp9wre6+voE+qzVC8jtWv6E/xZ1GTJdlw==
dependencies:
adm-zip "0.4.4"
adm-zip "0.4.11"
mkdirp "0.5.0"
nopt "3.0.x"
npmconf "2.0.9"
progress "1.1.8"
q "1.0.1"
request "~2.74.0"
request "~2.87.0"
request-progress "0.3.1"
cldr-data@33.0.0:
version "33.0.0"
resolved "https://registry.yarnpkg.com/cldr-data/-/cldr-data-33.0.0.tgz#15c341b56b6e9fb231f9908a4913da23e7f382ff"
integrity sha512-f6AV9/m0hHQ/xnAJ6xdmyY/uo8QjHkxzF+M15VOrTM121oFgnUvff3XPxRk8F3cZXUpQnife4bqG4gvk15hHVQ==
dependencies:
cldr-data-downloader "0.3.x"
glob "5.x.x"
cldr@4.10.0:
version "4.10.0"
resolved "https://registry.yarnpkg.com/cldr/-/cldr-4.10.0.tgz#5a72a693728eca491bc8ee027d60fa4dc750a24f"
@ -2700,14 +2702,6 @@ concat-stream@^1.4.7, concat-stream@^1.5.0, concat-stream@^1.6.0:
readable-stream "^2.2.2"
typedarray "^0.0.6"
config-chain@~1.1.8:
version "1.1.11"
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2"
integrity sha1-q6CXR9++TD5w52am5BWG4YWfxvI=
dependencies:
ini "^1.3.4"
proto-list "~1.2.1"
configstore@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-1.4.0.tgz#c35781d0501d268c25c54b8b17f6240e8a4fb021"
@ -4528,15 +4522,6 @@ forever-agent@~0.6.1:
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
form-data@~1.0.0-rc4:
version "1.0.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-1.0.1.tgz#ae315db9a4907fa065502304a66d7733475ee37c"
integrity sha1-rjFduaSQf6BlUCMEpm13M0de43w=
dependencies:
async "^2.0.1"
combined-stream "^1.0.5"
mime-types "^2.1.11"
form-data@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.0.0.tgz#6f0aebadcc5da16c13e1ecc11137d85f9b883b25"
@ -4964,6 +4949,17 @@ glob2base@^0.0.12:
dependencies:
find-index "^0.1.1"
glob@5.x.x, glob@^5.0.15, glob@~5.0.0:
version "5.0.15"
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "2 || 3"
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.1:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
@ -4986,17 +4982,6 @@ glob@^4.3.1:
minimatch "^2.0.1"
once "^1.3.0"
glob@^5.0.15, glob@~5.0.0:
version "5.0.15"
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=
dependencies:
inflight "^1.0.4"
inherits "2"
minimatch "2 || 3"
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.0.5, glob@^7.1.2, glob@^7.1.3:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
@ -5837,7 +5822,7 @@ inherits@2.0.1:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=
ini@1.3.5, ini@^1.2.0, ini@^1.3.2, ini@^1.3.4, ini@~1.3.0, ini@~1.3.3:
ini@1.3.5, ini@^1.3.2, ini@^1.3.4, ini@~1.3.0, ini@~1.3.3:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
@ -8207,7 +8192,7 @@ nodejs-websocket@^1.7.2:
resolved "https://registry.yarnpkg.com/nodejs-websocket/-/nodejs-websocket-1.7.2.tgz#94abd1e248f57d4d1c663dec3831015c6dad98a6"
integrity sha512-PFX6ypJcCNDs7obRellR0DGTebfUhw1SXGKe2zpB+Ng1DQJhdzbzx1ob+AvJCLzy2TJF4r8cCDqMQqei1CZdPQ==
nopt@3.0.x, nopt@^3.0.1, nopt@~3.0.1:
nopt@3.0.x, nopt@^3.0.1:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k=
@ -8345,21 +8330,6 @@ npm-run-path@^2.0.0:
dependencies:
path-key "^2.0.0"
npmconf@2.0.9:
version "2.0.9"
resolved "https://registry.yarnpkg.com/npmconf/-/npmconf-2.0.9.tgz#5c87e5fb308104eceeca781e3d9115d216351ef2"
integrity sha1-XIfl+zCBBOzuyngePZEV0hY1HvI=
dependencies:
config-chain "~1.1.8"
inherits "~2.0.0"
ini "^1.2.0"
mkdirp "^0.5.0"
nopt "~3.0.1"
once "~1.3.0"
osenv "^0.1.0"
semver "2 || 3 || 4"
uid-number "0.0.5"
npmlog@^4.0.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b"
@ -9115,11 +9085,6 @@ promzard@0.3.0:
dependencies:
read "1"
proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
protobufjs@6.8.8:
version "6.8.8"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.8.8.tgz#c8b4f1282fd7a90e6f5b109ed11c84af82908e7c"
@ -9677,7 +9642,7 @@ request@2.75.0:
tough-cookie "~2.3.0"
tunnel-agent "~0.4.1"
request@2.x, request@^2.87.0:
request@2.x, request@^2.87.0, request@~2.87.0:
version "2.87.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"
integrity sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==
@ -9729,33 +9694,6 @@ request@^2.72.0, request@^2.74.0, request@^2.79.0, request@^2.81.0, request@^2.8
tunnel-agent "^0.6.0"
uuid "^3.3.2"
request@~2.74.0:
version "2.74.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.74.0.tgz#7693ca768bbb0ea5c8ce08c084a45efa05b892ab"
integrity sha1-dpPKdou7DqXIzgjAhKRe+gW4kqs=
dependencies:
aws-sign2 "~0.6.0"
aws4 "^1.2.1"
bl "~1.1.2"
caseless "~0.11.0"
combined-stream "~1.0.5"
extend "~3.0.0"
forever-agent "~0.6.1"
form-data "~1.0.0-rc4"
har-validator "~2.0.6"
hawk "~3.1.3"
http-signature "~1.1.0"
is-typedarray "~1.0.0"
isstream "~0.1.2"
json-stringify-safe "~5.0.1"
mime-types "~2.1.7"
node-uuid "~1.4.7"
oauth-sign "~0.8.1"
qs "~6.2.0"
stringstream "~0.0.4"
tough-cookie "~2.3.0"
tunnel-agent "~0.4.1"
require-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-1.0.0.tgz#c2639de72960ea1ee280279f2da35e03c6536b2d"
@ -10183,11 +10121,6 @@ semver-intersect@1.4.0:
dependencies:
semver "^5.0.0"
"semver@2 || 3 || 4", semver@^4.1.0:
version "4.3.6"
resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da"
integrity sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=
"semver@2 || 3 || 4 || 5", semver@5.6.0, semver@^5.0.0, semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
@ -10208,6 +10141,11 @@ semver@6.3.0, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^4.1.0:
version "4.3.6"
resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da"
integrity sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=
semver@~5.0.1:
version "5.0.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.0.3.tgz#77466de589cd5d3c95f138aa78bc569a3cb5d27a"
@ -11663,11 +11601,6 @@ uglify-to-browserify@~1.0.0:
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc=
uid-number@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.5.tgz#5a3db23ef5dbd55b81fce0ec9a2ac6fccdebb81e"
integrity sha1-Wj2yPvXb1VuB/ODsmirG/M3ruB4=
uid-safe@2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.4.tgz#3ad6f38368c6d4c8c75ec17623fb79aa1d071d81"