mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Cleanup the crowdin integration script, completely migrate it to API v2
This commit is contained in:
98
@types/cwordin-api.d.ts
vendored
98
@types/cwordin-api.d.ts
vendored
@@ -1,98 +0,0 @@
|
||||
declare module 'crowdin-api' {
|
||||
export interface ProjectInfoFile {
|
||||
node_type: 'file';
|
||||
id: number;
|
||||
name: string;
|
||||
created: string;
|
||||
last_updated: string;
|
||||
last_accessed: string;
|
||||
last_revision: string;
|
||||
}
|
||||
|
||||
export interface ProjectInfoDirectory {
|
||||
node_type: 'directory';
|
||||
id: number;
|
||||
name: string;
|
||||
files: Array<ProjectInfoFile | ProjectInfoDirectory>;
|
||||
}
|
||||
|
||||
export interface ProjectInfoResponse {
|
||||
details: {
|
||||
source_language: {
|
||||
name: string;
|
||||
code: string;
|
||||
};
|
||||
name: string;
|
||||
identifier: string;
|
||||
created: string;
|
||||
description: string;
|
||||
join_policy: string;
|
||||
last_build: string | null;
|
||||
last_activity: string;
|
||||
participants_count: string; // it's number, but string in the response
|
||||
logo_url: string | null;
|
||||
total_strings_count: string; // it's number, but string in the response
|
||||
total_words_count: string; // it's number, but string in the response
|
||||
duplicate_strings_count: number;
|
||||
duplicate_words_count: number;
|
||||
invite_url: {
|
||||
translator: string;
|
||||
proofreader: string;
|
||||
};
|
||||
};
|
||||
languages: Array<{
|
||||
name: string; // English language name
|
||||
code: string;
|
||||
can_translate: 0 | 1;
|
||||
can_approve: 0 | 1;
|
||||
}>;
|
||||
files: Array<ProjectInfoFile | ProjectInfoDirectory>;
|
||||
}
|
||||
|
||||
export interface LanguageStatusNode {
|
||||
node_type: 'directory' | 'file';
|
||||
id: number;
|
||||
name: string;
|
||||
phrases: number;
|
||||
translated: number;
|
||||
approved: number;
|
||||
words: number;
|
||||
words_translated: number;
|
||||
words_approved: number;
|
||||
files: Array<LanguageStatusNode>;
|
||||
}
|
||||
|
||||
export interface LanguageStatusResponse {
|
||||
files: Array<LanguageStatusNode>;
|
||||
}
|
||||
|
||||
type FilesList = Record<string, string | ReadableStream>;
|
||||
|
||||
export default class CrowdinApi {
|
||||
constructor(params: { apiKey: string; projectName: string; baseUrl?: string });
|
||||
projectInfo(): Promise<ProjectInfoResponse>;
|
||||
languageStatus(language: string): Promise<LanguageStatusResponse>;
|
||||
exportFile(
|
||||
file: string,
|
||||
language: string,
|
||||
params?: {
|
||||
branch?: string;
|
||||
format?: 'xliff';
|
||||
export_translated_only?: boolean;
|
||||
export_approved_only?: boolean;
|
||||
},
|
||||
): Promise<string>; // TODO: not sure about Promise return type
|
||||
updateFile(
|
||||
files: FilesList,
|
||||
params: {
|
||||
titles?: Record<string, string>;
|
||||
export_patterns?: Record<string, string>;
|
||||
new_names?: Record<string, string>;
|
||||
first_line_contains_header?: string;
|
||||
scheme?: string;
|
||||
update_option?: 'update_as_unapproved' | 'update_without_changes';
|
||||
branch?: string;
|
||||
},
|
||||
): Promise<void>;
|
||||
}
|
||||
}
|
10
@types/multi-progress.d.ts
vendored
10
@types/multi-progress.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
declare module 'multi-progress' {
|
||||
export default class MultiProgress {
|
||||
constructor(stream?: string);
|
||||
newBar(schema: string, options: ProgressBar.ProgressBarOptions): ProgressBar;
|
||||
terminate(): void;
|
||||
move(index: number): void;
|
||||
tick(index: number, value?: number, options?: any): void;
|
||||
update(index: number, value?: number, options?: any): void;
|
||||
}
|
||||
}
|
56
@types/prompt.d.ts
vendored
56
@types/prompt.d.ts
vendored
@@ -1,56 +0,0 @@
|
||||
// Type definitions for Prompt.js 1.0.0
|
||||
// Project: https://github.com/flatiron/prompt
|
||||
|
||||
declare module 'prompt' {
|
||||
type PropertiesType = Array<string> | prompt.PromptSchema | Array<prompt.PromptPropertyOptions>;
|
||||
|
||||
namespace prompt {
|
||||
interface PromptSchema {
|
||||
properties: PromptProperties;
|
||||
}
|
||||
|
||||
interface PromptProperties {
|
||||
[propName: string]: PromptPropertyOptions;
|
||||
}
|
||||
|
||||
interface PromptPropertyOptions {
|
||||
name?: string;
|
||||
pattern?: RegExp;
|
||||
message?: string;
|
||||
required?: boolean;
|
||||
hidden?: boolean;
|
||||
description?: string;
|
||||
type?: string;
|
||||
default?: string;
|
||||
before?: (value: any) => any;
|
||||
conform?: (result: any) => boolean;
|
||||
}
|
||||
|
||||
export function start(): void;
|
||||
|
||||
export function get<T extends PropertiesType>(
|
||||
properties: T,
|
||||
callback: (
|
||||
err: Error,
|
||||
result: T extends Array<string>
|
||||
? Record<T[number], string>
|
||||
: T extends PromptSchema
|
||||
? Record<keyof T['properties'], string>
|
||||
: T extends Array<PromptPropertyOptions>
|
||||
? Record<T[number]['name'] extends string ? T[number]['name'] : number, string>
|
||||
: never,
|
||||
) => void,
|
||||
): void;
|
||||
|
||||
export function addProperties(obj: any, properties: PropertiesType, callback: (err: Error) => void): void;
|
||||
|
||||
export function history(propertyName: string): any;
|
||||
|
||||
export let override: any;
|
||||
export let colors: boolean;
|
||||
export let message: string;
|
||||
export let delimiter: string;
|
||||
}
|
||||
|
||||
export = prompt;
|
||||
}
|
Reference in New Issue
Block a user