gtx-cli 2.5.43 → 2.5.44
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/cli/base.js +32 -17
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/locadex/setupFlow.d.ts +2 -0
- package/dist/locadex/setupFlow.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.5.44
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#936](https://github.com/generaltranslation/gt/pull/936) [`45ee200`](https://github.com/generaltranslation/gt/commit/45ee20016ff82ea07008e053e296146a0e925841) Thanks [@brian-lou](https://github.com/brian-lou)! - Create Locadex AI Agent link in gtx-cli init command
|
|
8
|
+
|
|
3
9
|
## 2.5.43
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/cli/base.js
CHANGED
|
@@ -24,6 +24,7 @@ import updateConfig from '../fs/config/updateConfig.js';
|
|
|
24
24
|
import { createLoadTranslationsFile } from '../fs/createLoadTranslationsFile.js';
|
|
25
25
|
import { saveLocalEdits } from '../api/saveLocalEdits.js';
|
|
26
26
|
import processSharedStaticAssets from '../utils/sharedStaticAssets.js';
|
|
27
|
+
import { setupLocadex } from '../locadex/setupFlow.js';
|
|
27
28
|
export class BaseCLI {
|
|
28
29
|
library;
|
|
29
30
|
additionalModules;
|
|
@@ -180,30 +181,44 @@ export class BaseCLI {
|
|
|
180
181
|
.option('--src <paths...>', "Space-separated list of glob patterns containing the app's source code, by default 'src/**/*.{js,jsx,ts,tsx}' 'app/**/*.{js,jsx,ts,tsx}' 'pages/**/*.{js,jsx,ts,tsx}' 'components/**/*.{js,jsx,ts,tsx}'")
|
|
181
182
|
.option('-c, --config <path>', 'Filepath to config file, by default gt.config.json', findFilepath(['gt.config.json']))
|
|
182
183
|
.action(async (options) => {
|
|
184
|
+
const settings = await generateSettings(options);
|
|
183
185
|
displayHeader('Running setup wizard...');
|
|
184
186
|
const packageJson = await searchForPackageJson();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
message: `Detected that this project is using React. Would you like to run the React setup wizard?\nThis will install gt-react|gt-next as a dependency and internationalize your app.`,
|
|
187
|
+
const isUsingNextjs = packageJson && isPackageInstalled('next', packageJson);
|
|
188
|
+
const useAgent = isUsingNextjs
|
|
189
|
+
? await promptConfirm({
|
|
190
|
+
message: `Detected that this project is using Next.js. Would you like to use the Locadex AI Agent to automatically set up your project?`,
|
|
190
191
|
defaultValue: true,
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
})
|
|
193
|
+
: false;
|
|
194
|
+
if (useAgent) {
|
|
195
|
+
await setupLocadex(settings);
|
|
196
|
+
logger.endCommand('Done! The Locadex AI Agent will run in the background and set up your project. See the docs for more information: https://generaltranslation.com/docs');
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
let ranReactSetup = false;
|
|
200
|
+
// so that people can run init in non-js projects
|
|
201
|
+
if (packageJson && isPackageInstalled('react', packageJson)) {
|
|
202
|
+
const wrap = await promptConfirm({
|
|
203
|
+
message: `Detected that this project is using React. Would you like to run the React setup wizard?\nThis will install gt-react|gt-next as a dependency and internationalize your app.`,
|
|
204
|
+
defaultValue: true,
|
|
205
|
+
});
|
|
206
|
+
if (wrap) {
|
|
207
|
+
logger.info(`${chalk.yellow('[EXPERIMENTAL]')} Running React setup wizard...`);
|
|
208
|
+
await this.handleSetupReactCommand(options);
|
|
209
|
+
logger.endCommand(`Done! Since this wizard is experimental, please review the changes and make modifications as needed.
|
|
196
210
|
Certain aspects of your app may still need manual setup.
|
|
197
211
|
See the docs for more information: https://generaltranslation.com/docs/react/tutorials/quickstart`);
|
|
198
|
-
|
|
212
|
+
ranReactSetup = true;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
215
|
+
if (ranReactSetup) {
|
|
216
|
+
logger.startCommand('Setting up project config...');
|
|
217
|
+
}
|
|
218
|
+
// Configure gt.config.json
|
|
219
|
+
await this.handleInitCommand(ranReactSetup);
|
|
220
|
+
logger.endCommand('Done! Check out our docs for more information on how to use General Translation: https://generaltranslation.com/docs');
|
|
200
221
|
}
|
|
201
|
-
if (ranReactSetup) {
|
|
202
|
-
logger.startCommand('Setting up project config...');
|
|
203
|
-
}
|
|
204
|
-
// Configure gt.config.json
|
|
205
|
-
await this.handleInitCommand(ranReactSetup);
|
|
206
|
-
logger.endCommand('Done! Check out our docs for more information on how to use General Translation: https://generaltranslation.com/docs');
|
|
207
222
|
});
|
|
208
223
|
}
|
|
209
224
|
setupConfigureCommand() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.5.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.5.44";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.5.
|
|
2
|
+
export const PACKAGE_VERSION = '2.5.44';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { logger } from '../console/logger.js';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
export async function setupLocadex(settings) {
|
|
4
|
+
const urlToOpen = `${settings.dashboardUrl}/api/integrations/github/start?returnTo=%2Fproject%2Flocadex`;
|
|
5
|
+
await import('open').then((open) => open.default(urlToOpen, {
|
|
6
|
+
wait: false,
|
|
7
|
+
}));
|
|
8
|
+
logger.message(`${chalk.dim(`If the browser window didn't open automatically, please open the following link:`)}\n\n${chalk.cyan(urlToOpen)}`);
|
|
9
|
+
}
|