broccoli-cldr-data
Advanced tools
Comparing version
{ | ||
"name": "broccoli-cldr-data", | ||
"version": "0.4.2", | ||
"version": "1.0.0", | ||
"description": "extracts cldr data to a broccoli directory", | ||
@@ -12,6 +12,6 @@ "main": "index.js", | ||
"bugs": { | ||
"url": "https://github.com/jasonmit/broccoli-cldr-data/issues" | ||
"url": "https://github.com/ember-intl/broccoli-cldr-data/issues" | ||
}, | ||
"repository": "https://github.com/jasonmit/broccoli-cldr-data", | ||
"homepage": "https://github.com/jasonmit/broccoli-cldr-data", | ||
"repository": "https://github.com/ember-intl/broccoli-cldr-data", | ||
"homepage": "https://github.com/ember-intl/broccoli-cldr-data", | ||
"author": "jason.mitchell.w@gmail.com", | ||
@@ -30,6 +30,5 @@ "license": "MIT", | ||
"devDependencies": { | ||
"broccoli": "^0.16.9", | ||
"mocha": "^3.1.2", | ||
"walk-sync": "^0.3.1" | ||
"broccoli-test-helper": "^1.1.0", | ||
"mocha": "^3.1.2" | ||
} | ||
} |
@@ -9,12 +9,10 @@ /* jshint node: true */ | ||
*/ | ||
var CachingWriter = require('broccoli-caching-writer'); | ||
var extractor = require('formatjs-extract-cldr-data'); | ||
var serialize = require('serialize-javascript'); | ||
var mkdirp = require('mkdirp'); | ||
var assert = require('assert'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
const CachingWriter = require('broccoli-caching-writer'); | ||
const extractor = require('formatjs-extract-cldr-data'); | ||
const serialize = require('serialize-javascript'); | ||
const mkdirp = require('mkdirp'); | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
require('./object-assign-polyfill'); | ||
Plugin.prototype = Object.create(CachingWriter.prototype); | ||
@@ -32,13 +30,16 @@ Plugin.prototype.constructor = Plugin; | ||
this.options = Object.assign({ | ||
// formatjs-extract-cldr-data options | ||
locales: null, | ||
pluralRules: true, | ||
relativeFields: false, | ||
this.options = Object.assign( | ||
{ | ||
// formatjs-extract-cldr-data options | ||
locales: null, | ||
pluralRules: true, | ||
relativeFields: false, | ||
// plugin options | ||
destDir: '', | ||
prelude: '', | ||
moduleType: 'es6' | ||
}, options); | ||
// plugin options | ||
destDir: '', | ||
prelude: '', | ||
moduleType: 'es6' | ||
}, | ||
options | ||
); | ||
@@ -50,5 +51,8 @@ CachingWriter.call(this, inputNodes, { | ||
if (Array.isArray(this.options.locales)) { | ||
this.options.locales = this.options.locales.map(function(localeName) { | ||
return this.normalizeLocale(localeName); | ||
}, this); | ||
this.options.locales = this.options.locales.map( | ||
function(localeName) { | ||
return this.normalizeLocale(localeName); | ||
}, | ||
this | ||
); | ||
} | ||
@@ -65,3 +69,3 @@ } | ||
return locale; | ||
} | ||
}; | ||
@@ -78,9 +82,7 @@ Plugin.prototype.writeFileSync = function(groupedByLanguage) { | ||
fs.writeFileSync( | ||
path.join(outputPath, language.toLowerCase() + '.js'), | ||
options.prelude.concat(languageData), | ||
{ encoding: 'utf8' } | ||
); | ||
fs.writeFileSync(path.join(outputPath, language.toLowerCase() + '.js'), options.prelude.concat(languageData), { | ||
encoding: 'utf8' | ||
}); | ||
} | ||
} | ||
}; | ||
@@ -94,13 +96,16 @@ Plugin.prototype.build = function() { | ||
var groupedByLanguage = Object.keys(data).reduce(function(ret, locale) { | ||
var lang = locale.split('-')[0]; | ||
var langData = ret[lang] || []; | ||
ret[lang] = langData.concat(data[locale]); | ||
var groupedByLanguage = Object.keys(data).reduce( | ||
function(ret, locale) { | ||
var lang = locale.split('-')[0]; | ||
var langData = ret[lang] || []; | ||
ret[lang] = langData.concat(data[locale]); | ||
return ret; | ||
}, Object.create(null)); | ||
return ret; | ||
}, | ||
Object.create(null) | ||
); | ||
return this.writeFileSync(groupedByLanguage); | ||
} | ||
}; | ||
module.exports = Plugin; |
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
41852
49.32%2
-33.33%0
-100%6
-14.29%87
-16.35%