Skip to content

Commit 7c26418

Browse files
committed
more readable jshint comments and fix bug with root bundle mid
1 parent 6b8da1d commit 7c26418

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": ".."
3+
}

Gruntfile.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"use strict";
22

33
module.exports = function (grunt) {
4-
5-
var filesList = ["Gruntfile.js", "*.js", "i18n/*.js", "*.json"];
4+
var filesList = [
5+
"*.js",
6+
"*.json",
7+
"i18n/*.js"
8+
];
69

710

811
// Project configuration.

i18n.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ define(["./i18n/common", "./i18n/build", "module"], function (common, build, mod
123123
};
124124

125125
return {
126-
/* jshint -W074 */
126+
/* jshint maxcomplexity:15 */
127127
load: function (name, req, onLoad, config) {
128128
config = config || {};
129129

@@ -180,7 +180,7 @@ define(["./i18n/common", "./i18n/build", "module"], function (common, build, mod
180180
return;
181181
}
182182
},
183-
/* jshint +W074 */
183+
/* jshint maxcomplexity:10 */
184184

185185
write: function (pluginName, moduleName, write) {
186186
var name = parseName(moduleName),

i18n/build.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ define(["./common", "require"], function (common, requirejs) {
1010
getLayerMid = function (data) {
1111
var match;
1212
if (!layerMid) {
13-
match = data.name.match(/^(.*\/)(.*)$/);
14-
layerMid = match[1] + "nls/" + match[2];
13+
match = data.name.match(/^(.*\/)?(.*)$/);
14+
layerMid = (match[1] || "") + "nls/" + match[2];
1515
}
1616
return layerMid;
1717
},
@@ -82,6 +82,9 @@ define(["./common", "require"], function (common, requirejs) {
8282

8383
setLocalesList: function (locList) {
8484
localesList = locList ? locList.slice() : getAllAvailableLocales();
85+
if (localesList.indexOf("root") < 0) {
86+
localesList.push("root");
87+
}
8588
},
8689

8790
reset: function () {
@@ -102,13 +105,16 @@ define(["./common", "require"], function (common, requirejs) {
102105

103106
layersContent[loc] = layersContent[loc] || "";
104107

108+
var mid;
105109
if (loc !== "root") {
110+
mid = name.prefix + loc + "/" + name.suffix;
106111
result._flattened = true;
107112
result._pseudoRoot = pseudoRoots[loc] || {};
113+
} else {
114+
mid = name.prefix + name.suffix;
108115
}
109116

110-
layersContent[loc] += 'define("' + name.prefix + loc + "/" +
111-
name.suffix + '",' + JSON.stringify(result) + ");";
117+
layersContent[loc] += 'define("' + mid + '",' + JSON.stringify(result) + ");";
112118
});
113119
});
114120

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"grunt-contrib-jshint": "~0.6.0",
88
"grunt-jsbeautifier": "~0.2.2",
99
"requirejs": "~2.1.10",
10-
"intern": "~1.3.2"
10+
"intern": "~1.3.2",
11+
"grunt-lineending": "^0.2.2"
1112
},
1213
"licenses": [{
1314
"type": "BSD",

0 commit comments

Comments
 (0)