gtx-cli 1.2.9 → 1.2.10-alpha.2

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/.env ADDED
@@ -0,0 +1,2 @@
1
+ NEXT_PUBLIC_POSTHOG_KEY=phc_aAeQaZFfKmmDbEdvpSjymcWQVf18NXzRgobRYnZlniI
2
+ NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
@@ -15,7 +15,8 @@ function validateSettings(settings) {
15
15
  }
16
16
  // defaultLocale cannot be a superset of any other locale
17
17
  if (settings.defaultLocale &&
18
- settings.locales.some((locale) => (0, generaltranslation_1.isSupersetLocale)(settings.defaultLocale, locale))) {
18
+ settings.locales.some((locale) => (0, generaltranslation_1.isSupersetLocale)(settings.defaultLocale, locale) &&
19
+ !(0, generaltranslation_1.isSupersetLocale)(locale, settings.defaultLocale))) {
19
20
  const locale = settings.locales.find((locale) => (0, generaltranslation_1.isSupersetLocale)(settings.defaultLocale, locale));
20
21
  (0, console_1.logErrorAndExit)(`defaultLocale: ${settings.defaultLocale} is a superset of another locale (${locale})! Please change the defaultLocale to a more specific locale.`);
21
22
  }
@@ -87,71 +87,42 @@ function expandGlobPatterns(includePatterns, excludePatterns, locale, transformP
87
87
  searchIndex = foundIndex + localeTag.length;
88
88
  }
89
89
  const expandedPattern = pattern.replace(/\[locale\]/g, locale);
90
- // Check if the pattern contains glob characters
91
- if (expandedPattern.includes('*') ||
92
- expandedPattern.includes('?') ||
93
- expandedPattern.includes('{')) {
94
- // Resolve the absolute pattern path
95
- const absolutePattern = node_path_1.default.resolve(process.cwd(), expandedPattern);
96
- // Prepare exclude patterns with locale replaced
97
- const expandedExcludePatterns = excludePatterns.map((p) => node_path_1.default.resolve(process.cwd(), p.replace(/\[locale\]/g, locale)));
98
- // Use fast-glob to find all matching files, excluding the patterns
99
- const matches = fast_glob_1.default.sync(absolutePattern, {
100
- absolute: true,
101
- ignore: expandedExcludePatterns,
102
- });
103
- resolvedPaths.push(...matches);
104
- // For each match, create a version with [locale] in the correct positions
105
- matches.forEach((match) => {
106
- // Convert to relative path to make replacement easier
107
- const relativePath = node_path_1.default.relative(process.cwd(), match);
108
- let originalRelativePath = relativePath;
109
- // Replace locale with [locale] at each tracked position
110
- if (localePositions.length > 0) {
111
- // We need to account for path resolution differences
112
- // This is a simplified approach - we'll replace all instances of the locale
113
- // but only in path segments where we expect it based on the original pattern
114
- const pathParts = relativePath.split(node_path_1.default.sep);
115
- const patternParts = pattern.split(/[\/\\]/); // Handle both slash types
116
- for (let i = 0; i < pathParts.length; i++) {
117
- if (i < patternParts.length) {
118
- if (patternParts[i].includes(localeTag)) {
119
- // This segment should have the locale replaced
120
- pathParts[i] = pathParts[i].replace(locale, localeTag);
121
- }
90
+ // Resolve the absolute pattern path
91
+ const absolutePattern = node_path_1.default.resolve(process.cwd(), expandedPattern);
92
+ // Prepare exclude patterns with locale replaced
93
+ const expandedExcludePatterns = excludePatterns.map((p) => node_path_1.default.resolve(process.cwd(), p.replace(/\[locale\]/g, locale)));
94
+ // Use fast-glob to find all matching files, excluding the patterns
95
+ const matches = fast_glob_1.default.sync(absolutePattern, {
96
+ absolute: true,
97
+ ignore: expandedExcludePatterns,
98
+ });
99
+ resolvedPaths.push(...matches);
100
+ // For each match, create a version with [locale] in the correct positions
101
+ matches.forEach((match) => {
102
+ // Convert to relative path to make replacement easier
103
+ const relativePath = node_path_1.default.relative(process.cwd(), match);
104
+ let originalRelativePath = relativePath;
105
+ // Replace locale with [locale] at each tracked position
106
+ if (localePositions.length > 0) {
107
+ // We need to account for path resolution differences
108
+ // This is a simplified approach - we'll replace all instances of the locale
109
+ // but only in path segments where we expect it based on the original pattern
110
+ const pathParts = relativePath.split(node_path_1.default.sep);
111
+ const patternParts = pattern.split(/[\/\\]/); // Handle both slash types
112
+ for (let i = 0; i < pathParts.length; i++) {
113
+ if (i < patternParts.length) {
114
+ if (patternParts[i].includes(localeTag)) {
115
+ // This segment should have the locale replaced
116
+ pathParts[i] = pathParts[i].replace(locale, localeTag);
122
117
  }
123
118
  }
124
- originalRelativePath = pathParts.join(node_path_1.default.sep);
125
119
  }
126
- // Convert back to absolute path
127
- const originalPath = node_path_1.default.resolve(process.cwd(), originalRelativePath);
128
- placeholderPaths.push(originalPath);
129
- });
130
- }
131
- else {
132
- // If it's not a glob pattern, just add the resolved path if it's not excluded
133
- const absolutePath = node_path_1.default.resolve(process.cwd(), expandedPattern);
134
- // Check if this path should be excluded
135
- const expandedExcludePatterns = excludePatterns.map((p) => node_path_1.default.resolve(process.cwd(), p.replace(/\[locale\]/g, locale)));
136
- // Only include if not matched by any exclude pattern
137
- const shouldExclude = expandedExcludePatterns.some((excludePattern) => {
138
- if (excludePattern.includes('*') ||
139
- excludePattern.includes('?') ||
140
- excludePattern.includes('{')) {
141
- return fast_glob_1.default
142
- .sync(excludePattern, { absolute: true })
143
- .includes(absolutePath);
144
- }
145
- return absolutePath === excludePattern;
146
- });
147
- if (!shouldExclude) {
148
- resolvedPaths.push(absolutePath);
149
- // For non-glob patterns, we can directly replace locale with [locale]
150
- // at the tracked positions in the resolved path
151
- let originalPath = node_path_1.default.resolve(process.cwd(), pattern);
152
- placeholderPaths.push(originalPath);
120
+ originalRelativePath = pathParts.join(node_path_1.default.sep);
153
121
  }
154
- }
122
+ // Convert back to absolute path
123
+ const originalPath = node_path_1.default.resolve(process.cwd(), originalRelativePath);
124
+ placeholderPaths.push(originalPath);
125
+ });
155
126
  }
156
127
  return { resolvedPaths, placeholderPaths };
157
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "1.2.9",
3
+ "version": "1.2.10-alpha.2",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "scripts": {