onreza-release 1.0.1 → 2.0.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/README.md +169 -45
- package/dist/binaries.d.ts +8 -66
- package/dist/cli.js +1295 -6437
- package/dist/cli.js.map +19 -50
- package/dist/config.d.ts +8 -4
- package/dist/index.d.ts +8 -6
- package/dist/index.js +1301 -6389
- package/dist/index.js.map +17 -48
- package/dist/providers/detector.d.ts +71 -0
- package/dist/providers/github.d.ts +53 -0
- package/dist/providers/gitverse.d.ts +48 -0
- package/dist/providers/index.d.ts +67 -0
- package/dist/providers/limits.d.ts +75 -0
- package/dist/providers/tokens.d.ts +42 -0
- package/dist/providers/types.d.ts +151 -0
- package/dist/types.d.ts +137 -131
- package/dist/utils/binary-distribution-provider.d.ts +50 -0
- package/dist/utils/binary-platforms.d.ts +1 -25
- package/dist/utils/binary-postinstall-generator.d.ts +34 -0
- package/dist/utils/git.d.ts +1 -1
- package/package.json +3 -3
- package/schema.json +41 -61
- package/dist/gitverse.d.ts +0 -91
- package/dist/utils/binary-package-generator.d.ts +0 -24
- package/dist/utils/binary-publisher.d.ts +0 -53
- package/dist/utils/binary-wrapper-generator.d.ts +0 -34
package/schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"additionalProperties": false,
|
|
4
|
-
"description": "Configuration file for
|
|
4
|
+
"description": "Configuration file for onreza-release tool",
|
|
5
5
|
"properties": {
|
|
6
6
|
"$schema": {
|
|
7
7
|
"description": "JSON Schema reference for IDE support",
|
|
@@ -12,15 +12,12 @@
|
|
|
12
12
|
"continueOnError": false,
|
|
13
13
|
"distDir": "./dist",
|
|
14
14
|
"enabled": false,
|
|
15
|
-
"inputFormat": "
|
|
16
|
-
"mainPackage": "./package.json",
|
|
15
|
+
"inputFormat": "tar.gz",
|
|
17
16
|
"name": "",
|
|
18
|
-
"outDir": "./npm",
|
|
19
17
|
"platforms": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64"],
|
|
20
|
-
"publishCommand": "npm publish --access public",
|
|
21
18
|
"retryAttempts": 3
|
|
22
19
|
},
|
|
23
|
-
"description": "Binary distribution settings for
|
|
20
|
+
"description": "Binary distribution settings for uploading platform-specific archives to GitVerse Release",
|
|
24
21
|
"properties": {
|
|
25
22
|
"archiveNameTemplate": {
|
|
26
23
|
"default": "{{name}}-{{platform}}.tar.gz",
|
|
@@ -34,7 +31,7 @@
|
|
|
34
31
|
},
|
|
35
32
|
"continueOnError": {
|
|
36
33
|
"default": false,
|
|
37
|
-
"description": "Continue
|
|
34
|
+
"description": "Continue uploading remaining assets if one fails",
|
|
38
35
|
"type": "boolean"
|
|
39
36
|
},
|
|
40
37
|
"distDir": {
|
|
@@ -48,28 +45,13 @@
|
|
|
48
45
|
"type": "boolean"
|
|
49
46
|
},
|
|
50
47
|
"inputFormat": {
|
|
51
|
-
"default": "
|
|
48
|
+
"default": "tar.gz",
|
|
52
49
|
"description": "Input format for binaries. 'directory' expects binaries in dist/name-platform/name, 'tar.gz' expects archives in dist/name-platform.tar.gz",
|
|
53
50
|
"enum": ["directory", "tar.gz"],
|
|
54
51
|
"type": "string"
|
|
55
52
|
},
|
|
56
|
-
"mainPackage": {
|
|
57
|
-
"default": "./package.json",
|
|
58
|
-
"description": "Path to main package.json for updating optionalDependencies",
|
|
59
|
-
"type": "string"
|
|
60
|
-
},
|
|
61
53
|
"name": {
|
|
62
|
-
"description": "Base name for
|
|
63
|
-
"type": "string"
|
|
64
|
-
},
|
|
65
|
-
"outDir": {
|
|
66
|
-
"default": "./npm",
|
|
67
|
-
"description": "Output directory for generated npm packages",
|
|
68
|
-
"type": "string"
|
|
69
|
-
},
|
|
70
|
-
"packageNameTemplate": {
|
|
71
|
-
"description": "Template for package names. Placeholders: {{scope}}, {{name}}, {{platform}}. Default: '{{name}}-{{platform}}' (without scope) or '@{{scope}}/{{name}}-{{platform}}' (with scope)",
|
|
72
|
-
"examples": ["{{name}}-{{platform}}", "@{{scope}}/{{name}}-{{platform}}", "{{name}}-bin-{{platform}}"],
|
|
54
|
+
"description": "Base name for binary (e.g., 'myapp' creates myapp-linux-x64.tar.gz assets)",
|
|
73
55
|
"type": "string"
|
|
74
56
|
},
|
|
75
57
|
"platformMap": {
|
|
@@ -77,7 +59,7 @@
|
|
|
77
59
|
"enum": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64", "win32-arm64"],
|
|
78
60
|
"type": "string"
|
|
79
61
|
},
|
|
80
|
-
"description": "Mapping of source
|
|
62
|
+
"description": "Mapping of source archive names to target platforms. Keys are identifiers in archive names (e.g., 'linux-amd64'), values are target platforms (e.g., 'linux-x64')",
|
|
81
63
|
"type": "object"
|
|
82
64
|
},
|
|
83
65
|
"platforms": {
|
|
@@ -90,22 +72,13 @@
|
|
|
90
72
|
"type": "array",
|
|
91
73
|
"uniqueItems": true
|
|
92
74
|
},
|
|
93
|
-
"publishCommand": {
|
|
94
|
-
"default": "npm publish --access public",
|
|
95
|
-
"description": "Command to publish packages. Supports placeholders: {{packageDir}}, {{version}}, {{platform}}, {{scope}}, {{name}}",
|
|
96
|
-
"type": "string"
|
|
97
|
-
},
|
|
98
75
|
"retryAttempts": {
|
|
99
76
|
"default": 3,
|
|
100
|
-
"description": "Number of retry attempts for
|
|
77
|
+
"description": "Number of retry attempts for asset upload",
|
|
101
78
|
"maximum": 10,
|
|
102
79
|
"minimum": 1,
|
|
103
80
|
"type": "integer"
|
|
104
81
|
},
|
|
105
|
-
"scope": {
|
|
106
|
-
"description": "npm scope for platform packages (e.g., '@rainypixel'). Optional - if not set, packages are published without scope",
|
|
107
|
-
"type": "string"
|
|
108
|
-
},
|
|
109
82
|
"sourceBinName": {
|
|
110
83
|
"description": "Binary name inside archive (if different from 'name'). Used only with inputFormat: 'tar.gz'",
|
|
111
84
|
"type": "string"
|
|
@@ -301,32 +274,6 @@
|
|
|
301
274
|
},
|
|
302
275
|
"type": "object"
|
|
303
276
|
},
|
|
304
|
-
"gitverse": {
|
|
305
|
-
"default": {
|
|
306
|
-
"checkExisting": true,
|
|
307
|
-
"enabled": true,
|
|
308
|
-
"failOnError": true
|
|
309
|
-
},
|
|
310
|
-
"description": "GitVerse release creation settings",
|
|
311
|
-
"properties": {
|
|
312
|
-
"checkExisting": {
|
|
313
|
-
"default": true,
|
|
314
|
-
"description": "Check if release already exists before creating. Enables idempotent pipeline runs",
|
|
315
|
-
"type": "boolean"
|
|
316
|
-
},
|
|
317
|
-
"enabled": {
|
|
318
|
-
"default": true,
|
|
319
|
-
"description": "Enable GitVerse release creation via API. Requires GVR_TOKEN environment variable",
|
|
320
|
-
"type": "boolean"
|
|
321
|
-
},
|
|
322
|
-
"failOnError": {
|
|
323
|
-
"default": true,
|
|
324
|
-
"description": "Fail the entire release process if GitVerse release creation fails (after retries). When false, release creation errors are logged as warnings",
|
|
325
|
-
"type": "boolean"
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
"type": "object"
|
|
329
|
-
},
|
|
330
277
|
"monorepo": {
|
|
331
278
|
"default": {
|
|
332
279
|
"enabled": false,
|
|
@@ -374,6 +321,39 @@
|
|
|
374
321
|
},
|
|
375
322
|
"type": "object"
|
|
376
323
|
},
|
|
324
|
+
"release": {
|
|
325
|
+
"default": {
|
|
326
|
+
"checkExisting": true,
|
|
327
|
+
"enabled": true,
|
|
328
|
+
"failOnError": true,
|
|
329
|
+
"platform": "auto"
|
|
330
|
+
},
|
|
331
|
+
"description": "Release creation settings for GitVerse, GitHub, and GitLab platforms",
|
|
332
|
+
"properties": {
|
|
333
|
+
"checkExisting": {
|
|
334
|
+
"default": true,
|
|
335
|
+
"description": "Check if release already exists before creating. Enables idempotent pipeline runs",
|
|
336
|
+
"type": "boolean"
|
|
337
|
+
},
|
|
338
|
+
"enabled": {
|
|
339
|
+
"default": true,
|
|
340
|
+
"description": "Enable release creation via platform API. Requires appropriate token: GVR_TOKEN (GitVerse), GITHUB_TOKEN (GitHub), GITLAB_TOKEN (GitLab)",
|
|
341
|
+
"type": "boolean"
|
|
342
|
+
},
|
|
343
|
+
"failOnError": {
|
|
344
|
+
"default": true,
|
|
345
|
+
"description": "Fail the entire release process if release creation fails (after retries). When false, release creation errors are logged as warnings",
|
|
346
|
+
"type": "boolean"
|
|
347
|
+
},
|
|
348
|
+
"platform": {
|
|
349
|
+
"default": "auto",
|
|
350
|
+
"description": "Git platform for release creation. 'auto' detects platform from git remote or CI environment",
|
|
351
|
+
"enum": ["auto", "gitverse", "github", "gitlab"],
|
|
352
|
+
"type": "string"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"type": "object"
|
|
356
|
+
},
|
|
377
357
|
"retry": {
|
|
378
358
|
"default": {
|
|
379
359
|
"enabled": true,
|
package/dist/gitverse.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { GitRepoInfo } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Retry функция type
|
|
4
|
-
*/
|
|
5
|
-
export type RetryFunction = <T>(fn: () => Promise<T>, operationName?: string) => Promise<T>;
|
|
6
|
-
/**
|
|
7
|
-
* Имя переменной окружения для токена
|
|
8
|
-
*/
|
|
9
|
-
export declare const TOKEN_ENV_VAR = "GVR_TOKEN";
|
|
10
|
-
/**
|
|
11
|
-
* Устаревшее имя переменной (для обратной совместимости)
|
|
12
|
-
* @deprecated Используйте GVR_TOKEN
|
|
13
|
-
*/
|
|
14
|
-
export declare const LEGACY_TOKEN_ENV_VAR = "GITVERSE_TOKEN";
|
|
15
|
-
/**
|
|
16
|
-
* Результат валидации токена
|
|
17
|
-
*/
|
|
18
|
-
export interface TokenValidationResult {
|
|
19
|
-
/** Валиден ли токен */
|
|
20
|
-
valid: boolean;
|
|
21
|
-
/** Имя пользователя (если токен валиден) */
|
|
22
|
-
username?: string;
|
|
23
|
-
/** Сообщение об ошибке (если токен невалиден) */
|
|
24
|
-
error?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Результат получения токена
|
|
28
|
-
*/
|
|
29
|
-
interface TokenResult {
|
|
30
|
-
/** Токен */
|
|
31
|
-
token: string;
|
|
32
|
-
/** Имя переменной из которой получен токен */
|
|
33
|
-
source: string;
|
|
34
|
-
/** Использован ли устаревший способ */
|
|
35
|
-
isLegacy: boolean;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Проверяет, запущен ли скрипт в GitVerse Actions CI
|
|
39
|
-
*/
|
|
40
|
-
export declare function isGitVerseActionsCI(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Получает токен из переменных окружения
|
|
43
|
-
* Приоритет: GVR_TOKEN > GITVERSE_TOKEN (legacy, требует проверки)
|
|
44
|
-
*/
|
|
45
|
-
export declare function getToken(): TokenResult | null;
|
|
46
|
-
/**
|
|
47
|
-
* Генерирует сообщение об ошибке отсутствия токена
|
|
48
|
-
*/
|
|
49
|
-
export declare function getTokenNotFoundError(): string;
|
|
50
|
-
/**
|
|
51
|
-
* GitVerse API клиент для создания релизов
|
|
52
|
-
*/
|
|
53
|
-
export declare class GitVerseReleaseClient {
|
|
54
|
-
private client;
|
|
55
|
-
private repoInfo;
|
|
56
|
-
private retryFn?;
|
|
57
|
-
constructor(token: string, repoInfo: GitRepoInfo, retryFn?: RetryFunction);
|
|
58
|
-
/**
|
|
59
|
-
* Проверяет валидность токена через API
|
|
60
|
-
*/
|
|
61
|
-
validateToken(): Promise<TokenValidationResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Создает релиз на GitVerse
|
|
64
|
-
*/
|
|
65
|
-
createRelease(tag: string, name: string, body: string, options?: {
|
|
66
|
-
draft?: boolean;
|
|
67
|
-
prerelease?: boolean;
|
|
68
|
-
}): Promise<string>;
|
|
69
|
-
/**
|
|
70
|
-
* Проверяет существование релиза по тегу
|
|
71
|
-
*/
|
|
72
|
-
releaseExists(tag: string): Promise<boolean>;
|
|
73
|
-
/**
|
|
74
|
-
* Получает информацию о релизе по тегу
|
|
75
|
-
*/
|
|
76
|
-
getRelease(tag: string): Promise<import("@onreza/gitverse-sdk").Release>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Создает клиент для работы с GitVerse API
|
|
80
|
-
* Примечание: validateGitVerseToken() должен быть вызван до этой функции
|
|
81
|
-
* для проверки токена и вывода deprecation warnings
|
|
82
|
-
*/
|
|
83
|
-
export declare function createGitVerseClient(repoInfo: GitRepoInfo, retryFn?: RetryFunction): GitVerseReleaseClient;
|
|
84
|
-
/**
|
|
85
|
-
* Проверяет наличие и валидность токена до начала релиза
|
|
86
|
-
*
|
|
87
|
-
* @param repoInfo Информация о репозитории
|
|
88
|
-
* @returns Результат валидации токена
|
|
89
|
-
*/
|
|
90
|
-
export declare function validateGitVerseToken(repoInfo: GitRepoInfo): Promise<TokenValidationResult>;
|
|
91
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { BinariesConfig, BinaryPackageResult, BinaryPlatform } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Генерирует package.json для платформенного пакета
|
|
4
|
-
*/
|
|
5
|
-
export declare function generatePlatformPackageJson(config: BinariesConfig, platform: BinaryPlatform, version: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Генерирует README.md для платформенного пакета
|
|
8
|
-
*/
|
|
9
|
-
export declare function generatePlatformReadme(config: BinariesConfig, platform: BinaryPlatform, version: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Генерирует платформенный пакет.
|
|
12
|
-
* Поддерживает два формата входных данных:
|
|
13
|
-
* - "directory": бинарники в директориях (dist/name-platform/name)
|
|
14
|
-
* - "tar.gz": бинарники в tar.gz архивах (dist/name-platform.tar.gz)
|
|
15
|
-
*/
|
|
16
|
-
export declare function generatePlatformPackage(config: BinariesConfig, platform: BinaryPlatform, version: string, dryRun?: boolean): Promise<BinaryPackageResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Генерирует все платформенные пакеты
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateAllPlatformPackages(config: BinariesConfig, version: string, platforms?: BinaryPlatform[], dryRun?: boolean): Promise<BinaryPackageResult[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Печатает информацию о генерации в dry-run режиме
|
|
23
|
-
*/
|
|
24
|
-
export declare function printGenerationDryRun(config: BinariesConfig, version: string, platforms: BinaryPlatform[]): void;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { BinariesConfig, BinaryPackageResult, BinaryPlatform, BinaryPublishResult } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Вычисляет задержку с экспоненциальным backoff.
|
|
4
|
-
*
|
|
5
|
-
* Формула: delay = initialDelay * 2^attempt, ограничено maxDelay.
|
|
6
|
-
*
|
|
7
|
-
* Примеры (с дефолтными параметрами):
|
|
8
|
-
* - attempt 0: 2000ms
|
|
9
|
-
* - attempt 1: 4000ms
|
|
10
|
-
* - attempt 2: 8000ms
|
|
11
|
-
* - attempt 3: 16000ms
|
|
12
|
-
* - attempt 4+: 30000ms (max)
|
|
13
|
-
*
|
|
14
|
-
* @param attempt - Номер попытки (начиная с 0)
|
|
15
|
-
* @param initialDelay - Начальная задержка в мс (default: 2000)
|
|
16
|
-
* @param maxDelay - Максимальная задержка в мс (default: 30000)
|
|
17
|
-
* @returns Задержка в миллисекундах
|
|
18
|
-
*/
|
|
19
|
-
export declare function calculateDelay(attempt: number, initialDelay?: number, maxDelay?: number): number;
|
|
20
|
-
/**
|
|
21
|
-
* Проверяет, можно ли повторить операцию после ошибки.
|
|
22
|
-
*
|
|
23
|
-
* Retriable ошибки (временные, имеет смысл повторить):
|
|
24
|
-
* - Сетевые ошибки: network timeout, ECONNRESET, ETIMEDOUT
|
|
25
|
-
* - Ограничения rate limit: HTTP 429, HTTP 503
|
|
26
|
-
* - Временные ошибки npm registry: registry unavailable, ETARGET
|
|
27
|
-
*
|
|
28
|
-
* Не-retriable ошибки (постоянные, повторять бессмысленно):
|
|
29
|
-
* - Ошибки авторизации (401, 403)
|
|
30
|
-
* - Невалидные данные (400)
|
|
31
|
-
* - Пакет уже существует (409)
|
|
32
|
-
* - Ошибки файловой системы
|
|
33
|
-
*
|
|
34
|
-
* @param error - Любое значение ошибки
|
|
35
|
-
* @returns true если ошибка носит временный характер и retry может помочь
|
|
36
|
-
*/
|
|
37
|
-
export declare function isRetriableError(error: unknown): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Публикует один платформенный пакет
|
|
40
|
-
*/
|
|
41
|
-
export declare function publishPlatformPackage(config: BinariesConfig, platform: BinaryPlatform, version: string, dryRun?: boolean): Promise<BinaryPublishResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Публикует все платформенные пакеты
|
|
44
|
-
*/
|
|
45
|
-
export declare function publishAllPlatformPackages(config: BinariesConfig, version: string, generatedPackages: BinaryPackageResult[], dryRun?: boolean, verbose?: boolean): Promise<BinaryPublishResult[]>;
|
|
46
|
-
/**
|
|
47
|
-
* Печатает информацию о публикации в dry-run режиме
|
|
48
|
-
*/
|
|
49
|
-
export declare function printPublishDryRun(config: BinariesConfig, generatedPackages: BinaryPackageResult[]): void;
|
|
50
|
-
/**
|
|
51
|
-
* Печатает итоговую статистику публикации
|
|
52
|
-
*/
|
|
53
|
-
export declare function printPublishSummary(results: BinaryPublishResult[], _config: BinariesConfig): void;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { BinariesConfig, BinaryPlatform } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Генерирует JS wrapper скрипт для bin/
|
|
4
|
-
*/
|
|
5
|
-
export declare function generateBinaryWrapper(config: BinariesConfig): string;
|
|
6
|
-
/**
|
|
7
|
-
* Интерфейс для optionalDependencies
|
|
8
|
-
*/
|
|
9
|
-
export interface OptionalDependencies {
|
|
10
|
-
[key: string]: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Генерирует объект optionalDependencies для основного package.json
|
|
14
|
-
*/
|
|
15
|
-
export declare function generateOptionalDependencies(config: BinariesConfig, version: string, platforms?: BinaryPlatform[]): OptionalDependencies;
|
|
16
|
-
/**
|
|
17
|
-
* Обновления для основного package.json
|
|
18
|
-
*/
|
|
19
|
-
export interface MainPackageUpdates {
|
|
20
|
-
optionalDependencies: OptionalDependencies;
|
|
21
|
-
bin?: Record<string, string>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Генерирует обновления для основного package.json
|
|
25
|
-
*/
|
|
26
|
-
export declare function generateMainPackageUpdates(config: BinariesConfig, version: string, platforms?: BinaryPlatform[]): MainPackageUpdates;
|
|
27
|
-
/**
|
|
28
|
-
* Обновляет основной package.json с optionalDependencies
|
|
29
|
-
*/
|
|
30
|
-
export declare function updateMainPackageJson(packagePath: string, config: BinariesConfig, version: string, platforms?: BinaryPlatform[], dryRun?: boolean): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Печатает информацию об обновлениях main package в dry-run режиме
|
|
33
|
-
*/
|
|
34
|
-
export declare function printMainPackageUpdatesDryRun(config: BinariesConfig, version: string, platforms?: BinaryPlatform[]): void;
|