gtx-cli 1.2.31 → 1.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/fs/config/parseFilesConfig.js +13 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 1.2.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#426](https://github.com/generaltranslation/gt/pull/426) [`ce57545`](https://github.com/generaltranslation/gt/commit/ce575454301185c663cfb93345d3058c9ceb25dd) Thanks [@brian-lou](https://github.com/brian-lou)! - Improve file pattern matching
|
|
8
|
+
|
|
3
9
|
## 1.2.31
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -92,29 +92,30 @@ function expandGlobPatterns(cwd, includePatterns, excludePatterns, locale, trans
|
|
|
92
92
|
resolvedPaths.push(...matches);
|
|
93
93
|
// For each match, create a version with [locale] in the correct positions
|
|
94
94
|
matches.forEach((match) => {
|
|
95
|
-
// Convert to
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
// Convert to absolute path to make replacement easier
|
|
96
|
+
const absolutePath = path.resolve(cwd, match);
|
|
97
|
+
const patternPath = path.resolve(cwd, pattern);
|
|
98
|
+
let originalAbsolutePath = absolutePath;
|
|
99
99
|
if (localePositions.length > 0) {
|
|
100
|
-
//
|
|
101
|
-
// This is a simplified approach - we'll replace all instances of the locale
|
|
100
|
+
// Replace all instances of [locale]
|
|
102
101
|
// but only in path segments where we expect it based on the original pattern
|
|
103
|
-
const pathParts =
|
|
104
|
-
const patternParts =
|
|
102
|
+
const pathParts = absolutePath.split(path.sep);
|
|
103
|
+
const patternParts = patternPath.split(path.sep);
|
|
105
104
|
for (let i = 0; i < pathParts.length; i++) {
|
|
106
105
|
if (i < patternParts.length) {
|
|
107
106
|
if (patternParts[i].includes(localeTag)) {
|
|
108
107
|
// This segment should have the locale replaced
|
|
109
|
-
|
|
108
|
+
// Create regex from pattern to match the actual path structure
|
|
109
|
+
const regexPattern = patternParts[i].replace(/\[locale\]/g, `(${locale.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`);
|
|
110
|
+
const regex = new RegExp(regexPattern);
|
|
111
|
+
pathParts[i] = pathParts[i].replace(regex, patternParts[i].replace(/\[locale\]/g, localeTag));
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
|
|
115
|
+
originalAbsolutePath = pathParts.join(path.sep);
|
|
114
116
|
}
|
|
115
117
|
// Convert back to absolute path
|
|
116
|
-
|
|
117
|
-
placeholderPaths.push(originalPath);
|
|
118
|
+
placeholderPaths.push(originalAbsolutePath);
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
return { resolvedPaths, placeholderPaths };
|