gtx-cli 2.6.20 → 2.6.22

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.6.22
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1029](https://github.com/generaltranslation/gt/pull/1029) [`c3dcd6f`](https://github.com/generaltranslation/gt/commit/c3dcd6f9390e8516c6c0c1eee373e587b38c4772) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: compatability interface issue with types
8
+
9
+ ## 2.6.21
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1021](https://github.com/generaltranslation/gt/pull/1021) [`4cbf7da`](https://github.com/generaltranslation/gt/commit/4cbf7da4bb0d202e2b7c8a6995566538b71856e9) Thanks [@brian-lou](https://github.com/brian-lou)! - Use default branch name instead of placeholder
14
+
15
+ - Updated dependencies [[`9e99e94`](https://github.com/generaltranslation/gt/commit/9e99e945cbf9e31990930e3428468f64d7240da5)]:
16
+ - generaltranslation@8.1.10
17
+
3
18
  ## 2.6.20
4
19
 
5
20
  ### Patch Changes
@@ -4,3 +4,4 @@
4
4
  */
5
5
  export { getValidateJson } from './translation/validate.js';
6
6
  export type { ValidationResult, ValidationMessage, ValidationLevel, } from './translation/validate.js';
7
+ export { Libraries, GTLibrary, InlineLibrary, ReactLibrary, GT_LIBRARIES, INLINE_LIBRARIES, REACT_LIBRARIES, GT_LIBRARIES_UPSTREAM, } from './types/libraries.js';
package/dist/functions.js CHANGED
@@ -3,3 +3,4 @@
3
3
  * Import from 'gtx-cli/functions' to access these APIs.
4
4
  */
5
5
  export { getValidateJson } from './translation/validate.js';
6
+ export { Libraries, GT_LIBRARIES, INLINE_LIBRARIES, REACT_LIBRARIES, GT_LIBRARIES_UPSTREAM, } from './types/libraries.js';
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "2.6.20";
1
+ export declare const PACKAGE_VERSION = "2.6.22";
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const PACKAGE_VERSION = '2.6.20';
2
+ export const PACKAGE_VERSION = '2.6.22';
@@ -7,6 +7,6 @@ import { Libraries } from '../../types/libraries.js';
7
7
  * @param options - The options object
8
8
  * @returns An object containing the updates and errors
9
9
  */
10
- export declare function wrapContentNext(options: WrapOptions, pkg: typeof Libraries.GT_NEXT, errors: string[], warnings: string[]): Promise<{
10
+ export declare function wrapContentNext(options: WrapOptions, pkg: `${typeof Libraries.GT_NEXT}`, errors: string[], warnings: string[]): Promise<{
11
11
  filesUpdated: string[];
12
12
  }>;
@@ -7,6 +7,6 @@ import { Libraries } from '../../types/libraries.js';
7
7
  * @param options - The options object
8
8
  * @returns An object containing the updates and errors
9
9
  */
10
- export declare function wrapContentReact(options: WrapOptions, pkg: typeof Libraries.GT_REACT, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
10
+ export declare function wrapContentReact(options: WrapOptions, pkg: `${typeof Libraries.GT_REACT}`, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
11
11
  filesUpdated: string[];
12
12
  }>;
@@ -1,5 +1,5 @@
1
- import { Framework, Options, Settings } from '../types/index.js';
2
- import { InlineLibrary } from '../types/libraries.js';
1
+ import { Options, Settings } from '../types/index.js';
2
+ import { InlineLibrary, Libraries } from '../types/libraries.js';
3
3
  export type ValidationLevel = 'error' | 'warning';
4
4
  export type ValidationMessage = {
5
5
  level: ValidationLevel;
@@ -10,5 +10,5 @@ export type ValidationResult = Record<string, ValidationMessage[]>;
10
10
  * Programmatic API for validation - returns structured results instead of logging/exiting.
11
11
  * Equivalent to running `gtx-cli validate` but returns data.
12
12
  */
13
- export declare function getValidateJson(settings: Options & Settings, pkg: Framework, files?: string[]): Promise<ValidationResult>;
13
+ export declare function getValidateJson(settings: Options & Settings, pkg: `${typeof Libraries.GT_REACT}` | `${typeof Libraries.GT_NEXT}` | `${typeof Libraries.GT_REACT_NATIVE}`, files?: string[]): Promise<ValidationResult>;
14
14
  export declare function validateProject(settings: Options & Settings, pkg: InlineLibrary, files?: string[]): Promise<void>;
@@ -4,6 +4,7 @@ import findFilepath from '../fs/findFilepath.js';
4
4
  import { logger } from '../console/logger.js';
5
5
  import { createUpdates } from './parse.js';
6
6
  import { createInlineUpdates } from '../react/parse/createInlineUpdates.js';
7
+ import { Libraries } from '../types/libraries.js';
7
8
  /**
8
9
  * Shared validation logic - returns raw results from createUpdates/createInlineUpdates
9
10
  */
@@ -49,8 +50,15 @@ function parseFileFromMessage(msg) {
49
50
  * Programmatic API for validation - returns structured results instead of logging/exiting.
50
51
  * Equivalent to running `gtx-cli validate` but returns data.
51
52
  */
52
- export async function getValidateJson(settings, pkg, files) {
53
- const { errors, warnings } = await runValidation(settings, pkg, files);
53
+ export async function getValidateJson(settings,
54
+ // TODO: fix compatability more generally so do not have to do this
55
+ pkg, files) {
56
+ const validatedPkg = pkg === Libraries.GT_NEXT
57
+ ? Libraries.GT_NEXT
58
+ : pkg === Libraries.GT_REACT_NATIVE
59
+ ? Libraries.GT_REACT_NATIVE
60
+ : Libraries.GT_REACT;
61
+ const { errors, warnings } = await runValidation(settings, validatedPkg, files);
54
62
  const result = {};
55
63
  const addMessage = (file, level, message) => {
56
64
  if (!result[file]) {
@@ -30,6 +30,7 @@ export class BranchStep extends WorkflowStep {
30
30
  let incoming = [];
31
31
  let checkedOut = [];
32
32
  let useDefaultBranch = true;
33
+ let detectedDefaultBranchName = 'main';
33
34
  let autoDetectFailed = !this.settings.branchOptions.autoDetectBranches;
34
35
  if (this.settings.branchOptions.enabled &&
35
36
  this.settings.branchOptions.autoDetectBranches) {
@@ -41,6 +42,9 @@ export class BranchStep extends WorkflowStep {
41
42
  current = currentResult;
42
43
  incoming = incomingResult;
43
44
  checkedOut = checkedOutResult;
45
+ if (currentResult) {
46
+ detectedDefaultBranchName = currentResult.defaultBranchName;
47
+ }
44
48
  // Try env var detection if git commands failed (e.g. Vercel)
45
49
  if (!currentResult) {
46
50
  autoDetectFailed = true;
@@ -75,7 +79,7 @@ export class BranchStep extends WorkflowStep {
75
79
  }
76
80
  if (!branchData.defaultBranch) {
77
81
  const createBranchResult = await this.gt.createBranch({
78
- branchName: 'main', // name doesn't matter for default branch
82
+ branchName: detectedDefaultBranchName,
79
83
  defaultBranch: true,
80
84
  });
81
85
  this.branchData.currentBranch = createBranchResult.branch;
@@ -103,7 +107,7 @@ export class BranchStep extends WorkflowStep {
103
107
  // retry with default branch
104
108
  try {
105
109
  const createBranchResult = await this.gt.createBranch({
106
- branchName: 'main', // name doesn't matter for default branch
110
+ branchName: detectedDefaultBranchName,
107
111
  defaultBranch: true,
108
112
  });
109
113
  this.branchData.currentBranch = createBranchResult.branch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.6.20",
3
+ "version": "2.6.22",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [
@@ -110,7 +110,7 @@
110
110
  "unified": "^11.0.5",
111
111
  "unist-util-visit": "^5.0.0",
112
112
  "yaml": "^2.8.0",
113
- "generaltranslation": "8.1.9"
113
+ "generaltranslation": "8.1.10"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@babel/types": "^7.28.4",