@localheroai/cli 0.0.69 → 0.0.71-rc.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/dist/cli.js +8 -8
- package/dist/commands/ci.js +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/utils/github.js +13 -6
- package/dist/utils/github.js.map +1 -1
- package/dist/utils/translation-utils.js +11 -11
- package/dist/utils/translation-utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/auth.d.ts +0 -2
- package/dist/api/client.d.ts +0 -3
- package/dist/api/imports.d.ts +0 -5
- package/dist/api/projects.d.ts +0 -2
- package/dist/api/translation-jobs.js +0 -28
- package/dist/api/translation-jobs.js.map +0 -1
- package/dist/api/translations.d.ts +0 -15
- package/dist/cli.d.ts +0 -2
- package/dist/commands/_sync.js +0 -22
- package/dist/commands/_sync.js.map +0 -1
- package/dist/commands/_translate.js +0 -3
- package/dist/commands/_translate.js.map +0 -1
- package/dist/commands/github-action.js +0 -111
- package/dist/commands/github-action.js.map +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/login.d.ts +0 -16
- package/dist/commands/sync.d.ts +0 -20
- package/dist/commands/sync.js +0 -22
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/translate.d.ts +0 -14
- package/dist/index.d.ts +0 -5
- package/dist/types/index.d.ts +0 -75
- package/dist/types/translate/index.js +0 -2
- package/dist/types/translate/index.js.map +0 -1
- package/dist/utils/auth.d.ts +0 -2
- package/dist/utils/chunked-json-processor.js +0 -52
- package/dist/utils/chunked-json-processor.js.map +0 -1
- package/dist/utils/common.js +0 -9
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/config.d.ts +0 -23
- package/dist/utils/errors.js +0 -37
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/files.d.ts +0 -32
- package/dist/utils/git-diff.js +0 -251
- package/dist/utils/git-diff.js.map +0 -1
- package/dist/utils/git.d.ts +0 -21
- package/dist/utils/github.d.ts +0 -241
- package/dist/utils/import-service.d.ts +0 -4
- package/dist/utils/po-utils-fallback.js +0 -254
- package/dist/utils/po-utils-fallback.js.map +0 -1
- package/dist/utils/prompt-service.d.ts +0 -44
- package/dist/utils/streaming-json-processor.js +0 -125
- package/dist/utils/streaming-json-processor.js.map +0 -1
- package/dist/utils/sync-service.d.ts +0 -58
- package/dist/utils/translation-updater/common.d.ts +0 -6
- package/dist/utils/translation-updater/index.d.ts +0 -5
- package/dist/utils/translation-updater/json-handler.d.ts +0 -5
- package/dist/utils/translation-updater/yaml-handler.d.ts +0 -5
- package/dist/utils/translation-utils.d.ts +0 -30
- package/dist/utils/updater.js +0 -38
- package/dist/utils/updater.js.map +0 -1
package/dist/commands/sync.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SyncOptions } from '../types/index.js';
|
|
2
|
-
interface SyncResult {
|
|
3
|
-
totalUpdates?: number;
|
|
4
|
-
totalDeleted?: number;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
import type { CheckUpdatesResult, UpdatesContainer } from '../utils/sync-service.js';
|
|
8
|
-
interface SyncServiceInterface {
|
|
9
|
-
checkForUpdates: (options: {
|
|
10
|
-
verbose?: boolean;
|
|
11
|
-
}) => Promise<CheckUpdatesResult>;
|
|
12
|
-
applyUpdates: (updates: UpdatesContainer, options: {
|
|
13
|
-
verbose?: boolean;
|
|
14
|
-
}) => Promise<SyncResult>;
|
|
15
|
-
}
|
|
16
|
-
interface SyncDependencies {
|
|
17
|
-
syncService: SyncServiceInterface;
|
|
18
|
-
}
|
|
19
|
-
export declare function sync({ verbose }?: SyncOptions, deps?: SyncDependencies): Promise<SyncResult | void>;
|
|
20
|
-
export {};
|
package/dist/commands/sync.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { syncService as defaultSyncService } from '../utils/sync-service.js';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
export async function sync({ verbose = false } = {}, deps = { syncService: defaultSyncService }) {
|
|
4
|
-
const { syncService } = deps;
|
|
5
|
-
const { hasUpdates, updates } = await syncService.checkForUpdates(verbose);
|
|
6
|
-
if (!hasUpdates) {
|
|
7
|
-
console.log(chalk.green('✓ All translations are up to date'));
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const result = await syncService.applyUpdates(updates, verbose);
|
|
11
|
-
const { totalUpdates = 0, totalDeleted = 0 } = result;
|
|
12
|
-
if (!verbose) {
|
|
13
|
-
if (totalUpdates > 0) {
|
|
14
|
-
console.log(chalk.green(`✓ Updated ${totalUpdates} translations`));
|
|
15
|
-
}
|
|
16
|
-
if (totalDeleted > 0) {
|
|
17
|
-
console.log(chalk.green(`✓ Deleted ${totalDeleted} keys`));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAuB1B,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,EAAE,OAAO,GAAG,KAAK,KAA4B,EAAE,EAC/C,OAAyB,EAAE,WAAW,EAAE,kBAAkB,EAAE;IAE5D,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAE3E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;QAC9D,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEhE,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;IAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,YAAY,eAAe,CAAC,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,YAAY,OAAO,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TranslateOptions } from '../types/index.js';
|
|
2
|
-
import { configService } from '../utils/config.js';
|
|
3
|
-
interface TranslateDependencies {
|
|
4
|
-
console?: Console;
|
|
5
|
-
basePath?: string;
|
|
6
|
-
configUtils?: typeof configService;
|
|
7
|
-
}
|
|
8
|
-
interface TranslateResult {
|
|
9
|
-
totalTranslated: number;
|
|
10
|
-
skipped: number;
|
|
11
|
-
errors: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function translate({ verbose, commit }?: TranslateOptions, deps?: TranslateDependencies): Promise<TranslateResult>;
|
|
14
|
-
export {};
|
package/dist/index.d.ts
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export interface AuthConfig {
|
|
2
|
-
api_key: string;
|
|
3
|
-
last_verified: string;
|
|
4
|
-
}
|
|
5
|
-
export interface TranslationFile {
|
|
6
|
-
paths: string[];
|
|
7
|
-
ignore?: string[];
|
|
8
|
-
}
|
|
9
|
-
export interface ProjectConfig {
|
|
10
|
-
schemaVersion: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
sourceLocale: string;
|
|
13
|
-
outputLocales: string[];
|
|
14
|
-
translationFiles: TranslationFile;
|
|
15
|
-
lastSyncedAt: string | null;
|
|
16
|
-
}
|
|
17
|
-
export interface ApiError {
|
|
18
|
-
code: string;
|
|
19
|
-
message: string;
|
|
20
|
-
}
|
|
21
|
-
export interface Project {
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
}
|
|
25
|
-
export interface Organization {
|
|
26
|
-
name: string;
|
|
27
|
-
projects: Project[];
|
|
28
|
-
}
|
|
29
|
-
export interface VerifyApiKeyResult {
|
|
30
|
-
error?: ApiError;
|
|
31
|
-
organization?: Organization;
|
|
32
|
-
}
|
|
33
|
-
export interface TranslationOptions {
|
|
34
|
-
verbose?: boolean;
|
|
35
|
-
commit?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface SyncOptions {
|
|
38
|
-
verbose?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface FsDependencies {
|
|
41
|
-
readFile: (path: string, options: {
|
|
42
|
-
encoding: string;
|
|
43
|
-
}) => Promise<string>;
|
|
44
|
-
writeFile: (path: string, data: string, options?: any) => Promise<void>;
|
|
45
|
-
mkdir: (path: string, options?: any) => Promise<void>;
|
|
46
|
-
readdir: (path: string) => Promise<string[]>;
|
|
47
|
-
stat: (path: string) => Promise<any>;
|
|
48
|
-
access: (path: string, mode?: number) => Promise<void>;
|
|
49
|
-
}
|
|
50
|
-
export interface ConsoleDependencies {
|
|
51
|
-
log: (message?: any, ...optionalParams: any[]) => void;
|
|
52
|
-
error: (message?: any, ...optionalParams: any[]) => void;
|
|
53
|
-
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
54
|
-
}
|
|
55
|
-
export interface ApiRequestOptions {
|
|
56
|
-
method?: string;
|
|
57
|
-
headers?: Record<string, string>;
|
|
58
|
-
body?: any;
|
|
59
|
-
apiKey?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface ApiClientConfig {
|
|
62
|
-
baseUrl?: string;
|
|
63
|
-
apiKey?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface TranslationData {
|
|
66
|
-
[locale: string]: {
|
|
67
|
-
[key: string]: string | TranslationData;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export interface TranslationUpdateResult {
|
|
71
|
-
added: number;
|
|
72
|
-
updated: number;
|
|
73
|
-
unchanged: number;
|
|
74
|
-
errors: string[];
|
|
75
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/translate/index.ts"],"names":[],"mappings":""}
|
package/dist/utils/auth.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises';
|
|
2
|
-
import { flattenTranslations } from './files.js';
|
|
3
|
-
const DEFAULT_CHUNK_SIZE = 1000;
|
|
4
|
-
export async function processLargeJsonFile(filePath, options = {}) {
|
|
5
|
-
const { chunkSize = DEFAULT_CHUNK_SIZE, onProgress } = options;
|
|
6
|
-
try {
|
|
7
|
-
const content = await readFile(filePath, 'utf8');
|
|
8
|
-
const data = JSON.parse(content);
|
|
9
|
-
let accumulator = {};
|
|
10
|
-
let currentChunk = {};
|
|
11
|
-
let totalKeys = 0;
|
|
12
|
-
let chunksProcessed = 0;
|
|
13
|
-
const entries = Object.entries(data);
|
|
14
|
-
for (const [key, value] of entries) {
|
|
15
|
-
currentChunk[key] = value;
|
|
16
|
-
totalKeys++;
|
|
17
|
-
if (Object.keys(currentChunk).length >= chunkSize) {
|
|
18
|
-
await processChunk(currentChunk, accumulator);
|
|
19
|
-
chunksProcessed++;
|
|
20
|
-
if (onProgress) {
|
|
21
|
-
onProgress(totalKeys, entries.length);
|
|
22
|
-
}
|
|
23
|
-
currentChunk = {};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (Object.keys(currentChunk).length > 0) {
|
|
27
|
-
await processChunk(currentChunk, accumulator);
|
|
28
|
-
chunksProcessed++;
|
|
29
|
-
}
|
|
30
|
-
if (onProgress) {
|
|
31
|
-
onProgress(totalKeys, totalKeys);
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
translations: accumulator,
|
|
35
|
-
isChunked: true,
|
|
36
|
-
totalKeys,
|
|
37
|
-
chunksProcessed
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new Error(`Error processing JSON file: ${error.message}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async function processChunk(chunk, accumulator) {
|
|
45
|
-
const flattened = flattenTranslations(chunk);
|
|
46
|
-
Object.assign(accumulator, flattened);
|
|
47
|
-
}
|
|
48
|
-
export function shouldUseChunkedProcessing(fileSize, format) {
|
|
49
|
-
const CHUNKING_THRESHOLD = 5 * 1024 * 1024; // 5MB
|
|
50
|
-
return format === 'json' && fileSize > CHUNKING_THRESHOLD && fileSize <= 100 * 1024 * 1024;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=chunked-json-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunked-json-processor.js","sourceRoot":"","sources":["../../src/utils/chunked-json-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAcjD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,UAAoC,EAAE;IAEtC,MAAM,EAAE,SAAS,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEjC,IAAI,WAAW,GAAwB,EAAE,CAAC;QAC1C,IAAI,YAAY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IAC7C,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,QAAgB,EAAE,MAAc;IACzE,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM;IAClD,OAAO,MAAM,KAAK,MAAM,IAAI,QAAQ,GAAG,kBAAkB,IAAI,QAAQ,IAAI,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7F,CAAC"}
|
package/dist/utils/common.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sleep for a specified number of milliseconds
|
|
3
|
-
* @param ms Number of milliseconds to sleep
|
|
4
|
-
* @returns Promise that resolves after the specified time
|
|
5
|
-
*/
|
|
6
|
-
export function sleep(ms) {
|
|
7
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=common.js.map
|
package/dist/utils/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/utils/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { AuthConfig, ProjectConfig } from '../types/index.js';
|
|
4
|
-
interface ConfigDependencies {
|
|
5
|
-
fs: typeof fs;
|
|
6
|
-
path: typeof path;
|
|
7
|
-
process: typeof process;
|
|
8
|
-
cwd: () => string;
|
|
9
|
-
}
|
|
10
|
-
interface ConfigService {
|
|
11
|
-
deps: ConfigDependencies;
|
|
12
|
-
setDependencies(customDeps?: Partial<ConfigDependencies>): ConfigService;
|
|
13
|
-
configFilePath(basePath?: string): string;
|
|
14
|
-
getAuthConfig(basePath?: string): Promise<AuthConfig | null>;
|
|
15
|
-
saveAuthConfig(config: AuthConfig, basePath?: string): Promise<void>;
|
|
16
|
-
getProjectConfig(basePath?: string): Promise<ProjectConfig | null>;
|
|
17
|
-
saveProjectConfig(config: Partial<ProjectConfig>, basePath?: string): Promise<void>;
|
|
18
|
-
validateProjectConfig(config: ProjectConfig): Promise<boolean>;
|
|
19
|
-
getValidProjectConfig(basePath?: string): Promise<ProjectConfig>;
|
|
20
|
-
updateLastSyncedAt(basePath?: string): Promise<ProjectConfig>;
|
|
21
|
-
}
|
|
22
|
-
export declare const configService: ConfigService;
|
|
23
|
-
export {};
|
package/dist/utils/errors.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error class for CLI errors that should exit the process
|
|
3
|
-
*/
|
|
4
|
-
export class CliError extends Error {
|
|
5
|
-
exitCode;
|
|
6
|
-
constructor(message, exitCode = 1) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = 'CliError';
|
|
9
|
-
this.exitCode = exitCode;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Create a new CLI error
|
|
14
|
-
* @param message Error message
|
|
15
|
-
* @param exitCode Optional exit code, defaults to 1
|
|
16
|
-
* @returns A new CliError
|
|
17
|
-
*/
|
|
18
|
-
export function cliError(message, exitCode = 1) {
|
|
19
|
-
return new CliError(message, exitCode);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Handle a CLI error
|
|
23
|
-
* @param error The error to handle
|
|
24
|
-
* @param exitProcess Whether to exit the process (defaults to true)
|
|
25
|
-
* @returns The exit code if not exiting process
|
|
26
|
-
*/
|
|
27
|
-
export function handleCliError(error, exitProcess = true) {
|
|
28
|
-
const isCliError = error instanceof CliError;
|
|
29
|
-
const exitCode = isCliError ? error.exitCode : 1;
|
|
30
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
-
console.error(`\n✖ ${message}\n`);
|
|
32
|
-
if (exitProcess) {
|
|
33
|
-
process.exit(exitCode);
|
|
34
|
-
}
|
|
35
|
-
return exitCode;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/utils/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAS;IAEjB,YAAY,OAAe,EAAE,WAAmB,CAAC;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,WAAmB,CAAC;IAC5D,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,cAAuB,IAAI;IACxE,MAAM,UAAU,GAAG,KAAK,YAAY,QAAQ,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvE,OAAO,CAAC,KAAK,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC;IAElC,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/utils/files.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export function parseFile(content: any, format: any, filePath?: string): any;
|
|
2
|
-
export function extractLocaleFromPath(filePath: any, localeRegex: any, knownLocales?: any[]): any;
|
|
3
|
-
export function isValidLocale(locale: any): boolean;
|
|
4
|
-
export function flattenTranslations(obj: any, parentKey?: string): {};
|
|
5
|
-
export function findTranslationFiles(config: any, options?: {}): Promise<{
|
|
6
|
-
path: any;
|
|
7
|
-
format: string;
|
|
8
|
-
locale: any;
|
|
9
|
-
}[] | {
|
|
10
|
-
allFiles: {
|
|
11
|
-
path: any;
|
|
12
|
-
format: string;
|
|
13
|
-
locale: any;
|
|
14
|
-
}[];
|
|
15
|
-
sourceFiles: {
|
|
16
|
-
path: any;
|
|
17
|
-
format: string;
|
|
18
|
-
locale: any;
|
|
19
|
-
}[];
|
|
20
|
-
targetFilesByLocale: {};
|
|
21
|
-
}>;
|
|
22
|
-
export function unflattenTranslations(flatObj: any): {};
|
|
23
|
-
export function detectJsonFormat(obj: any): "nested" | "mixed" | "flat";
|
|
24
|
-
export function preserveJsonStructure(originalObj: any, newTranslations: any, format: any): any;
|
|
25
|
-
export function directoryExists(path: any, fsModule?: typeof fs): Promise<boolean>;
|
|
26
|
-
export function findFirstExistingPath(paths: any, fsModule?: typeof fs): Promise<any>;
|
|
27
|
-
export function getDirectoryContents(dir: any, fsModule?: typeof fs): Promise<{
|
|
28
|
-
files: string[];
|
|
29
|
-
jsonFiles: string[];
|
|
30
|
-
yamlFiles: string[];
|
|
31
|
-
} | null>;
|
|
32
|
-
import { promises as fs } from 'fs';
|
package/dist/utils/git-diff.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { parseFile, flattenTranslations } from './files.js';
|
|
5
|
-
/**
|
|
6
|
-
* Git diff integration for --changed-only flag
|
|
7
|
-
* This module filters translations to only include keys that changed in the current branch
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Main entry point for git diff filtering
|
|
11
|
-
* Returns null to fall back, {} for no changes, or filtered data for success
|
|
12
|
-
*/
|
|
13
|
-
export function filterByGitChanges(sourceFiles, missingByLocale, config, verbose) {
|
|
14
|
-
try {
|
|
15
|
-
// Quick validation
|
|
16
|
-
if (!canUseGitDiff()) {
|
|
17
|
-
if (verbose) {
|
|
18
|
-
console.log(chalk.dim('Git not available or not in a repository'));
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const baseBranch = getBaseBranch(config);
|
|
23
|
-
if (verbose) {
|
|
24
|
-
console.log(chalk.blue(`Comparing against: ${baseBranch}`));
|
|
25
|
-
}
|
|
26
|
-
// Validate and check if base branch exists
|
|
27
|
-
let safeBranch;
|
|
28
|
-
try {
|
|
29
|
-
safeBranch = sanitizeBranchName(baseBranch);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
if (verbose) {
|
|
33
|
-
const err = error;
|
|
34
|
-
console.log(chalk.yellow(`Invalid branch name: ${err.message}`));
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
if (!branchExists(safeBranch)) {
|
|
39
|
-
if (verbose) {
|
|
40
|
-
console.log(chalk.yellow(`Base branch '${baseBranch}' not found`));
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
// Get changed keys from source files
|
|
45
|
-
const changedKeys = getChangedKeys(sourceFiles, safeBranch, verbose);
|
|
46
|
-
if (changedKeys.size === 0) {
|
|
47
|
-
if (verbose) {
|
|
48
|
-
console.log(chalk.dim('No changes detected in source files'));
|
|
49
|
-
}
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
if (verbose) {
|
|
53
|
-
console.log(chalk.blue(`Found ${changedKeys.size} changed key${changedKeys.size === 1 ? '' : 's'}:`));
|
|
54
|
-
// Show first 10 keys, with indication if there are more
|
|
55
|
-
const keysArray = Array.from(changedKeys);
|
|
56
|
-
const displayKeys = keysArray.slice(0, 10);
|
|
57
|
-
displayKeys.forEach(key => {
|
|
58
|
-
console.log(chalk.dim(` - ${key}`));
|
|
59
|
-
});
|
|
60
|
-
if (keysArray.length > 10) {
|
|
61
|
-
console.log(chalk.dim(` ... and ${keysArray.length - 10} more`));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Filter missing translations by changed keys
|
|
65
|
-
return filterMissing(missingByLocale, changedKeys);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (verbose) {
|
|
69
|
-
const err = error;
|
|
70
|
-
console.log(chalk.yellow(`Git diff failed: ${err.message}`));
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Check if git is available and we're in a repository
|
|
77
|
-
*/
|
|
78
|
-
export function canUseGitDiff() {
|
|
79
|
-
try {
|
|
80
|
-
execSync('git rev-parse --git-dir', { stdio: 'ignore' });
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get base branch from config, environment, or default
|
|
89
|
-
*/
|
|
90
|
-
function getBaseBranch(config) {
|
|
91
|
-
return config.translationFiles?.baseBranch
|
|
92
|
-
|| process.env.GITHUB_BASE_REF
|
|
93
|
-
|| 'main';
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Sanitize branch name to prevent command injection
|
|
97
|
-
* Allows only alphanumeric, hyphen, and underscore
|
|
98
|
-
* Supports remote branches like origin/main explicitly
|
|
99
|
-
*/
|
|
100
|
-
function sanitizeBranchName(branch) {
|
|
101
|
-
// Handle remote branches explicitly (e.g., origin/main)
|
|
102
|
-
if (branch.startsWith('origin/')) {
|
|
103
|
-
const remotePart = 'origin/';
|
|
104
|
-
const branchPart = branch.slice(remotePart.length).replace(/[^a-zA-Z0-9_\-]/g, '');
|
|
105
|
-
if (!branchPart) {
|
|
106
|
-
throw new Error(`Invalid branch name: ${branch}`);
|
|
107
|
-
}
|
|
108
|
-
return remotePart + branchPart;
|
|
109
|
-
}
|
|
110
|
-
// For local branches, no slashes allowed (prevents path traversal)
|
|
111
|
-
const sanitized = branch.replace(/[^a-zA-Z0-9_\-]/g, '');
|
|
112
|
-
if (!sanitized) {
|
|
113
|
-
throw new Error(`Invalid branch name: ${branch}`);
|
|
114
|
-
}
|
|
115
|
-
return sanitized;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Sanitize file path for use in git commands
|
|
119
|
-
* Removes characters that could break out of quotes
|
|
120
|
-
*/
|
|
121
|
-
function sanitizeGitPath(path) {
|
|
122
|
-
return path.replace(/["'`$\\]/g, '');
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Check if a branch exists (local or remote)
|
|
126
|
-
* @param branch - Already sanitized branch name
|
|
127
|
-
*/
|
|
128
|
-
function branchExists(branch) {
|
|
129
|
-
try {
|
|
130
|
-
execSync(`git rev-parse --verify ${branch}`, { stdio: 'ignore' });
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
// If not a remote branch already, try with origin/ prefix
|
|
135
|
-
if (!branch.startsWith('origin/')) {
|
|
136
|
-
try {
|
|
137
|
-
execSync(`git rev-parse --verify origin/${branch}`, { stdio: 'ignore' });
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get all changed keys from source files using object-based diff
|
|
149
|
-
* Compares parsed and flattened objects from base branch vs current working directory
|
|
150
|
-
* @param baseBranch - Already sanitized branch name
|
|
151
|
-
*/
|
|
152
|
-
function getChangedKeys(sourceFiles, baseBranch, verbose) {
|
|
153
|
-
const allChangedKeys = new Set();
|
|
154
|
-
for (const file of sourceFiles) {
|
|
155
|
-
try {
|
|
156
|
-
// Sanitize file path for git command
|
|
157
|
-
const sanitizedPath = sanitizeGitPath(file.path);
|
|
158
|
-
// Get old version from base branch
|
|
159
|
-
let oldFlat = {};
|
|
160
|
-
try {
|
|
161
|
-
const oldContent = execSync(`git show ${baseBranch}:"${sanitizedPath}"`, {
|
|
162
|
-
encoding: 'utf-8',
|
|
163
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
164
|
-
stdio: ['pipe', 'pipe', 'ignore']
|
|
165
|
-
});
|
|
166
|
-
const oldObj = parseFile(oldContent, file.format, file.path);
|
|
167
|
-
oldFlat = flattenTranslations(oldObj);
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
const err = error;
|
|
171
|
-
if (verbose) {
|
|
172
|
-
// Check if it's a git error (file doesn't exist) or parse error
|
|
173
|
-
if (err.message.includes('exists on disk, but not in') || err.message.includes('does not exist')) {
|
|
174
|
-
console.log(chalk.dim(` ${file.path}: new file (all keys changed)`));
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
console.log(chalk.yellow(` ${file.path}: Parse error - ${err.message}`));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
// If parse fails or file doesn't exist, oldFlat remains {} - all keys will be treated as new
|
|
181
|
-
}
|
|
182
|
-
// Get current version from working directory
|
|
183
|
-
const newContent = readFileSync(file.path, 'utf-8');
|
|
184
|
-
const newObj = parseFile(newContent, file.format, file.path);
|
|
185
|
-
const newFlat = flattenTranslations(newObj);
|
|
186
|
-
// Compare flattened objects to find changed keys
|
|
187
|
-
const fileChangedKeys = [];
|
|
188
|
-
const MAX_KEYS_TO_COLLECT = 100; // Cap to prevent memory issues
|
|
189
|
-
let totalChangedInFile = 0;
|
|
190
|
-
for (const [key, value] of Object.entries(newFlat)) {
|
|
191
|
-
// Check if key exists in old using 'in' operator (handles falsy values correctly)
|
|
192
|
-
const keyExistsInOld = key in oldFlat;
|
|
193
|
-
if (!keyExistsInOld || oldFlat[key] !== value) {
|
|
194
|
-
allChangedKeys.add(key);
|
|
195
|
-
totalChangedInFile++;
|
|
196
|
-
// Only collect keys for verbose output up to a limit
|
|
197
|
-
if (verbose && fileChangedKeys.length < MAX_KEYS_TO_COLLECT) {
|
|
198
|
-
fileChangedKeys.push(key);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (verbose && totalChangedInFile > 0) {
|
|
203
|
-
console.log(chalk.dim(` ${file.path}: ${totalChangedInFile} changed key${totalChangedInFile === 1 ? '' : 's'}`));
|
|
204
|
-
// Show first 5 keys per file
|
|
205
|
-
const displayKeys = fileChangedKeys.slice(0, 5);
|
|
206
|
-
displayKeys.forEach(key => {
|
|
207
|
-
const status = (key in oldFlat) ? 'modified' : 'new';
|
|
208
|
-
console.log(chalk.dim(` - ${key} (${status})`));
|
|
209
|
-
});
|
|
210
|
-
if (totalChangedInFile > 5) {
|
|
211
|
-
console.log(chalk.dim(` ... and ${totalChangedInFile - 5} more`));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
catch (error) {
|
|
216
|
-
// Skip this file, continue with others
|
|
217
|
-
if (verbose) {
|
|
218
|
-
const err = error;
|
|
219
|
-
console.log(chalk.dim(` Skipping ${file.path}: ${err.message}`));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return allChangedKeys;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Filter missing translations by changed keys
|
|
227
|
-
*/
|
|
228
|
-
function filterMissing(missingByLocale, changedKeys) {
|
|
229
|
-
const filtered = {};
|
|
230
|
-
for (const [localeKey, entry] of Object.entries(missingByLocale)) {
|
|
231
|
-
// Filter the keys Record to only include changed keys
|
|
232
|
-
const filteredKeys = {};
|
|
233
|
-
let count = 0;
|
|
234
|
-
for (const [key, details] of Object.entries(entry.keys)) {
|
|
235
|
-
if (changedKeys.has(key)) {
|
|
236
|
-
filteredKeys[key] = details;
|
|
237
|
-
count++;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
// Only include this entry if it has matching keys
|
|
241
|
-
if (count > 0) {
|
|
242
|
-
filtered[localeKey] = {
|
|
243
|
-
...entry,
|
|
244
|
-
keys: filteredKeys,
|
|
245
|
-
keyCount: count
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return filtered;
|
|
250
|
-
}
|
|
251
|
-
//# sourceMappingURL=git-diff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-diff.js","sourceRoot":"","sources":["../../src/utils/git-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5D;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAA8B,EAC9B,eAAmD,EACnD,MAAqB,EACrB,OAAgB;IAEhB,IAAI,CAAC;QACH,mBAAmB;QACnB,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;YACrB,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QAEzC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,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,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACxD,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,YAAY,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;gBAC5B,KAAK,EAAE,CAAC;YACV,CAAC;QACH,CAAC;QAED,kDAAkD;QAClD,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,QAAQ,CAAC,SAAS,CAAC,GAAG;gBACpB,GAAG,KAAK;gBACR,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,KAAK;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/utils/git.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
interface ExecResult {
|
|
4
|
-
stdout: string;
|
|
5
|
-
stderr: string;
|
|
6
|
-
}
|
|
7
|
-
interface GitDependencies {
|
|
8
|
-
fs: typeof fs;
|
|
9
|
-
path: typeof path;
|
|
10
|
-
exec: (file: string, args: string[]) => Promise<ExecResult>;
|
|
11
|
-
}
|
|
12
|
-
interface GitService {
|
|
13
|
-
deps: GitDependencies;
|
|
14
|
-
setDependencies: (customDeps?: Partial<GitDependencies>) => GitService;
|
|
15
|
-
updateGitignore: (basePath: string) => Promise<boolean>;
|
|
16
|
-
getCurrentBranch: () => Promise<string | null>;
|
|
17
|
-
}
|
|
18
|
-
export declare const gitService: GitService;
|
|
19
|
-
export declare function updateGitignore(basePath: string): Promise<boolean>;
|
|
20
|
-
export declare function getCurrentBranch(): Promise<string | null>;
|
|
21
|
-
export {};
|