gtx-cli 2.6.17 → 2.6.19
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 +18 -0
- package/dist/cli/base.d.ts +2 -0
- package/dist/cli/base.js +76 -14
- package/dist/cli/flags.d.ts +12 -1
- package/dist/cli/flags.js +24 -5
- package/dist/cli/inline.d.ts +17 -0
- package/dist/cli/inline.js +133 -0
- package/dist/cli/next.d.ts +2 -3
- package/dist/cli/next.js +2 -11
- package/dist/cli/node.d.ts +10 -0
- package/dist/cli/node.js +9 -0
- package/dist/cli/react.d.ts +4 -11
- package/dist/cli/react.js +7 -121
- package/dist/formats/files/collectFiles.js +4 -3
- package/dist/fs/determineFramework.js +11 -4
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/index.js +8 -2
- package/dist/next/parse/wrapContent.d.ts +2 -1
- package/dist/next/parse/wrapContent.js +8 -7
- package/dist/react/jsx/utils/constants.d.ts +1 -5
- package/dist/react/jsx/utils/constants.js +2 -43
- package/dist/react/jsx/utils/getPathsAndAliases.d.ts +1 -1
- package/dist/react/jsx/utils/getPathsAndAliases.js +3 -4
- package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +1 -1
- package/dist/react/jsx/utils/jsxParsing/parseTProps.js +2 -1
- package/dist/react/jsx/utils/mapAttributeName.d.ts +6 -0
- package/dist/react/jsx/utils/mapAttributeName.js +14 -0
- package/dist/react/jsx/utils/parseAst.d.ts +1 -1
- package/dist/react/jsx/utils/parseString.js +2 -1
- package/dist/react/jsx/utils/parseStringFunction.js +3 -2
- package/dist/react/parse/createInlineUpdates.d.ts +1 -1
- package/dist/react/parse/createInlineUpdates.js +23 -20
- package/dist/react/parse/wrapContent.d.ts +2 -1
- package/dist/react/parse/wrapContent.js +6 -6
- package/dist/setup/agentInstructions.d.ts +24 -0
- package/dist/setup/agentInstructions.js +138 -0
- package/dist/setup/frameworkUtils.js +4 -1
- package/dist/setup/instructions/base.md +29 -0
- package/dist/setup/instructions/gt-next.md +107 -0
- package/dist/setup/instructions/gt-react.md +98 -0
- package/dist/setup/wizard.js +10 -9
- package/dist/translation/parse.d.ts +2 -1
- package/dist/translation/stage.d.ts +2 -1
- package/dist/translation/stage.js +1 -1
- package/dist/translation/validate.d.ts +4 -3
- package/dist/types/index.d.ts +3 -2
- package/dist/types/libraries.d.ts +31 -0
- package/dist/types/libraries.js +72 -0
- package/package.json +3 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# gt-next
|
|
2
|
+
|
|
3
|
+
This project is using the `gt-next` internationalization library for Next.js App Router.
|
|
4
|
+
|
|
5
|
+
## gt-next setup
|
|
6
|
+
|
|
7
|
+
- `GTProvider` must wrap the app in the root layout to provide translation context.
|
|
8
|
+
- The `withGTConfig()` plugin wraps `next.config` in the Next.js config file.
|
|
9
|
+
- (optional) `createNextMiddleware()` is used in `proxy.ts` for automatic locale routing.
|
|
10
|
+
|
|
11
|
+
## Translating JSX
|
|
12
|
+
|
|
13
|
+
`gt-next` uses the `<T>` component for translation.
|
|
14
|
+
|
|
15
|
+
Pass JSX content as the direct children of `<T>` to translate it. Children of `<T>` must be static — no JS expressions or variables directly inside.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { T } from 'gt-next';
|
|
19
|
+
|
|
20
|
+
<T>
|
|
21
|
+
<h1>Welcome to our store</h1>
|
|
22
|
+
<p>
|
|
23
|
+
Browse our <a href='/products'>latest products</a> and find something you
|
|
24
|
+
love.
|
|
25
|
+
</p>
|
|
26
|
+
</T>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can also add a `context` prop to `<T>` to give context to the translator. For example:
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
import { T } from 'gt-next';
|
|
33
|
+
|
|
34
|
+
<T context="Cookies as in web cookies">
|
|
35
|
+
View your <a href="/cookies">Cookies</a>
|
|
36
|
+
</T>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Translating simple strings
|
|
40
|
+
|
|
41
|
+
Use the `gt` function returned by the `useGT()` hook to translate strings directly. Invoke `useGT()` in synchronous components or `await getGT()` in async components only.
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { useGT } from 'gt-next';
|
|
45
|
+
const gt = useGT();
|
|
46
|
+
gt('Hello, world!'); // returns "Hola, mundo"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import { getGT } from 'gt-next/server';
|
|
51
|
+
const gt = await getGT(); // use await version in async components only
|
|
52
|
+
gt('Hello, world!');
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Just like with the children of the `<T>` component, all strings passed to `gt()` must be static string literals. No variables or template literals.
|
|
56
|
+
|
|
57
|
+
## Translating shared or out-of-scope strings
|
|
58
|
+
|
|
59
|
+
Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { msg, useMessages } from 'gt-next';
|
|
63
|
+
|
|
64
|
+
const greeting = msg('Hello, world!');
|
|
65
|
+
|
|
66
|
+
export default function Greeting() {
|
|
67
|
+
const m = useMessages();
|
|
68
|
+
return <p>{m(greeting)}</p>;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- All strings passed to `msg()` must be static string literals. No variables or template literals.
|
|
73
|
+
- Use the equivalent `await getMessages()` for async components.
|
|
74
|
+
- `useMessages()` / `getMessages()` take no arguments.
|
|
75
|
+
|
|
76
|
+
## Dynamic content inside `<T>`
|
|
77
|
+
|
|
78
|
+
Use variable components for dynamic values inside `<T>`:
|
|
79
|
+
|
|
80
|
+
- `<Var>{value}</Var>` — variables (strings, numbers, etc.)
|
|
81
|
+
- `<Num>{value}</Num>` — formatted numbers
|
|
82
|
+
- `<Currency>{value}</Currency>` — formatted currency
|
|
83
|
+
- `<DateTime>{value}</DateTime>` — formatted dates/times
|
|
84
|
+
|
|
85
|
+
```jsx
|
|
86
|
+
import { T, Var, Num } from 'gt-next';
|
|
87
|
+
|
|
88
|
+
<T>
|
|
89
|
+
<Var>{userName}</Var> ordered <Num>{itemCount}</Num> items.
|
|
90
|
+
</T>;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Utility hooks
|
|
94
|
+
|
|
95
|
+
### `useLocale()`
|
|
96
|
+
|
|
97
|
+
`useLocale` returns the user's current language, as a BCP 47 locale tag.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { useLocale } from 'gt-next'
|
|
101
|
+
|
|
102
|
+
const locale = useLocale(); // "en-US"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Quickstart
|
|
106
|
+
|
|
107
|
+
See <https://generaltranslation.com/docs/next.md>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# gt-react
|
|
2
|
+
|
|
3
|
+
This project is using the `gt-react` internationalization library.
|
|
4
|
+
|
|
5
|
+
## gt-react setup
|
|
6
|
+
|
|
7
|
+
- `GTProvider` must wrap the app in the root layout to provide translation context.
|
|
8
|
+
|
|
9
|
+
## Translating JSX
|
|
10
|
+
|
|
11
|
+
`gt-react` uses the `<T>` component for translation.
|
|
12
|
+
|
|
13
|
+
Pass JSX content as the direct children of `<T>` to translate it. Children of `<T>` must be static — no JS expressions or variables directly inside.
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { T } from 'gt-react';
|
|
17
|
+
|
|
18
|
+
<T>
|
|
19
|
+
<h1>Welcome to our store</h1>
|
|
20
|
+
<p>
|
|
21
|
+
Browse our <a href='/products'>latest products</a> and find something you
|
|
22
|
+
love.
|
|
23
|
+
</p>
|
|
24
|
+
</T>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You can also add a `context` prop to `<T>` to give context to the translator. For example:
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
import { T } from 'gt-react';
|
|
31
|
+
|
|
32
|
+
<T context="Cookies as in web cookies">
|
|
33
|
+
View your <a href="/cookies">Cookies</a>
|
|
34
|
+
</T>;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Translating simple strings
|
|
38
|
+
|
|
39
|
+
Use the `gt` function returned by the `useGT()` hook to translate strings directly.
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { useGT } from 'gt-react';
|
|
43
|
+
const gt = useGT();
|
|
44
|
+
gt('Hello, world!'); // returns "Hola, mundo"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Just like with the children of the `<T>` component, all strings passed to `gt()` must be static string literals. No variables or template literals.
|
|
48
|
+
|
|
49
|
+
## Translating shared or out-of-scope strings
|
|
50
|
+
|
|
51
|
+
Use `msg()` to register strings for translation, and `useMessages()` to translate them. `const m = useMessages()` should be used equivalently to `const gt = useGT()`.
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import { msg, useMessages } from 'gt-react';
|
|
55
|
+
|
|
56
|
+
const greeting = msg('Hello, world!');
|
|
57
|
+
|
|
58
|
+
export default function Greeting() {
|
|
59
|
+
const m = useMessages();
|
|
60
|
+
return <p>{m(greeting)}</p>;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- All strings passed to `msg()` must be static string literals. No variables or template literals.
|
|
65
|
+
- `useMessages()` / `getMessages()` take no arguments.
|
|
66
|
+
|
|
67
|
+
## Dynamic content inside `<T>`
|
|
68
|
+
|
|
69
|
+
Use variable components for dynamic values inside `<T>`:
|
|
70
|
+
|
|
71
|
+
- `<Var>{value}</Var>` — variables (strings, numbers, etc.)
|
|
72
|
+
- `<Num>{value}</Num>` — formatted numbers
|
|
73
|
+
- `<Currency>{value}</Currency>` — formatted currency
|
|
74
|
+
- `<DateTime>{value}</DateTime>` — formatted dates/times
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
import { T, Var, Num } from 'gt-react';
|
|
78
|
+
|
|
79
|
+
<T>
|
|
80
|
+
<Var>{userName}</Var> ordered <Num>{itemCount}</Num> items.
|
|
81
|
+
</T>;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Utility hooks
|
|
85
|
+
|
|
86
|
+
### `useLocale()`
|
|
87
|
+
|
|
88
|
+
`useLocale` returns the user's current language, as a BCP 47 locale tag.
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { useLocale } from 'gt-react'
|
|
92
|
+
|
|
93
|
+
const locale = useLocale(); // "en-US"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Quickstart
|
|
97
|
+
|
|
98
|
+
See <https://generaltranslation.com/docs/react.md>
|
package/dist/setup/wizard.js
CHANGED
|
@@ -15,6 +15,7 @@ import { loadConfig } from '../fs/config/loadConfig.js';
|
|
|
15
15
|
import { addVitePlugin } from '../react/parse/addVitePlugin/index.js';
|
|
16
16
|
import { exitSync } from '../console/logging.js';
|
|
17
17
|
import { getFrameworkDisplayName } from './frameworkUtils.js';
|
|
18
|
+
import { Libraries } from '../types/libraries.js';
|
|
18
19
|
export async function handleSetupReactCommand(options, frameworkObject, useDefaults = false) {
|
|
19
20
|
const frameworkDisplayName = getFrameworkDisplayName(frameworkObject);
|
|
20
21
|
// Ask user for confirmation using inquirer
|
|
@@ -62,20 +63,20 @@ Please let us know what you would like to see added at https://github.com/genera
|
|
|
62
63
|
}
|
|
63
64
|
// Check if gt-next or gt-react is installed
|
|
64
65
|
if (frameworkType === 'next-app' &&
|
|
65
|
-
!isPackageInstalled(
|
|
66
|
+
!isPackageInstalled(Libraries.GT_NEXT, packageJson)) {
|
|
66
67
|
const packageManager = await getPackageManager();
|
|
67
68
|
const spinner = logger.createSpinner('timer');
|
|
68
|
-
spinner.start(`Installing
|
|
69
|
-
await installPackage(
|
|
70
|
-
spinner.stop(chalk.green(
|
|
69
|
+
spinner.start(`Installing ${Libraries.GT_NEXT} with ${packageManager.name}...`);
|
|
70
|
+
await installPackage(Libraries.GT_NEXT, packageManager);
|
|
71
|
+
spinner.stop(chalk.green(`Automatically installed ${Libraries.GT_NEXT}.`));
|
|
71
72
|
}
|
|
72
73
|
else if (['next-pages', 'react', 'redwood', 'vite', 'gatsby'].includes(frameworkType) &&
|
|
73
|
-
!isPackageInstalled(
|
|
74
|
+
!isPackageInstalled(Libraries.GT_REACT, packageJson)) {
|
|
74
75
|
const packageManager = await getPackageManager();
|
|
75
76
|
const spinner = logger.createSpinner('timer');
|
|
76
|
-
spinner.start(`Installing
|
|
77
|
-
await installPackage(
|
|
78
|
-
spinner.stop(chalk.green(
|
|
77
|
+
spinner.start(`Installing ${Libraries.GT_REACT} with ${packageManager.name}...`);
|
|
78
|
+
await installPackage(Libraries.GT_REACT, packageManager);
|
|
79
|
+
spinner.stop(chalk.green(`Automatically installed ${Libraries.GT_REACT}.`));
|
|
79
80
|
}
|
|
80
81
|
const errors = [];
|
|
81
82
|
const warnings = [];
|
|
@@ -105,7 +106,7 @@ Please let us know what you would like to see added at https://github.com/genera
|
|
|
105
106
|
const spinner = logger.createSpinner();
|
|
106
107
|
spinner.start('Wrapping JSX content with <T> tags...');
|
|
107
108
|
// Wrap all JSX elements in the src directory with a <T> tag, with unique ids
|
|
108
|
-
const { filesUpdated: filesUpdatedNext } = await wrapContentNext(mergeOptions,
|
|
109
|
+
const { filesUpdated: filesUpdatedNext } = await wrapContentNext(mergeOptions, Libraries.GT_NEXT, errors, warnings);
|
|
109
110
|
filesUpdated = [...filesUpdated, ...filesUpdatedNext];
|
|
110
111
|
spinner.stop(chalk.green(`Success! Updated ${chalk.bold.cyan(filesUpdated.length)} files:\n`) + filesUpdated.map((file) => `${chalk.green('-')} ${file}`).join('\n'));
|
|
111
112
|
// Add the withGTConfig() function to the next.config.js file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Updates, TranslateFlags } from '../types/index.js';
|
|
2
2
|
import type { ParsingConfigOptions } from '../types/parsing.js';
|
|
3
|
+
import { InlineLibrary } from '../types/libraries.js';
|
|
3
4
|
/**
|
|
4
5
|
* Searches for gt-react or gt-next dictionary files and creates updates for them,
|
|
5
6
|
* as well as inline updates for <T> tags and useGT()/getGT() calls
|
|
@@ -9,7 +10,7 @@ import type { ParsingConfigOptions } from '../types/parsing.js';
|
|
|
9
10
|
* @param pkg - The package name
|
|
10
11
|
* @returns An object containing the updates and errors
|
|
11
12
|
*/
|
|
12
|
-
export declare function createUpdates(options: TranslateFlags, src: string[] | undefined, sourceDictionary: string | undefined, pkg:
|
|
13
|
+
export declare function createUpdates(options: TranslateFlags, src: string[] | undefined, sourceDictionary: string | undefined, pkg: InlineLibrary, validate: boolean, parsingOptions: ParsingConfigOptions): Promise<{
|
|
13
14
|
updates: Updates;
|
|
14
15
|
errors: string[];
|
|
15
16
|
warnings: string[];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Settings, TranslateFlags, Updates } from '../types/index.js';
|
|
2
|
-
|
|
2
|
+
import { InlineLibrary } from '../types/libraries.js';
|
|
3
|
+
export declare function aggregateInlineTranslations(options: TranslateFlags, settings: Settings, library: InlineLibrary): Promise<Updates>;
|
|
@@ -3,7 +3,7 @@ import chalk from 'chalk';
|
|
|
3
3
|
import findFilepath from '../fs/findFilepath.js';
|
|
4
4
|
import { logger } from '../console/logger.js';
|
|
5
5
|
import { createUpdates } from './parse.js';
|
|
6
|
-
export async function
|
|
6
|
+
export async function aggregateInlineTranslations(options, settings, library) {
|
|
7
7
|
if (!options.dictionary) {
|
|
8
8
|
options.dictionary = findFilepath([
|
|
9
9
|
'./dictionary.js',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Options, Settings } from '../types/index.js';
|
|
1
|
+
import { Framework, Options, Settings } from '../types/index.js';
|
|
2
|
+
import { InlineLibrary } from '../types/libraries.js';
|
|
2
3
|
export type ValidationLevel = 'error' | 'warning';
|
|
3
4
|
export type ValidationMessage = {
|
|
4
5
|
level: ValidationLevel;
|
|
@@ -9,5 +10,5 @@ export type ValidationResult = Record<string, ValidationMessage[]>;
|
|
|
9
10
|
* Programmatic API for validation - returns structured results instead of logging/exiting.
|
|
10
11
|
* Equivalent to running `gtx-cli validate` but returns data.
|
|
11
12
|
*/
|
|
12
|
-
export declare function getValidateJson(settings: Options & Settings, pkg:
|
|
13
|
-
export declare function validateProject(settings: Options & Settings, pkg:
|
|
13
|
+
export declare function getValidateJson(settings: Options & Settings, pkg: Framework, files?: string[]): Promise<ValidationResult>;
|
|
14
|
+
export declare function validateProject(settings: Options & Settings, pkg: InlineLibrary, files?: string[]): Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomMapping } from 'generaltranslation/types';
|
|
2
2
|
import { SUPPORTED_FILE_EXTENSIONS } from '../formats/files/supportedFiles.js';
|
|
3
3
|
import { ParsingConfigOptions } from './parsing.js';
|
|
4
|
+
import { Libraries, InlineLibrary } from './libraries.js';
|
|
4
5
|
export type { Updates } from 'generaltranslation/types';
|
|
5
6
|
export type Options = {
|
|
6
7
|
config: string;
|
|
@@ -95,7 +96,7 @@ export type GenerateSourceOptions = {
|
|
|
95
96
|
ignoreErrors: boolean;
|
|
96
97
|
suppressWarnings: boolean;
|
|
97
98
|
};
|
|
98
|
-
export type Framework =
|
|
99
|
+
export type Framework = typeof Libraries.GT_NEXT | typeof Libraries.GT_REACT | typeof Libraries.GT_REACT_NATIVE;
|
|
99
100
|
export type FrameworkObject = {
|
|
100
101
|
name: 'mintlify';
|
|
101
102
|
type?: undefined;
|
|
@@ -111,7 +112,7 @@ export type SupportedFrameworks = FrameworkObject['name'];
|
|
|
111
112
|
export type SupportedReactFrameworks = Extract<FrameworkObject, {
|
|
112
113
|
type: 'react';
|
|
113
114
|
}>['name'];
|
|
114
|
-
export type SupportedLibraries =
|
|
115
|
+
export type SupportedLibraries = InlineLibrary | 'next-intl' | 'react-i18next' | 'next-i18next' | 'i18next' | 'i18next-icu' | 'base';
|
|
115
116
|
export interface ContentScanner {
|
|
116
117
|
scanForContent(options: WrapOptions, framework: Framework): Promise<{
|
|
117
118
|
errors: string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of all the libraries names supported by the CLI
|
|
3
|
+
*/
|
|
4
|
+
export declare enum Libraries {
|
|
5
|
+
GT_REACT = "gt-react",
|
|
6
|
+
GT_NEXT = "gt-next",
|
|
7
|
+
GT_REACT_NATIVE = "gt-react-native",
|
|
8
|
+
GT_NODE = "gt-node",
|
|
9
|
+
GT_I18N = "gt-i18n",
|
|
10
|
+
GT_REACT_CORE = "@generaltranslation/react-core"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A list of all the libraries that support the CLI
|
|
14
|
+
*/
|
|
15
|
+
export declare const GT_LIBRARIES: readonly [Libraries.GT_REACT, Libraries.GT_NEXT, Libraries.GT_REACT_NATIVE, Libraries.GT_NODE, Libraries.GT_I18N, Libraries.GT_REACT_CORE];
|
|
16
|
+
export type GTLibrary = (typeof GT_LIBRARIES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* Libraries that support inline translation
|
|
19
|
+
*/
|
|
20
|
+
export declare const INLINE_LIBRARIES: readonly [Libraries.GT_REACT, Libraries.GT_NEXT, Libraries.GT_NODE, Libraries.GT_REACT_NATIVE, Libraries.GT_REACT_CORE, Libraries.GT_I18N];
|
|
21
|
+
export type InlineLibrary = (typeof INLINE_LIBRARIES)[number];
|
|
22
|
+
export declare function isInlineLibrary(lib: string): lib is InlineLibrary;
|
|
23
|
+
/**
|
|
24
|
+
* Libraries that support react primitives
|
|
25
|
+
*/
|
|
26
|
+
export declare const REACT_LIBRARIES: readonly [Libraries.GT_NEXT, Libraries.GT_REACT, Libraries.GT_REACT_NATIVE, Libraries.GT_REACT_CORE];
|
|
27
|
+
export type ReactLibrary = (typeof REACT_LIBRARIES)[number];
|
|
28
|
+
/**
|
|
29
|
+
* A mapping of each library to their upstream dependencies for filtering imports
|
|
30
|
+
*/
|
|
31
|
+
export declare const GT_LIBRARIES_UPSTREAM: Record<GTLibrary, GTLibrary[]>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of all the libraries names supported by the CLI
|
|
3
|
+
*/
|
|
4
|
+
export var Libraries;
|
|
5
|
+
(function (Libraries) {
|
|
6
|
+
Libraries["GT_REACT"] = "gt-react";
|
|
7
|
+
Libraries["GT_NEXT"] = "gt-next";
|
|
8
|
+
Libraries["GT_REACT_NATIVE"] = "gt-react-native";
|
|
9
|
+
Libraries["GT_NODE"] = "gt-node";
|
|
10
|
+
Libraries["GT_I18N"] = "gt-i18n";
|
|
11
|
+
Libraries["GT_REACT_CORE"] = "@generaltranslation/react-core";
|
|
12
|
+
})(Libraries || (Libraries = {}));
|
|
13
|
+
/**
|
|
14
|
+
* A list of all the libraries that support the CLI
|
|
15
|
+
*/
|
|
16
|
+
export const GT_LIBRARIES = [
|
|
17
|
+
Libraries.GT_REACT,
|
|
18
|
+
Libraries.GT_NEXT,
|
|
19
|
+
Libraries.GT_REACT_NATIVE,
|
|
20
|
+
Libraries.GT_NODE,
|
|
21
|
+
Libraries.GT_I18N,
|
|
22
|
+
Libraries.GT_REACT_CORE,
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Libraries that support inline translation
|
|
26
|
+
*/
|
|
27
|
+
export const INLINE_LIBRARIES = [
|
|
28
|
+
Libraries.GT_REACT,
|
|
29
|
+
Libraries.GT_NEXT,
|
|
30
|
+
Libraries.GT_NODE,
|
|
31
|
+
Libraries.GT_REACT_NATIVE,
|
|
32
|
+
Libraries.GT_REACT_CORE,
|
|
33
|
+
Libraries.GT_I18N,
|
|
34
|
+
];
|
|
35
|
+
export function isInlineLibrary(lib) {
|
|
36
|
+
return INLINE_LIBRARIES.includes(lib);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Libraries that support react primitives
|
|
40
|
+
*/
|
|
41
|
+
export const REACT_LIBRARIES = [
|
|
42
|
+
Libraries.GT_NEXT,
|
|
43
|
+
Libraries.GT_REACT,
|
|
44
|
+
Libraries.GT_REACT_NATIVE,
|
|
45
|
+
Libraries.GT_REACT_CORE,
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* A mapping of each library to their upstream dependencies for filtering imports
|
|
49
|
+
*/
|
|
50
|
+
export const GT_LIBRARIES_UPSTREAM = {
|
|
51
|
+
[Libraries.GT_NEXT]: [
|
|
52
|
+
Libraries.GT_I18N,
|
|
53
|
+
Libraries.GT_REACT_CORE,
|
|
54
|
+
Libraries.GT_REACT,
|
|
55
|
+
Libraries.GT_NEXT,
|
|
56
|
+
],
|
|
57
|
+
[Libraries.GT_REACT]: [
|
|
58
|
+
Libraries.GT_I18N,
|
|
59
|
+
Libraries.GT_REACT_CORE,
|
|
60
|
+
Libraries.GT_REACT,
|
|
61
|
+
Libraries.GT_REACT_NATIVE, // allow for cross-library compatibility (gt-react/gt-react-native only)
|
|
62
|
+
],
|
|
63
|
+
[Libraries.GT_REACT_NATIVE]: [
|
|
64
|
+
Libraries.GT_I18N,
|
|
65
|
+
Libraries.GT_REACT_CORE,
|
|
66
|
+
Libraries.GT_REACT_NATIVE,
|
|
67
|
+
Libraries.GT_REACT, // allow for cross-library compatibility (gt-react/gt-react-native only)
|
|
68
|
+
],
|
|
69
|
+
[Libraries.GT_NODE]: [Libraries.GT_I18N, Libraries.GT_NODE],
|
|
70
|
+
[Libraries.GT_REACT_CORE]: [Libraries.GT_I18N, Libraries.GT_REACT_CORE],
|
|
71
|
+
[Libraries.GT_I18N]: [Libraries.GT_I18N],
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.19",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -134,10 +134,10 @@
|
|
|
134
134
|
"typescript": "^5.5.4"
|
|
135
135
|
},
|
|
136
136
|
"scripts": {
|
|
137
|
-
"build": "node scripts/generate-version.js && tsc",
|
|
137
|
+
"build": "node scripts/generate-version.js && tsc && rm -rf dist/setup/instructions && cp -r src/setup/instructions dist/setup/instructions",
|
|
138
138
|
"build:clean": "sh ../../scripts/clean.sh && pnpm bin:restore && rm -rf binaries && pnpm run build",
|
|
139
139
|
"build:release": "pnpm run build:clean",
|
|
140
|
-
"build:bin": "node scripts/generate-version.js && tsc && sh scripts/build-exe.sh all",
|
|
140
|
+
"build:bin": "node scripts/generate-version.js && tsc && rm -rf dist/setup/instructions && cp -r src/setup/instructions dist/setup/instructions && sh scripts/build-exe.sh all",
|
|
141
141
|
"build:bin:clean": "sh ../../scripts/clean.sh && rm -rf binaries && pnpm run build:bin",
|
|
142
142
|
"build:bin:release": "pnpm run build:bin:clean && pnpm run build:bin",
|
|
143
143
|
"build:bin:darwin-x64": "sh scripts/build-exe.sh darwin-x64",
|