@intlayer/cli 5.4.2 → 5.5.0
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/dist/cjs/build.cjs +1 -1
- package/dist/cjs/build.cjs.map +1 -1
- package/dist/cjs/cli.cjs +242 -20
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +3 -6
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/fill.cjs +362 -0
- package/dist/cjs/fill.cjs.map +1 -0
- package/dist/cjs/index.cjs +6 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listContentDeclaration.cjs +5 -7
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/pull.cjs +11 -23
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push.cjs +29 -59
- package/dist/cjs/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +5 -4
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/esm/build.mjs +1 -1
- package/dist/esm/build.mjs.map +1 -1
- package/dist/esm/cli.mjs +230 -19
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +5 -8
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/fill.mjs +340 -0
- package/dist/esm/fill.mjs.map +1 -0
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listContentDeclaration.mjs +7 -9
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/pull.mjs +14 -26
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push.mjs +31 -61
- package/dist/esm/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +7 -6
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/types/build.d.ts +2 -1
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/cli.d.ts +10 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fill.d.ts +27 -0
- package/dist/types/fill.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listContentDeclaration.d.ts +4 -3
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/pull.d.ts +2 -2
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push.d.ts +4 -2
- package/dist/types/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +2 -1
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/package.json +13 -12
- package/dist/cjs/audit.cjs +0 -126
- package/dist/cjs/audit.cjs.map +0 -1
- package/dist/esm/audit.mjs +0 -94
- package/dist/esm/audit.mjs.map +0 -1
- package/dist/types/audit.d.ts +0 -38
- package/dist/types/audit.d.ts.map +0 -1
package/dist/esm/push.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import * as fsPromises from "fs/promises";
|
|
2
|
-
import { relative } from "path";
|
|
3
|
-
import * as readline from "readline";
|
|
4
1
|
import { getIntlayerAPI } from "@intlayer/api";
|
|
2
|
+
import { listGitFiles } from "@intlayer/chokidar";
|
|
5
3
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
getAppLogger,
|
|
5
|
+
getConfiguration
|
|
8
6
|
} from "@intlayer/config";
|
|
9
7
|
import dictionariesRecord from "@intlayer/dictionaries-entry";
|
|
8
|
+
import * as fsPromises from "fs/promises";
|
|
10
9
|
import pLimit from "p-limit";
|
|
10
|
+
import { relative } from "path";
|
|
11
|
+
import * as readline from "readline";
|
|
11
12
|
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
12
13
|
const RESET = "\x1B[0m";
|
|
13
14
|
const GREEN = "\x1B[32m";
|
|
@@ -16,9 +17,10 @@ const BLUE = "\x1B[34m";
|
|
|
16
17
|
const GREY = "\x1B[90m";
|
|
17
18
|
const GREY_DARK = "\x1B[90m";
|
|
18
19
|
const push = async (options) => {
|
|
20
|
+
const config = getConfiguration(options?.configOptions);
|
|
21
|
+
const appLogger = getAppLogger(config);
|
|
22
|
+
const { clientId, clientSecret } = config.editor;
|
|
19
23
|
try {
|
|
20
|
-
const config = getConfiguration(options);
|
|
21
|
-
const { clientId, clientSecret } = config.editor;
|
|
22
24
|
if (!clientId || !clientSecret) {
|
|
23
25
|
throw new Error(
|
|
24
26
|
"Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
|
|
@@ -34,15 +36,12 @@ const push = async (options) => {
|
|
|
34
36
|
(dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)
|
|
35
37
|
);
|
|
36
38
|
if (noneExistingDictionariesOption.length > 0) {
|
|
37
|
-
|
|
39
|
+
appLogger(
|
|
38
40
|
`The following dictionaries do not exist: ${noneExistingDictionariesOption.join(
|
|
39
41
|
", "
|
|
40
42
|
)} and have been ignored.`,
|
|
41
43
|
{
|
|
42
|
-
level: "error"
|
|
43
|
-
config: {
|
|
44
|
-
prefix: options?.logPrefix
|
|
45
|
-
}
|
|
44
|
+
level: "error"
|
|
46
45
|
}
|
|
47
46
|
);
|
|
48
47
|
}
|
|
@@ -50,20 +49,16 @@ const push = async (options) => {
|
|
|
50
49
|
(dictionary) => options.dictionaries.includes(dictionary.key)
|
|
51
50
|
);
|
|
52
51
|
}
|
|
52
|
+
if (options?.gitOptions) {
|
|
53
|
+
const gitFiles = await listGitFiles(options.gitOptions);
|
|
54
|
+
}
|
|
53
55
|
if (dictionaries.length === 0) {
|
|
54
|
-
|
|
55
|
-
level: "error"
|
|
56
|
-
config: {
|
|
57
|
-
prefix: options?.logPrefix
|
|
58
|
-
}
|
|
56
|
+
appLogger("No local dictionaries found", {
|
|
57
|
+
level: "error"
|
|
59
58
|
});
|
|
60
59
|
return;
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
config: {
|
|
64
|
-
prefix: options?.logPrefix
|
|
65
|
-
}
|
|
66
|
-
});
|
|
61
|
+
appLogger("Pushing dictionaries:", {});
|
|
67
62
|
const dictionariesStatuses = dictionaries.map(
|
|
68
63
|
(dictionary, index) => ({
|
|
69
64
|
dictionary,
|
|
@@ -117,11 +112,8 @@ const push = async (options) => {
|
|
|
117
112
|
updateAllStatusLines(dictionariesStatuses);
|
|
118
113
|
for (const statusObj of dictionariesStatuses) {
|
|
119
114
|
if (statusObj.errorMessage) {
|
|
120
|
-
|
|
121
|
-
level: "error"
|
|
122
|
-
config: {
|
|
123
|
-
prefix: options?.logPrefix
|
|
124
|
-
}
|
|
115
|
+
appLogger(statusObj.errorMessage, {
|
|
116
|
+
level: "error"
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
119
|
}
|
|
@@ -144,11 +136,8 @@ const push = async (options) => {
|
|
|
144
136
|
}
|
|
145
137
|
}
|
|
146
138
|
} catch (error) {
|
|
147
|
-
|
|
148
|
-
level: "error"
|
|
149
|
-
config: {
|
|
150
|
-
prefix: options?.logPrefix
|
|
151
|
-
}
|
|
139
|
+
appLogger(error, {
|
|
140
|
+
level: "error"
|
|
152
141
|
});
|
|
153
142
|
}
|
|
154
143
|
};
|
|
@@ -165,16 +154,15 @@ const askUser = (question) => {
|
|
|
165
154
|
});
|
|
166
155
|
};
|
|
167
156
|
const deleteLocalDictionaries = async (dictionariesToDelete, options) => {
|
|
168
|
-
const
|
|
157
|
+
const config = getConfiguration(options?.configOptions);
|
|
158
|
+
const appLogger = getAppLogger(config);
|
|
159
|
+
const { baseDir } = config.content;
|
|
169
160
|
const filePathsSet = /* @__PURE__ */ new Set();
|
|
170
161
|
for (const dictionary of dictionariesToDelete) {
|
|
171
162
|
const { filePath } = dictionary;
|
|
172
163
|
if (!filePath) {
|
|
173
|
-
|
|
174
|
-
level: "error"
|
|
175
|
-
config: {
|
|
176
|
-
prefix: options?.logPrefix
|
|
177
|
-
}
|
|
164
|
+
appLogger(`Dictionary ${dictionary.key} does not have a file path`, {
|
|
165
|
+
level: "error"
|
|
178
166
|
});
|
|
179
167
|
continue;
|
|
180
168
|
}
|
|
@@ -186,30 +174,15 @@ const deleteLocalDictionaries = async (dictionariesToDelete, options) => {
|
|
|
186
174
|
const stats = await fsPromises.lstat(filePath);
|
|
187
175
|
if (stats.isFile()) {
|
|
188
176
|
await fsPromises.unlink(filePath);
|
|
189
|
-
|
|
190
|
-
config: {
|
|
191
|
-
prefix: options?.logPrefix
|
|
192
|
-
}
|
|
193
|
-
});
|
|
177
|
+
appLogger(`Deleted file ${relativePath}`, {});
|
|
194
178
|
} else if (stats.isDirectory()) {
|
|
195
|
-
|
|
196
|
-
config: {
|
|
197
|
-
prefix: options?.logPrefix
|
|
198
|
-
}
|
|
199
|
-
});
|
|
179
|
+
appLogger(`Path is a directory ${relativePath}, skipping.`, {});
|
|
200
180
|
} else {
|
|
201
|
-
|
|
202
|
-
config: {
|
|
203
|
-
prefix: options?.logPrefix
|
|
204
|
-
}
|
|
205
|
-
});
|
|
181
|
+
appLogger(`Unknown file type for ${relativePath}, skipping.`, {});
|
|
206
182
|
}
|
|
207
183
|
} catch (err) {
|
|
208
|
-
|
|
209
|
-
level: "error"
|
|
210
|
-
config: {
|
|
211
|
-
prefix: options?.logPrefix
|
|
212
|
-
}
|
|
184
|
+
appLogger(`Error deleting ${relativePath}: ${err}`, {
|
|
185
|
+
level: "error"
|
|
213
186
|
});
|
|
214
187
|
}
|
|
215
188
|
}
|
|
@@ -226,9 +199,6 @@ const getStatusIcon = (status) => {
|
|
|
226
199
|
return statusIcons[status] || "";
|
|
227
200
|
};
|
|
228
201
|
const getStatusLine = (statusObj) => {
|
|
229
|
-
const {
|
|
230
|
-
log: { prefix }
|
|
231
|
-
} = getConfiguration();
|
|
232
202
|
let icon = getStatusIcon(statusObj.status);
|
|
233
203
|
let colorStart = "";
|
|
234
204
|
let colorEnd = "";
|
package/dist/esm/push.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/push.ts"],"sourcesContent":["import * as fsPromises from 'fs/promises';\nimport { relative } from 'path';\nimport * as readline from 'readline';\nimport { getIntlayerAPI } from '@intlayer/api';\nimport {\n getConfiguration,\n GetConfigurationOptions,\n logger,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/dictionaries-entry';\nimport pLimit from 'p-limit';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n logPrefix?: string;\n} & GetConfigurationOptions;\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n icon: string;\n index: number;\n error?: Error;\n errorMessage?: string;\n spinnerFrameIndex?: number;\n};\n\nconst spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst RESET = '\\x1b[0m';\nconst GREEN = '\\x1b[32m';\nconst RED = '\\x1b[31m';\nconst BLUE = '\\x1b[34m';\nconst GREY = '\\x1b[90m';\nconst GREY_DARK = '\\x1b[90m';\n\n/**\n * Get all locale dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n try {\n const config = getConfiguration(options);\n const { clientId, clientSecret } = config.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, config);\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n let dictionaries: Dictionary[] = Object.values(dictionariesRecord);\n const existingDictionariesKeys: string[] = Object.keys(dictionariesRecord);\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n logger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries!.includes(dictionary.key)\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n logger('No local dictionaries found', {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n });\n return;\n }\n\n logger('Pushing dictionaries:', {\n config: {\n prefix: options?.logPrefix,\n },\n });\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary, index) => ({\n dictionary,\n icon: getStatusIcon('pending'),\n status: 'pending',\n index,\n spinnerFrameIndex: 0,\n })\n );\n\n // Output initial statuses\n for (const statusObj of dictionariesStatuses) {\n process.stdout.write(getStatusLine(statusObj) + '\\n');\n }\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n // Start spinner timer\n const spinnerTimer = setInterval(() => {\n updateAllStatusLines(dictionariesStatuses);\n }, 100); // Update every 100ms\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries(\n [statusObj.dictionary],\n {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }\n );\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries || [];\n const newDictionaries = pushResult.data?.newDictionaries || [];\n\n if (updatedDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n } else if (newDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n const pushPromises = dictionariesStatuses.map((statusObj) =>\n limit(() => processDictionary(statusObj))\n );\n await Promise.all(pushPromises);\n\n // Stop the spinner timer\n clearInterval(spinnerTimer);\n\n // Update statuses one last time\n updateAllStatusLines(dictionariesStatuses);\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n logger(statusObj.errorMessage, {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const answer = await askUser(\n 'Do you want to delete the local dictionaries that were successfully pushed? (yes/no): '\n );\n if (answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y') {\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n }\n }\n } catch (error) {\n logger(error, {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n });\n }\n};\n\nconst askUser = (question: string): Promise<string> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return new Promise((resolve) => {\n rl.question(question, (answer: string) => {\n rl.close();\n resolve(answer);\n });\n });\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const { baseDir } = getConfiguration().content;\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n logger(`Dictionary ${dictionary.key} does not have a file path`, {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n });\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n const relativePath = relative(baseDir, filePath);\n\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n logger(`Deleted file ${relativePath}`, {\n config: {\n prefix: options?.logPrefix,\n },\n });\n } else if (stats.isDirectory()) {\n logger(`Path is a directory ${relativePath}, skipping.`, {\n config: {\n prefix: options?.logPrefix,\n },\n });\n } else {\n logger(`Unknown file type for ${relativePath}, skipping.`, {\n config: {\n prefix: options?.logPrefix,\n },\n });\n }\n } catch (err) {\n logger(`Error deleting ${relativePath}: ${err}`, {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n });\n }\n }\n};\n\nconst getStatusIcon = (status: string): string => {\n const statusIcons: Record<string, string> = {\n pending: '⏲',\n pushing: '', // Spinner handled separately\n modified: '✔',\n pushed: '✔',\n error: '✖',\n };\n return statusIcons[status] || '';\n};\n\nconst getStatusLine = (statusObj: DictionariesStatus): string => {\n const {\n log: { prefix },\n } = getConfiguration();\n\n let icon = getStatusIcon(statusObj.status);\n let colorStart = '';\n let colorEnd = '';\n\n if (statusObj.status === 'pushing') {\n // Use spinner frame\n icon = spinnerFrames[statusObj.spinnerFrameIndex! % spinnerFrames.length];\n colorStart = BLUE;\n colorEnd = RESET;\n } else if (statusObj.status === 'error') {\n colorStart = RED;\n colorEnd = RESET;\n } else if (statusObj.status === 'pushed' || statusObj.status === 'modified') {\n colorStart = GREEN;\n colorEnd = RESET;\n } else {\n colorStart = GREY;\n colorEnd = RESET;\n }\n\n return `- ${statusObj.dictionary.key} ${GREY_DARK}[${colorStart}${icon}${statusObj.status}${GREY_DARK}]${colorEnd}`;\n};\n\nconst updateAllStatusLines = (dictionariesStatuses: DictionariesStatus[]) => {\n // Move cursor up to the first status line\n readline.moveCursor(process.stdout, 0, -dictionariesStatuses.length);\n for (const statusObj of dictionariesStatuses) {\n // Clear the line\n readline.clearLine(process.stdout, 0);\n\n if (statusObj.status === 'pushing') {\n // Update spinner frame\n statusObj.spinnerFrameIndex =\n (statusObj.spinnerFrameIndex! + 1) % spinnerFrames.length;\n }\n\n // Write the status line\n process.stdout.write(getStatusLine(statusObj) + '\\n');\n }\n};\n"],"mappings":"AAAA,YAAY,gBAAgB;AAC5B,SAAS,gBAAgB;AACzB,YAAY,cAAc;AAC1B,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAEP,OAAO,wBAAwB;AAC/B,OAAO,YAAY;AAmBnB,MAAM,gBAAgB,CAAC,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,QAAG;AAEvE,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,YAAY;AAKX,MAAM,OAAO,OAAO,YAAyC;AAClE,MAAI;AACF,UAAM,SAAS,iBAAiB,OAAO;AACvC,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAE1C,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,cAAc,eAAe,QAAW,MAAM;AACpD,UAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,QAAI,eAA6B,OAAO,OAAO,kBAAkB;AACjE,UAAM,2BAAqC,OAAO,KAAK,kBAAkB;AAEzE,QAAI,SAAS,cAAc;AAEzB,YAAM,iCAAiC,QAAQ,aAAa;AAAA,QAC1D,CAAC,iBAAiB,CAAC,yBAAyB,SAAS,YAAY;AAAA,MACnE;AAEA,UAAI,+BAA+B,SAAS,GAAG;AAC7C;AAAA,UACE,4CAA4C,+BAA+B;A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,cAAc;AAAA,IACvD;AAGA,YAAQ,OAAO,MAAM,cAAc,SAAS,IAAI,IAAI;AAAA,EACtD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/push.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { listGitFiles, ListGitFilesOptions } from '@intlayer/chokidar';\nimport {\n getAppLogger,\n getConfiguration,\n GetConfigurationOptions,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/dictionaries-entry';\nimport * as fsPromises from 'fs/promises';\nimport pLimit from 'p-limit';\nimport { relative } from 'path';\nimport * as readline from 'readline';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n icon: string;\n index: number;\n error?: Error;\n errorMessage?: string;\n spinnerFrameIndex?: number;\n};\n\nconst spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nconst RESET = '\\x1b[0m';\nconst GREEN = '\\x1b[32m';\nconst RED = '\\x1b[31m';\nconst BLUE = '\\x1b[34m';\nconst GREY = '\\x1b[90m';\nconst GREY_DARK = '\\x1b[90m';\n\n/**\n * Get all locale dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n const { clientId, clientSecret } = config.editor;\n try {\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, config);\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n let dictionaries: Dictionary[] = Object.values(dictionariesRecord);\n const existingDictionariesKeys: string[] = Object.keys(dictionariesRecord);\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries!.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:', {});\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary, index) => ({\n dictionary,\n icon: getStatusIcon('pending'),\n status: 'pending',\n index,\n spinnerFrameIndex: 0,\n })\n );\n\n // Output initial statuses\n for (const statusObj of dictionariesStatuses) {\n process.stdout.write(getStatusLine(statusObj) + '\\n');\n }\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n // Start spinner timer\n const spinnerTimer = setInterval(() => {\n updateAllStatusLines(dictionariesStatuses);\n }, 100); // Update every 100ms\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries(\n [statusObj.dictionary],\n {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }\n );\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries || [];\n const newDictionaries = pushResult.data?.newDictionaries || [];\n\n if (updatedDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n } else if (newDictionaries.includes(statusObj.dictionary.key)) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n const pushPromises = dictionariesStatuses.map((statusObj) =>\n limit(() => processDictionary(statusObj))\n );\n await Promise.all(pushPromises);\n\n // Stop the spinner timer\n clearInterval(spinnerTimer);\n\n // Update statuses one last time\n updateAllStatusLines(dictionariesStatuses);\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const answer = await askUser(\n 'Do you want to delete the local dictionaries that were successfully pushed? (yes/no): '\n );\n if (answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y') {\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst askUser = (question: string): Promise<string> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return new Promise((resolve) => {\n rl.question(question, (answer: string) => {\n rl.close();\n resolve(answer);\n });\n });\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n const { baseDir } = config.content;\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(`Dictionary ${dictionary.key} does not have a file path`, {\n level: 'error',\n });\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n const relativePath = relative(baseDir, filePath);\n\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${relativePath}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${relativePath}, skipping.`, {});\n } else {\n appLogger(`Unknown file type for ${relativePath}, skipping.`, {});\n }\n } catch (err) {\n appLogger(`Error deleting ${relativePath}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n\nconst getStatusIcon = (status: string): string => {\n const statusIcons: Record<string, string> = {\n pending: '⏲',\n pushing: '', // Spinner handled separately\n modified: '✔',\n pushed: '✔',\n error: '✖',\n };\n return statusIcons[status] || '';\n};\n\nconst getStatusLine = (statusObj: DictionariesStatus): string => {\n let icon = getStatusIcon(statusObj.status);\n let colorStart = '';\n let colorEnd = '';\n\n if (statusObj.status === 'pushing') {\n // Use spinner frame\n icon = spinnerFrames[statusObj.spinnerFrameIndex! % spinnerFrames.length];\n colorStart = BLUE;\n colorEnd = RESET;\n } else if (statusObj.status === 'error') {\n colorStart = RED;\n colorEnd = RESET;\n } else if (statusObj.status === 'pushed' || statusObj.status === 'modified') {\n colorStart = GREEN;\n colorEnd = RESET;\n } else {\n colorStart = GREY;\n colorEnd = RESET;\n }\n\n return `- ${statusObj.dictionary.key} ${GREY_DARK}[${colorStart}${icon}${statusObj.status}${GREY_DARK}]${colorEnd}`;\n};\n\nconst updateAllStatusLines = (dictionariesStatuses: DictionariesStatus[]) => {\n // Move cursor up to the first status line\n readline.moveCursor(process.stdout, 0, -dictionariesStatuses.length);\n for (const statusObj of dictionariesStatuses) {\n // Clear the line\n readline.clearLine(process.stdout, 0);\n\n if (statusObj.status === 'pushing') {\n // Update spinner frame\n statusObj.spinnerFrameIndex =\n (statusObj.spinnerFrameIndex! + 1) % spinnerFrames.length;\n }\n\n // Write the status line\n process.stdout.write(getStatusLine(statusObj) + '\\n');\n }\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,oBAAyC;AAClD;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,OAAO,wBAAwB;AAC/B,YAAY,gBAAgB;AAC5B,OAAO,YAAY;AACnB,SAAS,gBAAgB;AACzB,YAAY,cAAc;AAoB1B,MAAM,gBAAgB,CAAC,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,UAAK,QAAG;AAEvE,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,YAAY;AAKX,MAAM,OAAO,OAAO,YAAyC;AAClE,QAAM,SAAS,iBAAiB,SAAS,aAAa;AACtD,QAAM,YAAY,aAAa,MAAM;AACrC,QAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,MAAI;AACF,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,cAAc,eAAe,QAAW,MAAM;AACpD,UAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,QAAI,eAA6B,OAAO,OAAO,kBAAkB;AACjE,UAAM,2BAAqC,OAAO,KAAK,kBAAkB;AAEzE,QAAI,SAAS,cAAc;AAEzB,YAAM,iCAAiC,QAAQ,aAAa;AAAA,QAC1D,CAAC,iBAAiB,CAAC,yBAAyB,SAAS,YAAY;AAAA,MACnE;AAEA,UAAI,+BAA+B,S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;AAAA,EACT;AACA,SAAO,YAAY,MAAM,KAAK;AAChC;AAEA,MAAM,gBAAgB,CAAC,cAA0C;AAC/D,MAAI,OAAO,cAAc,UAAU,MAAM;AACzC,MAAI,aAAa;AACjB,MAAI,WAAW;AAEf,MAAI,UAAU,WAAW,WAAW;AAElC,WAAO,cAAc,UAAU,oBAAqB,cAAc,MAAM;AACxE,iBAAa;AACb,eAAW;AAAA,EACb,WAAW,UAAU,WAAW,SAAS;AACvC,iBAAa;AACb,eAAW;AAAA,EACb,WAAW,UAAU,WAAW,YAAY,UAAU,WAAW,YAAY;AAC3E,iBAAa;AACb,eAAW;AAAA,EACb,OAAO;AACL,iBAAa;AACb,eAAW;AAAA,EACb;AAEA,SAAO,KAAK,UAAU,WAAW,GAAG,IAAI,SAAS,IAAI,UAAU,GAAG,IAAI,GAAG,UAAU,MAAM,GAAG,SAAS,IAAI,QAAQ;AACnH;AAEA,MAAM,uBAAuB,CAAC,yBAA+C;AAE3E,WAAS,WAAW,QAAQ,QAAQ,GAAG,CAAC,qBAAqB,MAAM;AACnE,aAAW,aAAa,sBAAsB;AAE5C,aAAS,UAAU,QAAQ,QAAQ,CAAC;AAEpC,QAAI,UAAU,WAAW,WAAW;AAElC,gBAAU,qBACP,UAAU,oBAAqB,KAAK,cAAc;AAAA,IACvD;AAGA,YAAQ,OAAO,MAAM,cAAc,SAAS,IAAI,IAAI;AAAA,EACtD;AACF;","names":[]}
|
package/dist/esm/pushConfig.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { getIntlayerAPI } from "@intlayer/api";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
getAppLogger,
|
|
4
|
+
getConfiguration
|
|
5
5
|
} from "@intlayer/config";
|
|
6
6
|
const pushConfig = async (options) => {
|
|
7
|
-
const config = getConfiguration(options);
|
|
7
|
+
const config = getConfiguration(options?.configOptions);
|
|
8
|
+
const appLogger = getAppLogger(config);
|
|
8
9
|
const { clientId, clientSecret } = config.editor;
|
|
9
10
|
if (!clientId || !clientSecret) {
|
|
10
|
-
|
|
11
|
+
appLogger(
|
|
11
12
|
"Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.",
|
|
12
13
|
{
|
|
13
14
|
level: "error",
|
|
@@ -27,12 +28,12 @@ const pushConfig = async (options) => {
|
|
|
27
28
|
if (!getDictionariesKeysResult.data) {
|
|
28
29
|
throw new Error("Error pushing project configuration");
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
appLogger("Project configuration pushed successfully", {
|
|
31
32
|
config: {
|
|
32
33
|
prefix: options?.logPrefix
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
+
appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2), {
|
|
36
37
|
config: {
|
|
37
38
|
prefix: options?.logPrefix
|
|
38
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport {\n getAppLogger,\n getConfiguration,\n type GetConfigurationOptions,\n} from '@intlayer/config';\n\ntype PushOptions = {\n logPrefix?: string;\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const { clientId, clientSecret } = config.editor;\n\n if (!clientId || !clientSecret) {\n appLogger(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.',\n {\n level: 'error',\n config: {\n prefix: options?.logPrefix,\n },\n }\n );\n return;\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config, {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully', {\n config: {\n prefix: options?.logPrefix,\n },\n });\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2), {\n config: {\n prefix: options?.logPrefix,\n },\n });\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAOA,MAAM,aAAa,OAAO,YAA0B;AACzD,QAAM,SAAS,iBAAiB,SAAS,aAAa;AACtD,QAAM,YAAY,aAAa,MAAM;AAErC,QAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAE1C,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B;AAAA,MACE;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,QAAQ;AAAA,UACN,QAAQ,SAAS;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AACA;AAAA,EACF;AAEA,QAAM,cAAc,eAAe,QAAW,MAAM;AAEpD,QAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,QAAQ,yBAAyB,QAAQ;AAAA,IACzD,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,EAC1D,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACvD;AAEA,YAAU,6CAA6C;AAAA,IACrD,QAAQ;AAAA,MACN,QAAQ,SAAS;AAAA,IACnB;AAAA,EACF,CAAC;AAED,YAAU,KAAK,UAAU,0BAA0B,MAAM,MAAM,CAAC,GAAG;AAAA,IACjE,QAAQ;AAAA,MACN,QAAQ,SAAS;AAAA,IACnB;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/dist/types/build.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type GetConfigurationOptions } from '@intlayer/config';
|
|
2
2
|
type BuildOptions = {
|
|
3
3
|
watch?: boolean;
|
|
4
|
-
|
|
4
|
+
configOptions?: GetConfigurationOptions;
|
|
5
|
+
};
|
|
5
6
|
/**
|
|
6
7
|
* Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.
|
|
7
8
|
* Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/build.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,YAAY,GAAG;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/build.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,YAAY,GAAG;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAU,UAAU,YAAY,kBAOjD,CAAC"}
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
type LogOptions = {
|
|
3
|
+
prefix?: string;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type ConfigurationOptions = {
|
|
7
|
+
baseDir?: string;
|
|
8
|
+
env?: string;
|
|
9
|
+
envFile?: string;
|
|
10
|
+
} & LogOptions;
|
|
2
11
|
/**
|
|
3
12
|
* Set the API for the CLI
|
|
4
13
|
*
|
|
@@ -8,4 +17,5 @@ import { Command } from 'commander';
|
|
|
8
17
|
* npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir
|
|
9
18
|
*/
|
|
10
19
|
export declare const setAPI: () => Command;
|
|
20
|
+
export {};
|
|
11
21
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkIpC,KAAK,UAAU,GAAG;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,UAAU,CAAC;AAwBf;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,QAAO,OAiOzB,CAAC"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GetConfigurationOptions } from '@intlayer/config';
|
|
2
2
|
type ConfigOptions = {
|
|
3
|
-
|
|
4
|
-
}
|
|
3
|
+
configOptions?: GetConfigurationOptions;
|
|
4
|
+
};
|
|
5
5
|
export declare const getConfig: (options?: ConfigOptions) => void;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,aAAa,GAAG;IACnB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,UAAU,aAAa,SAKhD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AIOptions } from '@intlayer/api';
|
|
2
|
+
import { ListGitFilesOptions } from '@intlayer/chokidar';
|
|
3
|
+
import { GetConfigurationOptions, Locales } from '@intlayer/config';
|
|
4
|
+
import { type Dictionary } from '@intlayer/core';
|
|
5
|
+
export type FillOptions = {
|
|
6
|
+
sourceLocale: Locales;
|
|
7
|
+
outputLocales?: Locales | Locales[];
|
|
8
|
+
file?: string | string[];
|
|
9
|
+
mode?: 'complete' | 'review';
|
|
10
|
+
keys?: string | string[];
|
|
11
|
+
excludedKeys?: string | string[];
|
|
12
|
+
filter?: (entry: Dictionary) => boolean;
|
|
13
|
+
pathFilter?: string | string[];
|
|
14
|
+
gitOptions?: ListGitFilesOptions;
|
|
15
|
+
configOptions?: GetConfigurationOptions;
|
|
16
|
+
aiOptions?: AIOptions;
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type AutoFillData = {
|
|
20
|
+
localeList: Locales[];
|
|
21
|
+
filePath: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Fill translations based on the provided options.
|
|
25
|
+
*/
|
|
26
|
+
export declare const fill: (options: FillOptions) => Promise<void>;
|
|
27
|
+
//# sourceMappingURL=fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;AACpD,OAAO,EAGL,mBAAmB,EAKpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,uBAAuB,EAEvB,OAAO,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAiFF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAqKF;;GAEG;AACH,eAAO,MAAM,IAAI,GAAU,SAAS,WAAW,KAAG,OAAO,CAAC,IAAI,CAmL7D,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './cli';
|
|
2
1
|
export * from './build';
|
|
2
|
+
export * from './cli';
|
|
3
|
+
export * from './fill';
|
|
4
|
+
export * from './listContentDeclaration';
|
|
3
5
|
export * from './pull';
|
|
4
6
|
export * from './push';
|
|
5
|
-
export * from './listContentDeclaration';
|
|
6
|
-
export * from './audit';
|
|
7
7
|
export * from './pushConfig';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type GetConfigurationOptions } from '@intlayer/config';
|
|
2
2
|
type GetContentDeclarationOptions = {
|
|
3
3
|
exclude?: string[];
|
|
4
|
-
|
|
4
|
+
configOptions?: GetConfigurationOptions;
|
|
5
|
+
};
|
|
5
6
|
export declare const getContentDeclaration: (options?: GetContentDeclarationOptions) => string[];
|
|
6
7
|
type ListContentDeclarationOptions = {
|
|
7
|
-
|
|
8
|
+
configOptions?: GetConfigurationOptions;
|
|
8
9
|
};
|
|
9
|
-
export declare const listContentDeclaration: (options
|
|
10
|
+
export declare const listContentDeclaration: (options?: ListContentDeclarationOptions) => void;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=listContentDeclaration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listContentDeclaration.d.ts","sourceRoot":"","sources":["../../src/listContentDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"listContentDeclaration.d.ts","sourceRoot":"","sources":["../../src/listContentDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAG1B,KAAK,4BAA4B,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,4BAA4B,KACrC,MAAM,EAaR,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,UAAU,6BAA6B,SAQxC,CAAC"}
|
package/dist/types/pull.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { GetConfigurationOptions } from '@intlayer/config';
|
|
|
2
2
|
type PullOptions = {
|
|
3
3
|
dictionaries?: string[];
|
|
4
4
|
newDictionariesPath?: string;
|
|
5
|
-
|
|
6
|
-
}
|
|
5
|
+
configOptions?: GetConfigurationOptions;
|
|
6
|
+
};
|
|
7
7
|
/**
|
|
8
8
|
* Fetch distant dictionaries and write them locally,
|
|
9
9
|
* with progress indicators and concurrency control.
|
package/dist/types/pull.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/pull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/pull.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAM1B,KAAK,WAAW,GAAG;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAsBF;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAU,UAAU,WAAW,KAAG,OAAO,CAAC,IAAI,CAyI9D,CAAC"}
|
package/dist/types/push.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ListGitFilesOptions } from '@intlayer/chokidar';
|
|
1
2
|
import { GetConfigurationOptions } from '@intlayer/config';
|
|
2
3
|
type PushOptions = {
|
|
3
4
|
deleteLocaleDictionary?: boolean;
|
|
4
5
|
keepLocaleDictionary?: boolean;
|
|
5
6
|
dictionaries?: string[];
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
gitOptions?: ListGitFilesOptions;
|
|
8
|
+
configOptions?: GetConfigurationOptions;
|
|
9
|
+
};
|
|
8
10
|
/**
|
|
9
11
|
* Get all locale dictionaries and push them simultaneously.
|
|
10
12
|
*/
|
package/dist/types/push.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/push.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/push.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAGL,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAQ1B,KAAK,WAAW,GAAG;IACjB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAqBF;;GAEG;AACH,eAAO,MAAM,IAAI,GAAU,UAAU,WAAW,KAAG,OAAO,CAAC,IAAI,CAoK9D,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type GetConfigurationOptions } from '@intlayer/config';
|
|
2
2
|
type PushOptions = {
|
|
3
3
|
logPrefix?: string;
|
|
4
|
-
|
|
4
|
+
configOptions?: GetConfigurationOptions;
|
|
5
|
+
};
|
|
5
6
|
export declare const pushConfig: (options?: PushOptions) => Promise<void>;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=pushConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pushConfig.d.ts","sourceRoot":"","sources":["../../src/pushConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pushConfig.d.ts","sourceRoot":"","sources":["../../src/pushConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,UAAU,WAAW,kBA8CrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
|
|
6
6
|
"keywords": [
|
|
@@ -52,10 +52,11 @@
|
|
|
52
52
|
"commander": "^13.0.0",
|
|
53
53
|
"fast-glob": "^3.3.3",
|
|
54
54
|
"p-limit": "^3.1.0",
|
|
55
|
-
"@intlayer/api": "5.
|
|
56
|
-
"@intlayer/
|
|
57
|
-
"@intlayer/
|
|
58
|
-
"@intlayer/
|
|
55
|
+
"@intlayer/api": "5.5.0",
|
|
56
|
+
"@intlayer/chokidar": "5.5.0",
|
|
57
|
+
"@intlayer/dictionaries-entry": "5.5.0",
|
|
58
|
+
"@intlayer/unmerged-dictionaries-entry": "5.5.0",
|
|
59
|
+
"@intlayer/config": "5.5.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@types/node": "^22.13.10",
|
|
@@ -67,17 +68,17 @@
|
|
|
67
68
|
"tsc-alias": "^1.8.11",
|
|
68
69
|
"tsup": "^8.4.0",
|
|
69
70
|
"typescript": "^5.8.2",
|
|
70
|
-
"@intlayer/core": "5.
|
|
71
|
+
"@intlayer/core": "5.5.0",
|
|
71
72
|
"@utils/eslint-config": "1.0.4",
|
|
72
73
|
"@utils/ts-config": "1.0.4",
|
|
73
|
-
"@utils/
|
|
74
|
-
"@utils/
|
|
74
|
+
"@utils/ts-config-types": "1.0.4",
|
|
75
|
+
"@utils/tsup-config": "1.0.4"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/
|
|
80
|
-
"@intlayer/dictionaries-entry": "5.
|
|
78
|
+
"@intlayer/chokidar": "5.5.0",
|
|
79
|
+
"@intlayer/config": "5.5.0",
|
|
80
|
+
"@intlayer/api": "5.5.0",
|
|
81
|
+
"@intlayer/dictionaries-entry": "5.5.0"
|
|
81
82
|
},
|
|
82
83
|
"bug": {
|
|
83
84
|
"url": "https://github.com/aymericzip/intlayer/issues"
|