gtx-cli 1.2.22 → 1.2.24-alpha.1

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,11 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 1.2.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [#336](https://github.com/generaltranslation/gt/pull/336) [`d22c287`](https://github.com/generaltranslation/gt/commit/d22c2871f1b474bc6cf981621a37400a92b4bbff) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix string translation fallback function tracing when translating
8
+
3
9
  ## 1.2.22
4
10
 
5
11
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -6,7 +6,7 @@ FSL-1.1-ALv2
6
6
 
7
7
  ## Notice
8
8
 
9
- Copyright 2024 General Translation, Inc.
9
+ Copyright 2025 General Translation, Inc.
10
10
 
11
11
  ## Terms and Conditions
12
12
 
@@ -1,3 +1,4 @@
1
+ import { Command } from 'commander';
1
2
  import { Settings, SupportedLibraries, SetupOptions } from '../types';
2
3
  export type TranslateOptions = {
3
4
  config?: string;
@@ -13,7 +14,8 @@ export type LoginOptions = {
13
14
  export declare class BaseCLI {
14
15
  protected library: SupportedLibraries;
15
16
  protected additionalModules: SupportedLibraries[];
16
- constructor(library: SupportedLibraries, additionalModules?: SupportedLibraries[]);
17
+ protected program: Command;
18
+ constructor(program: Command, library: SupportedLibraries, additionalModules?: SupportedLibraries[]);
17
19
  init(): void;
18
20
  execute(): void;
19
21
  protected setupGTCommand(): void;
package/dist/cli/base.js CHANGED
@@ -37,8 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.BaseCLI = void 0;
40
- const commander_1 = require("commander");
41
- const setupConfig_1 = __importDefault(require("../fs/config/setupConfig"));
40
+ const setupConfig_1 = require("../fs/config/setupConfig");
42
41
  const findFilepath_1 = __importStar(require("../fs/findFilepath"));
43
42
  const console_1 = require("../console");
44
43
  const node_path_1 = __importDefault(require("node:path"));
@@ -57,8 +56,10 @@ const credentials_2 = require("../utils/credentials");
57
56
  class BaseCLI {
58
57
  library;
59
58
  additionalModules;
59
+ program;
60
60
  // Constructor is shared amongst all CLI class types
61
- constructor(library, additionalModules) {
61
+ constructor(program, library, additionalModules) {
62
+ this.program = program;
62
63
  this.library = library;
63
64
  this.additionalModules = additionalModules || [];
64
65
  this.setupInitCommand();
@@ -76,10 +77,9 @@ class BaseCLI {
76
77
  if (process.argv.length <= 2) {
77
78
  process.argv.push('init');
78
79
  }
79
- commander_1.program.parse();
80
80
  }
81
81
  setupGTCommand() {
82
- commander_1.program
82
+ this.program
83
83
  .command('translate')
84
84
  .description('Translate your project using General Translation')
85
85
  .option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', (0, findFilepath_1.default)(['gt.config.json']))
@@ -97,7 +97,7 @@ class BaseCLI {
97
97
  });
98
98
  }
99
99
  setupLoginCommand() {
100
- commander_1.program
100
+ this.program
101
101
  .command('auth')
102
102
  .description('Generate a General Translation API key and project ID')
103
103
  .option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', (0, findFilepath_1.default)(['gt.config.json']))
@@ -130,7 +130,7 @@ class BaseCLI {
130
130
  });
131
131
  }
132
132
  setupInitCommand() {
133
- commander_1.program
133
+ this.program
134
134
  .command('init')
135
135
  .description('Run the setup wizard to configure your project for General Translation')
136
136
  .option('--src <paths...>', "Filepath to directory containing the app's source code, by default ./src || ./app || ./pages || ./components", (0, findFilepath_1.findFilepaths)(['./src', './app', './pages', './components']))
@@ -163,7 +163,7 @@ See the docs for more information: https://generaltranslation.com/docs/react/tut
163
163
  });
164
164
  }
165
165
  setupConfigureCommand() {
166
- commander_1.program
166
+ this.program
167
167
  .command('configure')
168
168
  .description('Configure your project for General Translation. This will create a gt.config.json file in your codebase.')
169
169
  .action(async () => {
@@ -175,7 +175,7 @@ See the docs for more information: https://generaltranslation.com/docs/react/tut
175
175
  });
176
176
  }
177
177
  setupSetupCommand() {
178
- commander_1.program
178
+ this.program
179
179
  .command('setup')
180
180
  .description('Run the setup to configure your Next.js or React project for General Translation')
181
181
  .option('--src <paths...>', "Filepath to directory containing the app's source code, by default ./src || ./app || ./pages || ./components", (0, findFilepath_1.findFilepaths)(['./src', './app', './pages', './components']))
@@ -248,7 +248,7 @@ See the docs for more information: https://generaltranslation.com/docs/react/tut
248
248
  : null;
249
249
  const message = !isUsingGT
250
250
  ? 'What is the format of your language resource files? Select as many as applicable.\nAdditionally, you can translate any other files you have in your project.'
251
- : `${chalk_1.default.gray('(Optional)')} Do you have any separate files you would like to translate? For example, extra Markdown files for docs.`;
251
+ : `${chalk_1.default.dim('(Optional)')} Do you have any separate files you would like to translate? For example, extra Markdown files for docs.`;
252
252
  const dataFormats = await (0, console_1.promptMultiSelect)({
253
253
  message,
254
254
  options: [
@@ -281,7 +281,7 @@ See the docs for more information: https://generaltranslation.com/docs/react/tut
281
281
  configFilepath = 'src/gt.config.json';
282
282
  }
283
283
  // Create gt.config.json
284
- await (0, setupConfig_1.default)(configFilepath, {
284
+ await (0, setupConfig_1.createOrUpdateConfig)(configFilepath, {
285
285
  defaultLocale,
286
286
  locales,
287
287
  files: Object.keys(files).length > 0 ? files : undefined,
@@ -1,7 +1,8 @@
1
1
  import { WrapOptions, SupportedFrameworks, SupportedLibraries } from '../types';
2
2
  import { ReactCLI } from './react';
3
+ import { Command } from 'commander';
3
4
  export declare class NextCLI extends ReactCLI {
4
- constructor(library: 'gt-next', additionalModules?: SupportedLibraries[]);
5
+ constructor(command: Command, library: 'gt-next', additionalModules?: SupportedLibraries[]);
5
6
  init(): void;
6
7
  execute(): void;
7
8
  protected wrapContent(options: WrapOptions, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
package/dist/cli/next.js CHANGED
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.NextCLI = void 0;
7
4
  const react_1 = require("./react");
8
- const wrapContent_1 = __importDefault(require("../next/parse/wrapContent"));
5
+ const wrapContent_1 = require("../next/parse/wrapContent");
9
6
  const pkg = 'gt-next';
10
7
  class NextCLI extends react_1.ReactCLI {
11
- constructor(library, additionalModules) {
12
- super(library, additionalModules);
8
+ constructor(command, library, additionalModules) {
9
+ super(command, library, additionalModules);
13
10
  }
14
11
  init() {
15
12
  this.setupStageCommand();
@@ -21,7 +18,7 @@ class NextCLI extends react_1.ReactCLI {
21
18
  super.execute();
22
19
  }
23
20
  wrapContent(options, framework, errors, warnings) {
24
- return (0, wrapContent_1.default)(options, pkg, errors, warnings);
21
+ return (0, wrapContent_1.wrapContentNext)(options, pkg, errors, warnings);
25
22
  }
26
23
  }
27
24
  exports.NextCLI = NextCLI;
@@ -1,7 +1,8 @@
1
+ import { Command } from 'commander';
1
2
  import { Options, SupportedFrameworks, WrapOptions, GenerateSourceOptions, SupportedLibraries } from '../types';
2
3
  import { BaseCLI } from './base';
3
4
  export declare class ReactCLI extends BaseCLI {
4
- constructor(library: 'gt-react' | 'gt-next', additionalModules?: SupportedLibraries[]);
5
+ constructor(command: Command, library: 'gt-react' | 'gt-next', additionalModules?: SupportedLibraries[]);
5
6
  init(): void;
6
7
  execute(): void;
7
8
  protected wrapContent(options: WrapOptions, framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
package/dist/cli/react.js CHANGED
@@ -37,15 +37,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ReactCLI = void 0;
40
- // packages/gt-cli-core/src/BaseCLI.ts
41
- const commander_1 = require("commander");
42
40
  const console_1 = require("../console/console");
43
41
  const loadJSON_1 = __importDefault(require("../fs/loadJSON"));
44
42
  const findFilepath_1 = __importStar(require("../fs/findFilepath"));
45
43
  const chalk_1 = __importDefault(require("chalk"));
46
44
  const postProcess_1 = require("../hooks/postProcess");
47
45
  const base_1 = require("./base");
48
- const wrapContent_1 = __importDefault(require("../react/parse/wrapContent"));
46
+ const wrapContent_1 = require("../react/parse/wrapContent");
49
47
  const generateSettings_1 = require("../config/generateSettings");
50
48
  const saveJSON_1 = require("../fs/saveJSON");
51
49
  const parseFilesConfig_1 = require("../fs/config/parseFilesConfig");
@@ -57,8 +55,8 @@ const updateConfig_1 = __importDefault(require("../fs/config/updateConfig"));
57
55
  const DEFAULT_TIMEOUT = 600;
58
56
  const pkg = 'gt-react';
59
57
  class ReactCLI extends base_1.BaseCLI {
60
- constructor(library, additionalModules) {
61
- super(library, additionalModules);
58
+ constructor(command, library, additionalModules) {
59
+ super(command, library, additionalModules);
62
60
  }
63
61
  init() {
64
62
  this.setupStageCommand();
@@ -70,10 +68,10 @@ class ReactCLI extends base_1.BaseCLI {
70
68
  super.execute();
71
69
  }
72
70
  wrapContent(options, framework, errors, warnings) {
73
- return (0, wrapContent_1.default)(options, pkg, framework, errors, warnings);
71
+ return (0, wrapContent_1.wrapContentReact)(options, pkg, framework, errors, warnings);
74
72
  }
75
73
  setupStageCommand() {
76
- commander_1.program
74
+ this.program
77
75
  .command('stage')
78
76
  .description('Submits the project to the General Translation API for translation. Translations created using this command will require human approval.')
79
77
  .option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', (0, findFilepath_1.default)(['gt.config.json']))
@@ -96,7 +94,7 @@ class ReactCLI extends base_1.BaseCLI {
96
94
  });
97
95
  }
98
96
  setupTranslateCommand() {
99
- commander_1.program
97
+ this.program
100
98
  .command('translate')
101
99
  .description('Scans the project for a dictionary and/or <T> tags, and sends the updates to the General Translation API for translation.')
102
100
  .option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', (0, findFilepath_1.default)(['gt.config.json']))
@@ -119,7 +117,7 @@ class ReactCLI extends base_1.BaseCLI {
119
117
  });
120
118
  }
121
119
  setupGenerateSourceCommand() {
122
- commander_1.program
120
+ this.program
123
121
  .command('generate')
124
122
  .description('Generate a translation file for the source locale. The -t flag must be provided. This command should be used if you are handling your own translations.')
125
123
  .option('--src <paths...>', "Filepath to directory containing the app's source code, by default ./src || ./app || ./pages || ./components")
@@ -136,13 +134,14 @@ class ReactCLI extends base_1.BaseCLI {
136
134
  });
137
135
  }
138
136
  setupScanCommand() {
139
- commander_1.program
137
+ this.program
140
138
  .command('scan')
141
139
  .description('Scans the project and wraps all JSX elements in the src directory with a <T> tag, with unique ids')
142
140
  .option('--src <paths...>', "Filepath to directory containing the app's source code, by default ./src || ./app || ./pages || ./components", (0, findFilepath_1.findFilepaths)(['./src', './app', './pages', './components']))
143
141
  .option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', (0, findFilepath_1.default)(['gt.config.json']))
144
142
  .option('--disable-ids', 'Disable id generation for the <T> tags', false)
145
143
  .option('--disable-formatting', 'Disable formatting of edited files', false)
144
+ .option('--skip-ts', 'Skip wrapping <T> tags in TypeScript files', false)
146
145
  .action(async (options) => {
147
146
  (0, console_1.displayHeader)('Scanning project...');
148
147
  await this.handleScanCommand(options);
@@ -173,7 +172,7 @@ class ReactCLI extends base_1.BaseCLI {
173
172
  .join('\n')));
174
173
  }
175
174
  else {
176
- (0, console_1.logErrorAndExit)(chalk_1.default.red(`CLI tool encountered errors while scanning for translatable content. ${chalk_1.default.gray('To ignore these errors, re-run with --ignore-errors')}\n` +
175
+ (0, console_1.logErrorAndExit)(chalk_1.default.red(`CLI tool encountered errors while scanning for translatable content. ${chalk_1.default.dim('To ignore these errors, re-run with --ignore-errors')}\n` +
177
176
  errors
178
177
  .map((error) => chalk_1.default.red('• Error: ') + chalk_1.default.white(error))
179
178
  .join('\n')));
@@ -9,7 +9,7 @@ const warnings_1 = require("../console/warnings");
9
9
  const loadConfig_1 = __importDefault(require("../fs/config/loadConfig"));
10
10
  const internal_1 = require("generaltranslation/internal");
11
11
  const node_fs_1 = __importDefault(require("node:fs"));
12
- const setupConfig_1 = __importDefault(require("../fs/config/setupConfig"));
12
+ const setupConfig_1 = require("../fs/config/setupConfig");
13
13
  const parseFilesConfig_1 = require("../fs/config/parseFilesConfig");
14
14
  const findFilepath_1 = require("../fs/findFilepath");
15
15
  const validateSettings_1 = require("./validateSettings");
@@ -82,7 +82,7 @@ async function generateSettings(options) {
82
82
  // if there's no existing config file, creates one
83
83
  // does not include the API key to avoid exposing it
84
84
  if (!node_fs_1.default.existsSync(mergedOptions.config)) {
85
- await (0, setupConfig_1.default)(mergedOptions.config, {
85
+ await (0, setupConfig_1.createOrUpdateConfig)(mergedOptions.config, {
86
86
  projectId: mergedOptions.projectId,
87
87
  defaultLocale: mergedOptions.defaultLocale,
88
88
  locales: mergedOptions.locales?.length > 0 ? mergedOptions.locales : undefined,
@@ -22,5 +22,5 @@ function colorizeContent(content) {
22
22
  return chalk_1.default.yellow(content);
23
23
  }
24
24
  function colorizeLine(line) {
25
- return chalk_1.default.gray(line);
25
+ return chalk_1.default.dim(line);
26
26
  }
@@ -12,11 +12,7 @@ export declare function displayProjectId(projectId: string): void;
12
12
  export declare function displayResolvedPaths(resolvedPaths: [string, string][]): void;
13
13
  export declare function displayCreatedConfigFile(configFilepath: string): void;
14
14
  export declare function displayUpdatedConfigFile(configFilepath: string): void;
15
- export declare function createSpinner(indicator?: 'dots' | 'timer'): {
16
- start: (msg?: string) => void;
17
- stop: (msg?: string, code?: number) => void;
18
- message: (msg?: string) => void;
19
- };
15
+ export declare function createSpinner(indicator?: 'dots' | 'timer'): import("@clack/prompts", { with: { "resolution-mode": "import" } }).SpinnerResult;
20
16
  export declare function createOraSpinner(indicator?: 'dots' | 'circleHalves'): Promise<import("ora", { with: { "resolution-mode": "import" } }).Ora>;
21
17
  export declare function promptText({ message, defaultValue, validate, }: {
22
18
  message: string;
@@ -84,15 +84,15 @@ Y8, 88 88
84
84
  function displayInitializingText() {
85
85
  const version = (0, packageJson_1.getCLIVersion)();
86
86
  console.log(`\n${chalk_1.default.bold.blue('General Translation, Inc.')}
87
- ${chalk_1.default.gray('https://generaltranslation.com/docs')}
88
- ${chalk_1.default.gray(`CLI Version: ${version}\n`)}`);
87
+ ${chalk_1.default.dim('https://generaltranslation.com/docs')}
88
+ ${chalk_1.default.dim(`CLI Version: ${version}\n`)}`);
89
89
  }
90
90
  function displayProjectId(projectId) {
91
- logMessage(chalk_1.default.gray(`Project ID: ${chalk_1.default.bold(projectId)}`));
91
+ logMessage(chalk_1.default.dim(`Project ID: ${chalk_1.default.bold(projectId)}`));
92
92
  }
93
93
  function displayResolvedPaths(resolvedPaths) {
94
94
  const paths = resolvedPaths.map(([key, resolvedPath]) => {
95
- return chalk_1.default.gray(`'${chalk_1.default.white(key)}' → '${chalk_1.default.green(resolvedPath)}'`);
95
+ return chalk_1.default.dim(`'${chalk_1.default.white(key)}' → '${chalk_1.default.green(resolvedPath)}'`);
96
96
  });
97
97
  prompts_1.log.step(`Resolved path aliases:\n${paths.join('\n')}`);
98
98
  }
@@ -118,7 +118,7 @@ async function promptText({ message, defaultValue, validate, }) {
118
118
  placeholder: defaultValue,
119
119
  validate: validate
120
120
  ? (value) => {
121
- const validation = validate(value);
121
+ const validation = validate(value || '');
122
122
  return validation === true ? undefined : validation.toString();
123
123
  }
124
124
  : undefined,
@@ -6,7 +6,7 @@ import { FilesOptions, SupportedFrameworks } from '../../types';
6
6
  * @param {string} configFilepath - The path to the config file.
7
7
  * @param {Record<string, any>} configObject - The config object to write if the file does not exist.
8
8
  */
9
- export default function createOrUpdateConfig(configFilepath: string, options: {
9
+ export declare function createOrUpdateConfig(configFilepath: string, options: {
10
10
  projectId?: string;
11
11
  defaultLocale?: string;
12
12
  locales?: string[];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = createOrUpdateConfig;
6
+ exports.createOrUpdateConfig = createOrUpdateConfig;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const console_1 = require("../../console");
9
9
  /**
@@ -54,7 +54,7 @@ async function formatFiles(filesUpdated, formatter) {
54
54
  return;
55
55
  }
56
56
  if (detectedFormatter === 'prettier') {
57
- (0, console_1.logMessage)(chalk_1.default.gray('Cleaning up with prettier...'));
57
+ (0, console_1.logMessage)(chalk_1.default.dim('Cleaning up with prettier...'));
58
58
  const prettier = require('prettier');
59
59
  for (const file of filesUpdated) {
60
60
  const config = await prettier.resolveConfig(file);
@@ -68,7 +68,7 @@ async function formatFiles(filesUpdated, formatter) {
68
68
  return;
69
69
  }
70
70
  if (detectedFormatter === 'biome') {
71
- (0, console_1.logMessage)(chalk_1.default.gray('Cleaning up with biome...'));
71
+ (0, console_1.logMessage)(chalk_1.default.dim('Cleaning up with biome...'));
72
72
  try {
73
73
  await new Promise((resolve, reject) => {
74
74
  const { spawn } = require('child_process');
@@ -99,7 +99,7 @@ async function formatFiles(filesUpdated, formatter) {
99
99
  return;
100
100
  }
101
101
  if (detectedFormatter === 'eslint') {
102
- (0, console_1.logMessage)(chalk_1.default.gray('Cleaning up with eslint...'));
102
+ (0, console_1.logMessage)(chalk_1.default.dim('Cleaning up with eslint...'));
103
103
  const { ESLint } = require('eslint');
104
104
  const eslint = new ESLint({
105
105
  fix: true,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { BaseCLI } from './cli/base';
2
- export default function main(): void;
2
+ import { Command } from 'commander';
3
+ export declare function main(program: Command): void;
3
4
  export { BaseCLI };
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseCLI = void 0;
4
- exports.default = main;
4
+ exports.main = main;
5
5
  const base_1 = require("./cli/base");
6
6
  Object.defineProperty(exports, "BaseCLI", { enumerable: true, get: function () { return base_1.BaseCLI; } });
7
7
  const next_1 = require("./cli/next");
8
8
  const react_1 = require("./cli/react");
9
9
  const determineFramework_1 = require("./fs/determineFramework");
10
- function main() {
10
+ function main(program) {
11
11
  const { library, additionalModules } = (0, determineFramework_1.determineLibrary)();
12
12
  let cli;
13
13
  if (library === 'gt-next') {
14
- cli = new next_1.NextCLI(library, additionalModules);
14
+ cli = new next_1.NextCLI(program, library, additionalModules);
15
15
  }
16
16
  else if (library === 'gt-react') {
17
- cli = new react_1.ReactCLI(library, additionalModules);
17
+ cli = new react_1.ReactCLI(program, library, additionalModules);
18
18
  }
19
19
  else {
20
- cli = new base_1.BaseCLI(library, additionalModules);
20
+ cli = new base_1.BaseCLI(program, library, additionalModules);
21
21
  }
22
22
  cli.init();
23
23
  cli.execute();
package/dist/main.js CHANGED
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const index_1 = __importDefault(require("./index"));
7
+ const index_1 = require("./index");
8
8
  const dotenv_1 = __importDefault(require("dotenv"));
9
+ const commander_1 = require("commander");
9
10
  dotenv_1.default.config({ path: '.env' });
10
11
  dotenv_1.default.config({ path: '.env.local', override: true });
11
12
  dotenv_1.default.config({ path: '.env.production', override: true });
12
- (0, index_1.default)();
13
+ (0, index_1.main)(commander_1.program);
14
+ commander_1.program.parse();
@@ -1 +1 @@
1
- export default function handleInitGT(filepath: string, errors: string[], warnings: string[], filesUpdated: string[]): Promise<void>;
1
+ export declare function handleInitGT(filepath: string, errors: string[], warnings: string[], filesUpdated: string[]): Promise<void>;
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = handleInitGT;
39
+ exports.handleInitGT = handleInitGT;
40
40
  const node_fs_1 = __importDefault(require("node:fs"));
41
41
  const parser_1 = require("@babel/parser");
42
42
  const generator_1 = __importDefault(require("@babel/generator"));
@@ -6,6 +6,6 @@ import { WrapOptions } from '../../types';
6
6
  * @param options - The options object
7
7
  * @returns An object containing the updates and errors
8
8
  */
9
- export default function wrapContentNext(options: WrapOptions, pkg: 'gt-next', errors: string[], warnings: string[]): Promise<{
9
+ export declare function wrapContentNext(options: WrapOptions, pkg: 'gt-next', errors: string[], warnings: string[]): Promise<{
10
10
  filesUpdated: string[];
11
11
  }>;
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = wrapContentNext;
39
+ exports.wrapContentNext = wrapContentNext;
40
40
  const node_fs_1 = __importDefault(require("node:fs"));
41
41
  const t = __importStar(require("@babel/types"));
42
42
  const parser_1 = require("@babel/parser");
@@ -126,6 +126,10 @@ async function wrapContentNext(options, pkg, errors, warnings) {
126
126
  path.skip();
127
127
  return;
128
128
  }
129
+ // If skip wrapping Ts, skip processing this node
130
+ if (options.skipTs) {
131
+ return;
132
+ }
129
133
  // Check if this JSX element has any JSX element ancestors
130
134
  if (t.isJSXElement(path.parentPath?.node) ||
131
135
  t.isJSXExpressionContainer(path.parentPath?.node)) {
@@ -6,12 +6,12 @@ export declare const attributes: string[];
6
6
  *
7
7
  * Supports complex patterns including:
8
8
  * 1. Direct calls: const t = useGT(); t('hello');
9
- * 2. Function parameters: const t = useGT(); getInfo(t); where getInfo uses t() internally
10
- * 3. Cross-file function calls: imported functions that receive t as a parameter
9
+ * 2. Translation callback prop drilling: const t = useGT(); getInfo(t); where getInfo uses t() internally
10
+ * 3. Cross-file function calls: imported functions that receive the translation callback as a parameter
11
11
  *
12
12
  * Example flow:
13
13
  * - const t = useGT();
14
14
  * - const { home } = getInfo(t); // getInfo is imported from './constants'
15
- * - This will parse constants.ts to find t() calls within getInfo function
15
+ * - This will parse constants.ts to find translation calls within getInfo function
16
16
  */
17
17
  export declare function parseStrings(importName: string, path: NodePath, updates: Updates, errors: string[], file: string): void;
@@ -105,21 +105,163 @@ function processTranslationCall(tPath, updates, errors, file) {
105
105
  }
106
106
  }
107
107
  /**
108
- * Finds all usages of a function parameter within a function's scope and processes
109
- * any translation calls made with that parameter.
108
+ * Extracts the parameter name from a function parameter node, handling TypeScript annotations.
109
+ */
110
+ function extractParameterName(param) {
111
+ if (t.isIdentifier(param)) {
112
+ return param.name;
113
+ }
114
+ return null;
115
+ }
116
+ /**
117
+ * Builds a map of imported function names to their import paths from a given program path.
118
+ * Handles both named imports and default imports.
119
+ *
120
+ * Example: import { getInfo } from './constants' -> Map { 'getInfo' => './constants' }
121
+ * Example: import utils from './utils' -> Map { 'utils' => './utils' }
122
+ */
123
+ function buildImportMap(programPath) {
124
+ const importMap = new Map();
125
+ programPath.traverse({
126
+ ImportDeclaration(importPath) {
127
+ if (t.isStringLiteral(importPath.node.source)) {
128
+ const importSource = importPath.node.source.value;
129
+ importPath.node.specifiers.forEach((spec) => {
130
+ if (t.isImportSpecifier(spec) &&
131
+ t.isIdentifier(spec.imported) &&
132
+ t.isIdentifier(spec.local)) {
133
+ importMap.set(spec.local.name, importSource);
134
+ }
135
+ else if (t.isImportDefaultSpecifier(spec) &&
136
+ t.isIdentifier(spec.local)) {
137
+ importMap.set(spec.local.name, importSource);
138
+ }
139
+ });
140
+ }
141
+ },
142
+ });
143
+ return importMap;
144
+ }
145
+ /**
146
+ * Recursively resolves variable assignments to find all aliases of a translation callback parameter.
147
+ * Handles cases like: const t = translate; const a = translate; const b = a; const c = b;
148
+ *
149
+ * @param scope The scope to search within
150
+ * @param variableName The variable name to resolve
151
+ * @param visited Set to track already visited variables to prevent infinite loops
152
+ * @returns Array of all variable names that reference the original translation callback
153
+ */
154
+ function resolveVariableAliases(scope, variableName, visited = new Set()) {
155
+ if (visited.has(variableName)) {
156
+ return []; // Prevent infinite loops
157
+ }
158
+ visited.add(variableName);
159
+ const aliases = [variableName];
160
+ const binding = scope.bindings[variableName];
161
+ if (binding) {
162
+ // Look for variable declarations that assign this variable to another name
163
+ // Example: const t = translate; or const a = t;
164
+ for (const [otherVarName, otherBinding] of Object.entries(scope.bindings)) {
165
+ if (otherVarName === variableName || visited.has(otherVarName))
166
+ continue;
167
+ const otherBindingTyped = otherBinding;
168
+ if (otherBindingTyped.path &&
169
+ otherBindingTyped.path.isVariableDeclarator() &&
170
+ otherBindingTyped.path.node.init &&
171
+ t.isIdentifier(otherBindingTyped.path.node.init) &&
172
+ otherBindingTyped.path.node.init.name === variableName) {
173
+ // Found an alias: const otherVarName = variableName;
174
+ const nestedAliases = resolveVariableAliases(scope, otherVarName, visited);
175
+ aliases.push(...nestedAliases);
176
+ }
177
+ }
178
+ }
179
+ return aliases;
180
+ }
181
+ /**
182
+ * Handles how translation callbacks are used within code.
183
+ * This covers both direct translation calls (t('hello')) and prop drilling
184
+ * where the translation callback is passed to other functions (getData(t)).
185
+ */
186
+ function handleFunctionCall(tPath, updates, errors, file, importMap) {
187
+ if (tPath.parent.type === 'CallExpression' &&
188
+ tPath.parent.callee === tPath.node) {
189
+ // Direct translation call: t('hello')
190
+ processTranslationCall(tPath, updates, errors, file);
191
+ }
192
+ else if (tPath.parent.type === 'CallExpression' &&
193
+ t.isExpression(tPath.node) &&
194
+ tPath.parent.arguments.includes(tPath.node)) {
195
+ // Parameter passed to another function: getData(t)
196
+ const argIndex = tPath.parent.arguments.indexOf(tPath.node);
197
+ const callee = tPath.parent.callee;
198
+ if (t.isIdentifier(callee)) {
199
+ const calleeBinding = tPath.scope.getBinding(callee.name);
200
+ if (calleeBinding && calleeBinding.path.isFunction()) {
201
+ const functionPath = calleeBinding.path;
202
+ processFunctionIfMatches(callee.name, argIndex, functionPath.node, functionPath, updates, errors, file);
203
+ }
204
+ // Handle arrow functions assigned to variables: const getData = (t) => {...}
205
+ else if (calleeBinding &&
206
+ calleeBinding.path.isVariableDeclarator() &&
207
+ calleeBinding.path.node.init &&
208
+ (t.isArrowFunctionExpression(calleeBinding.path.node.init) ||
209
+ t.isFunctionExpression(calleeBinding.path.node.init))) {
210
+ const initPath = calleeBinding.path.get('init');
211
+ processFunctionIfMatches(callee.name, argIndex, calleeBinding.path.node.init, initPath, updates, errors, file);
212
+ }
213
+ // If not found locally, check if it's an imported function
214
+ else if (importMap.has(callee.name)) {
215
+ const importPath = importMap.get(callee.name);
216
+ const resolvedPath = resolveImportPath(file, importPath);
217
+ if (resolvedPath) {
218
+ findFunctionInFile(resolvedPath, callee.name, argIndex, updates, errors);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ /**
225
+ * Processes a user-defined function that receives a translation callback as a parameter.
226
+ * Validates the function has enough parameters and traces how the translation callback
227
+ * is used within that function's body.
228
+ */
229
+ function processFunctionIfMatches(_functionName, argIndex, functionNode, functionPath, updates, errors, filePath) {
230
+ if (functionNode.params.length > argIndex) {
231
+ const param = functionNode.params[argIndex];
232
+ const paramName = extractParameterName(param);
233
+ if (paramName) {
234
+ findFunctionParameterUsage(functionPath, paramName, updates, errors, filePath);
235
+ }
236
+ }
237
+ }
238
+ /**
239
+ * Finds all usages of a translation callback parameter within a user-defined function's scope.
240
+ * Processes both direct translation calls and cases where the translation callback is passed
241
+ * to other functions (prop drilling).
110
242
  *
111
243
  * Example: In function getInfo(t) { return t('hello'); }, this finds the t('hello') call.
244
+ * Example: In function getData(t) { return getFooter(t); }, this finds and traces into getFooter.
112
245
  */
113
246
  function findFunctionParameterUsage(functionPath, parameterName, updates, errors, file) {
114
247
  // Look for the function body and find all usages of the parameter
115
248
  if (functionPath.isFunction()) {
116
249
  const functionScope = functionPath.scope;
117
- const binding = functionScope.bindings[parameterName];
118
- if (binding) {
119
- binding.referencePaths.forEach((refPath) => {
120
- processTranslationCall(refPath, updates, errors, file);
121
- });
122
- }
250
+ // Resolve all aliases of the translation callback parameter
251
+ // Example: translate -> [translate, t, a, b] for const t = translate; const a = t; const b = a;
252
+ const allParameterNames = resolveVariableAliases(functionScope, parameterName);
253
+ // Build import map for this function's scope to handle cross-file calls
254
+ const programPath = functionPath.scope.getProgramParent().path;
255
+ const importMap = buildImportMap(programPath);
256
+ // Process references for all parameter names and their aliases
257
+ allParameterNames.forEach((name) => {
258
+ const binding = functionScope.bindings[name];
259
+ if (binding) {
260
+ binding.referencePaths.forEach((refPath) => {
261
+ handleFunctionCall(refPath, updates, errors, file, importMap);
262
+ });
263
+ }
264
+ });
123
265
  }
124
266
  }
125
267
  /**
@@ -164,12 +306,31 @@ function resolveImportPath(currentFile, importPath) {
164
306
  return resolve.sync(importPath, { basedir, extensions });
165
307
  }
166
308
  catch {
309
+ // If resolution fails, try to manually replace .js/.jsx with .ts/.tsx for source files
310
+ if (importPath.endsWith('.js')) {
311
+ const tsPath = importPath.replace(/\.js$/, '.ts');
312
+ try {
313
+ return resolve.sync(tsPath, { basedir, extensions });
314
+ }
315
+ catch {
316
+ // Continue to return null
317
+ }
318
+ }
319
+ else if (importPath.endsWith('.jsx')) {
320
+ const tsxPath = importPath.replace(/\.jsx$/, '.tsx');
321
+ try {
322
+ return resolve.sync(tsxPath, { basedir, extensions });
323
+ }
324
+ catch {
325
+ // Continue to return null
326
+ }
327
+ }
167
328
  return null;
168
329
  }
169
330
  }
170
331
  /**
171
- * Searches for a specific function in a file and analyzes how a particular parameter
172
- * (at argIndex position) is used within that function for translation calls.
332
+ * Searches for a specific user-defined function in a file and analyzes how a translation callback
333
+ * parameter (at argIndex position) is used within that function.
173
334
  *
174
335
  * Handles multiple function declaration patterns:
175
336
  * - function getInfo(t) { ... }
@@ -186,25 +347,8 @@ function findFunctionInFile(filePath, functionName, argIndex, updates, errors) {
186
347
  (0, traverse_1.default)(ast, {
187
348
  // Handle function declarations: function getInfo(t) { ... }
188
349
  FunctionDeclaration(path) {
189
- if (path.node.id?.name === functionName &&
190
- path.node.params.length > argIndex) {
191
- const param = path.node.params[argIndex];
192
- if (t.isIdentifier(param)) {
193
- findFunctionParameterUsage(path, param.name, updates, errors, filePath);
194
- }
195
- }
196
- },
197
- // Handle exported function declarations: export function getInfo(t) { ... }
198
- ExportNamedDeclaration(path) {
199
- if (path.node.declaration &&
200
- t.isFunctionDeclaration(path.node.declaration)) {
201
- const func = path.node.declaration;
202
- if (func.id?.name === functionName && func.params.length > argIndex) {
203
- const param = func.params[argIndex];
204
- if (t.isIdentifier(param)) {
205
- findFunctionParameterUsage(path.get('declaration'), param.name, updates, errors, filePath);
206
- }
207
- }
350
+ if (path.node.id?.name === functionName) {
351
+ processFunctionIfMatches(functionName, argIndex, path.node, path, updates, errors, filePath);
208
352
  }
209
353
  },
210
354
  // Handle variable declarations: const getInfo = (t) => { ... }
@@ -213,13 +357,9 @@ function findFunctionInFile(filePath, functionName, argIndex, updates, errors) {
213
357
  path.node.id.name === functionName &&
214
358
  path.node.init &&
215
359
  (t.isArrowFunctionExpression(path.node.init) ||
216
- t.isFunctionExpression(path.node.init)) &&
217
- path.node.init.params.length > argIndex) {
218
- const param = path.node.init.params[argIndex];
219
- if (t.isIdentifier(param)) {
220
- const initPath = path.get('init');
221
- findFunctionParameterUsage(initPath, param.name, updates, errors, filePath);
222
- }
360
+ t.isFunctionExpression(path.node.init))) {
361
+ const initPath = path.get('init');
362
+ processFunctionIfMatches(functionName, argIndex, path.node.init, initPath, updates, errors, filePath);
223
363
  }
224
364
  },
225
365
  });
@@ -233,35 +373,17 @@ function findFunctionInFile(filePath, functionName, argIndex, updates, errors) {
233
373
  *
234
374
  * Supports complex patterns including:
235
375
  * 1. Direct calls: const t = useGT(); t('hello');
236
- * 2. Function parameters: const t = useGT(); getInfo(t); where getInfo uses t() internally
237
- * 3. Cross-file function calls: imported functions that receive t as a parameter
376
+ * 2. Translation callback prop drilling: const t = useGT(); getInfo(t); where getInfo uses t() internally
377
+ * 3. Cross-file function calls: imported functions that receive the translation callback as a parameter
238
378
  *
239
379
  * Example flow:
240
380
  * - const t = useGT();
241
381
  * - const { home } = getInfo(t); // getInfo is imported from './constants'
242
- * - This will parse constants.ts to find t() calls within getInfo function
382
+ * - This will parse constants.ts to find translation calls within getInfo function
243
383
  */
244
384
  function parseStrings(importName, path, updates, errors, file) {
245
385
  // First, collect all imports in this file to track cross-file function calls
246
- const importMap = new Map(); // functionName -> importPath
247
- path.scope.getProgramParent().path.traverse({
248
- ImportDeclaration(importPath) {
249
- if (t.isStringLiteral(importPath.node.source)) {
250
- const importSource = importPath.node.source.value;
251
- importPath.node.specifiers.forEach((spec) => {
252
- if (t.isImportSpecifier(spec) &&
253
- t.isIdentifier(spec.imported) &&
254
- t.isIdentifier(spec.local)) {
255
- importMap.set(spec.local.name, importSource);
256
- }
257
- else if (t.isImportDefaultSpecifier(spec) &&
258
- t.isIdentifier(spec.local)) {
259
- importMap.set(spec.local.name, importSource);
260
- }
261
- });
262
- }
263
- },
264
- });
386
+ const importMap = buildImportMap(path.scope.getProgramParent().path);
265
387
  const referencePaths = path.scope.bindings[importName]?.referencePaths || [];
266
388
  for (const refPath of referencePaths) {
267
389
  // Find call expressions of useGT() / await getGT()
@@ -280,40 +402,7 @@ function parseStrings(importName, path, updates, errors, file) {
280
402
  const variableScope = effectiveParent.scope;
281
403
  const tReferencePaths = variableScope.bindings[tFuncName]?.referencePaths || [];
282
404
  for (const tPath of tReferencePaths) {
283
- // Check if this is a direct call to the translation function
284
- if (tPath.parent.type === 'CallExpression' &&
285
- tPath.parent.callee === tPath.node) {
286
- processTranslationCall(tPath, updates, errors, file);
287
- }
288
- // Check if this is being passed as an argument to another function
289
- else if (tPath.parent.type === 'CallExpression' &&
290
- t.isExpression(tPath.node) &&
291
- tPath.parent.arguments.includes(tPath.node)) {
292
- // Find which parameter position this is
293
- const argIndex = tPath.parent.arguments.indexOf(tPath.node);
294
- // Try to find the function definition being called
295
- const callee = tPath.parent.callee;
296
- if (t.isIdentifier(callee)) {
297
- // Look for function declarations or function expressions with this name
298
- const calleeBinding = tPath.scope.getBinding(callee.name);
299
- if (calleeBinding && calleeBinding.path.isFunction()) {
300
- const functionPath = calleeBinding.path;
301
- const params = functionPath.node.params;
302
- if (params[argIndex] && t.isIdentifier(params[argIndex])) {
303
- const paramName = params[argIndex].name;
304
- findFunctionParameterUsage(functionPath, paramName, updates, errors, file);
305
- }
306
- }
307
- // If not found locally, check if it's an imported function
308
- else if (importMap.has(callee.name)) {
309
- const importPath = importMap.get(callee.name);
310
- const resolvedPath = resolveImportPath(file, importPath);
311
- if (resolvedPath) {
312
- findFunctionInFile(resolvedPath, callee.name, argIndex, updates, errors);
313
- }
314
- }
315
- }
316
- }
405
+ handleFunctionCall(tPath, updates, errors, file, importMap);
317
406
  }
318
407
  }
319
408
  }
@@ -6,6 +6,6 @@ import { SupportedFrameworks, WrapOptions } from '../../types';
6
6
  * @param options - The options object
7
7
  * @returns An object containing the updates and errors
8
8
  */
9
- export default function wrapContentReact(options: WrapOptions, pkg: 'gt-react', framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
9
+ export declare function wrapContentReact(options: WrapOptions, pkg: 'gt-react', framework: SupportedFrameworks, errors: string[], warnings: string[]): Promise<{
10
10
  filesUpdated: string[];
11
11
  }>;
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = wrapContentReact;
39
+ exports.wrapContentReact = wrapContentReact;
40
40
  const node_fs_1 = __importDefault(require("node:fs"));
41
41
  const node_path_1 = __importDefault(require("node:path"));
42
42
  const t = __importStar(require("@babel/types"));
@@ -16,7 +16,7 @@ async function getDesiredLocales() {
16
16
  });
17
17
  // Ask for the locales
18
18
  const locales = await (0, console_1.promptText)({
19
- message: `What locales would you like to translate your project into? ${chalk_1.default.gray('(space-separated list)')}`,
19
+ message: `What locales would you like to translate your project into? ${chalk_1.default.dim('(space-separated list)')}`,
20
20
  defaultValue: 'es zh fr de ja',
21
21
  validate: (input) => {
22
22
  const localeList = input.split(' ');
@@ -11,13 +11,13 @@ const chalk_1 = __importDefault(require("chalk"));
11
11
  const console_3 = require("../console");
12
12
  const findFilepath_1 = __importDefault(require("../fs/findFilepath"));
13
13
  const postProcess_2 = require("../hooks/postProcess");
14
- const handleInitGT_1 = __importDefault(require("../next/parse/handleInitGT"));
14
+ const handleInitGT_1 = require("../next/parse/handleInitGT");
15
15
  const packageJson_1 = require("../utils/packageJson");
16
- const wrapContent_1 = __importDefault(require("../react/parse/wrapContent"));
17
- const wrapContent_2 = __importDefault(require("../next/parse/wrapContent"));
16
+ const wrapContent_1 = require("../react/parse/wrapContent");
17
+ const wrapContent_2 = require("../next/parse/wrapContent");
18
18
  const packageManager_1 = require("../utils/packageManager");
19
19
  const installPackage_1 = require("../utils/installPackage");
20
- const setupConfig_1 = __importDefault(require("../fs/config/setupConfig"));
20
+ const setupConfig_1 = require("../fs/config/setupConfig");
21
21
  async function handleSetupReactCommand(options) {
22
22
  // Ask user for confirmation using inquirer
23
23
  const answer = await (0, console_3.promptConfirm)({
@@ -41,7 +41,7 @@ Make sure you have committed or stashed any changes. Do you want to continue?`),
41
41
  { value: 'gatsby', label: chalk_1.default.magenta('Gatsby') },
42
42
  { value: 'react', label: chalk_1.default.yellow('React') },
43
43
  { value: 'redwood', label: chalk_1.default.red('RedwoodJS') },
44
- { value: 'other', label: chalk_1.default.gray('Other') },
44
+ { value: 'other', label: chalk_1.default.dim('Other') },
45
45
  ],
46
46
  defaultValue: 'next-app',
47
47
  });
@@ -51,7 +51,7 @@ Please let us know what you would like to see supported at https://github.com/ge
51
51
  process.exit(0);
52
52
  }
53
53
  // ----- Create a starter gt.config.json file -----
54
- await (0, setupConfig_1.default)(options.config || 'gt.config.json', {
54
+ await (0, setupConfig_1.createOrUpdateConfig)(options.config || 'gt.config.json', {
55
55
  framework: frameworkType,
56
56
  });
57
57
  const packageJson = await (0, packageJson_1.getPackageJson)();
@@ -103,17 +103,18 @@ Please let us know what you would like to see supported at https://github.com/ge
103
103
  ...options,
104
104
  disableIds: !includeTId,
105
105
  disableFormatting: true,
106
+ skipTs: false,
106
107
  addGTProvider,
107
108
  };
108
109
  const spinner = (0, console_1.createSpinner)();
109
110
  spinner.start('Wrapping JSX content with <T> tags...');
110
111
  // Wrap all JSX elements in the src directory with a <T> tag, with unique ids
111
- const { filesUpdated: filesUpdatedNext } = await (0, wrapContent_2.default)(mergeOptions, 'gt-next', errors, warnings);
112
+ const { filesUpdated: filesUpdatedNext } = await (0, wrapContent_2.wrapContentNext)(mergeOptions, 'gt-next', errors, warnings);
112
113
  filesUpdated = [...filesUpdated, ...filesUpdatedNext];
113
114
  spinner.stop(chalk_1.default.green(`Success! Added <T> tags and updated ${chalk_1.default.bold.cyan(filesUpdated.length)} files:\n`) + filesUpdated.map((file) => `${chalk_1.default.green('-')} ${file}`).join('\n'));
114
115
  if (addWithGTConfig) {
115
116
  // Add the withGTConfig() function to the next.config.js file
116
- await (0, handleInitGT_1.default)(nextConfigPath, errors, warnings, filesUpdated);
117
+ await (0, handleInitGT_1.handleInitGT)(nextConfigPath, errors, warnings, filesUpdated);
117
118
  (0, console_2.logStep)(chalk_1.default.green(`Added withGTConfig() to your ${nextConfigPath} file.`));
118
119
  }
119
120
  if (errors.length > 0) {
@@ -138,12 +139,13 @@ Please let us know what you would like to see supported at https://github.com/ge
138
139
  ...options,
139
140
  disableIds: !includeTId,
140
141
  disableFormatting: true,
142
+ skipTs: false,
141
143
  addGTProvider,
142
144
  };
143
145
  const spinner = (0, console_1.createSpinner)();
144
146
  spinner.start('Wrapping JSX content with <T> tags...');
145
147
  // Wrap all JSX elements in the src directory with a <T> tag, with unique ids
146
- const { filesUpdated: filesUpdatedReact } = await (0, wrapContent_1.default)(mergeOptions, 'gt-react', frameworkType, errors, warnings);
148
+ const { filesUpdated: filesUpdatedReact } = await (0, wrapContent_1.wrapContentReact)(mergeOptions, 'gt-react', frameworkType, errors, warnings);
147
149
  filesUpdated = [...filesUpdated, ...filesUpdatedReact];
148
150
  spinner.stop(chalk_1.default.green(`Success! Added <T> tags and updated ${chalk_1.default.bold.cyan(filesUpdated.length)} files:\n`) + filesUpdated.map((file) => `${chalk_1.default.green('-')} ${file}`).join('\n'));
149
151
  if (errors.length > 0) {
@@ -162,7 +164,7 @@ Please let us know what you would like to see supported at https://github.com/ge
162
164
  return;
163
165
  }
164
166
  const applyFormatting = await (0, console_3.promptConfirm)({
165
- message: `Would you like the wizard to auto-format the modified files? ${chalk_1.default.gray(`(${formatter})`)}`,
167
+ message: `Would you like the wizard to auto-format the modified files? ${chalk_1.default.dim(`(${formatter})`)}`,
166
168
  defaultValue: true,
167
169
  });
168
170
  // Format updated files if formatters are available
@@ -40,7 +40,7 @@ async function stageProject(settings, pkg) {
40
40
  .join('')));
41
41
  }
42
42
  else {
43
- (0, errors_1.logErrorAndExit)(chalk_1.default.red(`Error: CLI tool encountered syntax errors while scanning for translatable content. ${chalk_1.default.gray('To ignore these errors, re-run with --ignore-errors')}\n` +
43
+ (0, errors_1.logErrorAndExit)(chalk_1.default.red(`Error: CLI tool encountered syntax errors while scanning for translatable content. ${chalk_1.default.dim('To ignore these errors, re-run with --ignore-errors')}\n` +
44
44
  errors
45
45
  .map((error) => chalk_1.default.red('• ') + chalk_1.default.white(error) + '\n')
46
46
  .join('')));
@@ -32,6 +32,7 @@ export type Options = {
32
32
  export type WrapOptions = {
33
33
  src: string[];
34
34
  config: string;
35
+ skipTs: boolean;
35
36
  disableIds: boolean;
36
37
  disableFormatting: boolean;
37
38
  addGTProvider: boolean;
@@ -19,7 +19,7 @@ async function retrieveCredentials(settings, keyType) {
19
19
  await import('open').then((open) => open.default(urlToOpen, {
20
20
  wait: false,
21
21
  }));
22
- (0, console_1.logMessage)(`${chalk_1.default.gray(`If the browser window didn't open automatically, please open the following link:`)}\n\n${chalk_1.default.cyan(urlToOpen)}`);
22
+ (0, console_1.logMessage)(`${chalk_1.default.dim(`If the browser window didn't open automatically, please open the following link:`)}\n\n${chalk_1.default.cyan(urlToOpen)}`);
23
23
  const spinner = (0, console_1.createSpinner)('dots');
24
24
  spinner.start('Waiting for response from dashboard...');
25
25
  const credentials = await new Promise(async (resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "1.2.22",
3
+ "version": "1.2.24-alpha.1",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [
@@ -44,8 +44,14 @@
44
44
  "./api/*": {
45
45
  "import": "./dist/api/*.js"
46
46
  },
47
+ "./setup/*": {
48
+ "import": "./dist/setup/*.js"
49
+ },
47
50
  "./*": {
48
51
  "import": "./dist/*.js"
52
+ },
53
+ "./utils/*": {
54
+ "import": "./dist/utils/*.js"
49
55
  }
50
56
  },
51
57
  "repository": {
@@ -72,7 +78,7 @@
72
78
  "@babel/parser": "^7.25.7",
73
79
  "@babel/plugin-transform-react-jsx": "^7.25.9",
74
80
  "@babel/traverse": "^7.25.7",
75
- "@clack/prompts": "^0.11.0",
81
+ "@clack/prompts": "^1.0.0-alpha.1",
76
82
  "chalk": "^4.1.2",
77
83
  "commander": "^12.1.0",
78
84
  "dotenv": "^16.4.5",