-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (37 loc) · 1.2 KB
/
index.js
File metadata and controls
48 lines (37 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
const extract = require('@ember-intl/broccoli-cldr-data');
/* eslint-disable node/no-unpublished-require */
const mergeTrees = require('broccoli-merge-trees');
const path = require('path');
const fs = require('fs');
module.exports = {
name: require('./package').name,
treeForApp(tree) {
let trees = [tree];
let { env, project } = this.app;
let configPath = path.dirname(project.configPath());
configPath = path.join(configPath, 'environment.js');
if (!path.isAbsolute(configPath)) {
configPath = path.join(project.root, configPath);
}
let addonConfig = {};
if (fs.existsSync(configPath)) {
addonConfig = require(configPath)(env);
}
let config = addonConfig['ember-short-number'];
let locales = typeof config === 'object' ? config['locales'] : null;
if (tree) { //&& this.locales.length) {
let cldrTree = extract(tree, {
locales: locales,
pluralRules: false,
relativeFields: false,
numberFields: true,
destDir: 'cldrs-shorts',
prelude: '/*jslint eqeq: true*/\n',
moduleType: 'es6'
});
trees.push(cldrTree);
}
return mergeTrees(trees, { overwrite: true });
}
};