Skip to content

Commit

Permalink
Always scan dependency tree if AML != None
Browse files Browse the repository at this point in the history
  • Loading branch information
Setogit committed Oct 6, 2016
1 parent bd914e5 commit 507d201
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ function SetRootDir(rootDir, options) {
helper.isLoadMessages(rootDir)) {
var langs = Object.keys(global.STRONGLOOP_GLB.bundles);
langs.forEach(function(lang) {
translate.loadMsgFromFile(lang, rootDir);
translate.loadMsgFromFile(lang, rootDir,
global.STRONGLOOP_GLB.AUTO_MSG_LOADING !== helper.AML_NONE);
});
}
}
Expand Down
10 changes: 4 additions & 6 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function enumerateFilesSyncPriv(
callback(content, child);
};
});
if (checkNodeModules) {
if (checkNodeModules && maxDirectoryDepth() > 0) {
var depthRoot = directoryDepth(rootDir);
var moduleRootPaths = resolveDependencies(currentPath, rootDir);
if (moduleRootPaths) {
Expand Down Expand Up @@ -388,12 +388,10 @@ function enumerateMsgSyncPriv(currentPath, rootDir, lang, checkNodeModules,
}
var enDirPath = path.join(rootDir, 'intl', exports.ENGLISH);
var clonedFileNames = [];
msgFiles.forEach(function(msgFile) {
msgFiles.sort().forEach(function(msgFile) {
if (msgFile.indexOf('.') === 0) return;
var stats = fs.lstatSync(path.join(langDirPath, msgFile));
if (!stats.isFile()) return;
// commented out to avoid interference with intercept-stdout in test
// debug('enumerating...', path.join(langDirPath, msgFile));
if (cloneEnglishTxt && (lang === exports.ENGLISH)) {
if (currentPath === rootDir) return;
if (getTrailerAfterDot(msgFile) !== 'txt') return;
Expand All @@ -420,7 +418,7 @@ function enumerateMsgSyncPriv(currentPath, rootDir, lang, checkNodeModules,
clonedFileNames.length > 0) {
removeObsoleteFile(enDirPath, clonedFileNames);
}
if (checkNodeModules) {
if (checkNodeModules && maxDirectoryDepth() > 0) {
var depthRoot = directoryDepth(rootDir);
var moduleRootPaths = resolveDependencies(currentPath, rootDir);
if (moduleRootPaths) {
Expand Down Expand Up @@ -455,7 +453,7 @@ function directoryDepth(fullPath) {
function maxDirectoryDepth() {
var depth = parseInt(process.env.STRONGLOOP_GLOBALIZE_MAX_DEPTH, 10);
if (isNaN(depth)) depth = exports.BIG_NUM;
depth = Math.max(1, depth);
depth = Math.max(0, depth);
return depth;
}

Expand Down

0 comments on commit 507d201

Please sign in to comment.