gitverse-release 3.6.0 → 3.7.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/types.d.ts CHANGED
@@ -584,6 +584,10 @@ export interface GenerateCommitlintOptions {
584
584
  * Поддерживаемые платформы для бинарной дистрибуции
585
585
  */
586
586
  export type BinaryPlatform = "linux-x64" | "linux-arm64" | "darwin-x64" | "darwin-arm64" | "win32-x64" | "win32-arm64";
587
+ /**
588
+ * Формат входных данных для бинарников
589
+ */
590
+ export type BinaryInputFormat = "directory" | "tar.gz";
587
591
  /**
588
592
  * Допустимые значения для поля os в package.json
589
593
  */
@@ -622,8 +626,22 @@ export interface BinariesConfig {
622
626
  enabled: boolean;
623
627
  /**
624
628
  * npm scope (например: @rainypixel)
629
+ * Опционален — если не указан, пакеты публикуются без scope
630
+ */
631
+ scope?: string;
632
+ /**
633
+ * Шаблон имени пакета
634
+ * Плейсхолдеры: {{scope}}, {{name}}, {{platform}}
635
+ *
636
+ * @default "{{name}}-{{platform}}" (без scope)
637
+ * @default "@{{scope}}/{{name}}-{{platform}}" (со scope)
638
+ *
639
+ * @example
640
+ * "{{name}}-{{platform}}" → "myapp-linux-x64"
641
+ * "@{{scope}}/{{name}}-{{platform}}" → "@org/myapp-linux-x64"
642
+ * "{{name}}-bin-{{platform}}" → "myapp-bin-linux-x64"
625
643
  */
626
- scope: string;
644
+ packageNameTemplate?: string;
627
645
  /**
628
646
  * Базовое имя пакетов (например: yougile)
629
647
  */
@@ -669,6 +687,31 @@ export interface BinariesConfig {
669
687
  * @default 3
670
688
  */
671
689
  retryAttempts: number;
690
+ /**
691
+ * Формат входных данных для бинарников
692
+ * - "directory": бинарники в директориях (dist/name-platform/name)
693
+ * - "tar.gz": бинарники в tar.gz архивах (dist/name-platform.tar.gz)
694
+ * @default "directory"
695
+ */
696
+ inputFormat?: BinaryInputFormat;
697
+ /**
698
+ * Имя бинарника внутри архива (если отличается от name)
699
+ * Используется только при inputFormat: "tar.gz"
700
+ */
701
+ sourceBinName?: string;
702
+ /**
703
+ * Маппинг имён файлов/директорий источника на npm платформы
704
+ * Ключ - идентификатор в имени файла (например: "linux-x64")
705
+ * Значение - npm платформа (например: "linux-x64")
706
+ *
707
+ * @example
708
+ * {
709
+ * "linux-x64": "linux-x64",
710
+ * "darwin-arm64": "darwin-arm64",
711
+ * "windows-x64": "win32-x64"
712
+ * }
713
+ */
714
+ platformMap?: Record<string, BinaryPlatform>;
672
715
  }
673
716
  /**
674
717
  * Успешный результат генерации платформенного пакета
@@ -751,6 +794,25 @@ export interface BinaryDistributionResult {
751
794
  /** Предупреждения */
752
795
  warnings: string[];
753
796
  }
797
+ /**
798
+ * Успешный результат извлечения бинарника из архива
799
+ */
800
+ export interface BinaryExtractionSuccess {
801
+ success: true;
802
+ binaryPath: string;
803
+ tempDir: string;
804
+ }
805
+ /**
806
+ * Неуспешный результат извлечения бинарника из архива
807
+ */
808
+ export interface BinaryExtractionFailure {
809
+ success: false;
810
+ error: string;
811
+ }
812
+ /**
813
+ * Результат извлечения бинарника из архива (discriminated union)
814
+ */
815
+ export type BinaryExtractionResult = BinaryExtractionSuccess | BinaryExtractionFailure;
754
816
  /**
755
817
  * CLI опции для бинарной дистрибуции
756
818
  */
@@ -0,0 +1,19 @@
1
+ import type { BinariesConfig, BinaryExtractionResult, BinaryPlatform } from "../types";
2
+ /**
3
+ * Возвращает имя бинарника внутри архива с учётом sourceBinName.
4
+ * Если sourceBinName не задан, возвращает config.name.
5
+ */
6
+ export declare function getSourceBinaryName(config: BinariesConfig, platform: BinaryPlatform): string;
7
+ /**
8
+ * Извлекает бинарник из tar.gz архива во временную директорию.
9
+ *
10
+ * @param config - Конфигурация бинарной дистрибуции
11
+ * @param platform - Целевая платформа
12
+ * @param tempBaseDir - Базовая директория для временных файлов
13
+ * @returns Результат извлечения с путём к бинарнику и временной директории
14
+ */
15
+ export declare function extractBinaryFromArchive(config: BinariesConfig, platform: BinaryPlatform, tempBaseDir: string): Promise<BinaryExtractionResult>;
16
+ /**
17
+ * Удаляет временную директорию.
18
+ */
19
+ export declare function cleanupTempDir(tempDir: string): Promise<void>;
@@ -8,7 +8,10 @@ export declare function generatePlatformPackageJson(config: BinariesConfig, plat
8
8
  */
9
9
  export declare function generatePlatformReadme(config: BinariesConfig, platform: BinaryPlatform, version: string): string;
10
10
  /**
11
- * Генерирует платформенный пакет
11
+ * Генерирует платформенный пакет.
12
+ * Поддерживает два формата входных данных:
13
+ * - "directory": бинарники в директориях (dist/name-platform/name)
14
+ * - "tar.gz": бинарники в tar.gz архивах (dist/name-platform.tar.gz)
12
15
  */
13
16
  export declare function generatePlatformPackage(config: BinariesConfig, platform: BinaryPlatform, version: string, dryRun?: boolean): Promise<BinaryPackageResult>;
14
17
  /**
@@ -1,4 +1,4 @@
1
- import type { BinaryPlatform, PlatformMapping } from "../types";
1
+ import type { BinariesConfig, BinaryPlatform, PlatformMapping } from "../types";
2
2
  /**
3
3
  * Маппинг платформ на os/cpu значения для package.json
4
4
  */
@@ -36,13 +36,19 @@ export declare function validateBinaryExists(distDir: string, name: string, plat
36
36
  */
37
37
  export declare function validateAllBinaries(distDir: string, name: string, platforms: BinaryPlatform[]): Promise<BinaryPlatform[]>;
38
38
  /**
39
- * Генерирует полное имя пакета для платформы
39
+ * Возвращает дефолтный шаблон имени пакета
40
40
  */
41
- export declare function getPackageName(scope: string, name: string, platform: BinaryPlatform): string;
41
+ export declare function getDefaultPackageNameTemplate(scope?: string): string;
42
42
  /**
43
- * Генерирует путь к пакету в output директории
43
+ * Генерирует полное имя пакета для платформы.
44
+ * Поддерживает кастомный шаблон через packageNameTemplate.
44
45
  */
45
- export declare function getPackageOutputPath(outDir: string, scope: string, name: string, platform: BinaryPlatform): string;
46
+ export declare function getPackageName(config: BinariesConfig, platform: BinaryPlatform): string;
47
+ /**
48
+ * Генерирует путь к пакету в output директории.
49
+ * Создаёт структуру директорий на основе имени пакета.
50
+ */
51
+ export declare function getPackageOutputPath(config: BinariesConfig, platform: BinaryPlatform): string;
46
52
  /**
47
53
  * Раскрывает плейсхолдеры в строке
48
54
  */
@@ -60,3 +66,40 @@ export declare function platformToNodeValues(platform: BinaryPlatform): {
60
66
  platform: string;
61
67
  arch: string;
62
68
  };
69
+ /**
70
+ * Возвращает ключ источника для платформы с учётом platformMap.
71
+ * Если platformMap не задан или платформа не найдена, возвращает платформу как есть.
72
+ */
73
+ export declare function getSourceKey(config: BinariesConfig, platform: BinaryPlatform): string;
74
+ /**
75
+ * Возвращает путь к tar.gz архиву для указанной платформы.
76
+ */
77
+ export declare function getArchivePath(config: BinariesConfig, platform: BinaryPlatform): string;
78
+ /**
79
+ * Проверяет существование tar.gz архива для платформы.
80
+ *
81
+ * @returns true если архив существует, false если не найден (ENOENT)
82
+ * @throws Error при других ошибках доступа
83
+ */
84
+ export declare function validateArchiveExists(config: BinariesConfig, platform: BinaryPlatform): Promise<boolean>;
85
+ /**
86
+ * Универсальная проверка существования источника бинарника.
87
+ * Поддерживает как директории, так и tar.gz архивы.
88
+ *
89
+ * @returns true если источник существует, false если не найден
90
+ * @throws Error при других ошибках доступа
91
+ */
92
+ export declare function validateBinarySourceExists(config: BinariesConfig, platform: BinaryPlatform): Promise<boolean>;
93
+ /**
94
+ * Универсальная валидация наличия источников бинарников для всех платформ.
95
+ * Поддерживает как директории, так и tar.gz архивы.
96
+ *
97
+ * @returns Массив отсутствующих платформ
98
+ */
99
+ export declare function validateAllBinarySources(config: BinariesConfig): Promise<BinaryPlatform[]>;
100
+ /**
101
+ * Возвращает путь к источнику бинарника с учётом формата входных данных.
102
+ * Для directory возвращает путь к директории платформы.
103
+ * Для tar.gz возвращает путь к архиву.
104
+ */
105
+ export declare function getBinarySourcePath(config: BinariesConfig, platform: BinaryPlatform): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitverse-release",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Conventional Commits release automation tool for GitVerse",
5
5
  "keywords": [
6
6
  "gitverse",
@@ -48,7 +48,8 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "gitverse-api-sdk": "5.2.0",
51
- "jsonc-parser": "^3.3.1"
51
+ "jsonc-parser": "^3.3.1",
52
+ "tar": "^7.5.3"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@types/bun": "1.3.6",
package/schema.json CHANGED
@@ -12,13 +12,13 @@
12
12
  "continueOnError": false,
13
13
  "distDir": "./dist",
14
14
  "enabled": false,
15
+ "inputFormat": "directory",
15
16
  "mainPackage": "./package.json",
16
17
  "name": "",
17
18
  "outDir": "./npm",
18
19
  "platforms": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64"],
19
20
  "publishCommand": "npm publish --access public",
20
- "retryAttempts": 3,
21
- "scope": ""
21
+ "retryAttempts": 3
22
22
  },
23
23
  "description": "Binary distribution settings for publishing platform-specific npm packages",
24
24
  "properties": {
@@ -41,6 +41,12 @@
41
41
  "description": "Enable binary distribution",
42
42
  "type": "boolean"
43
43
  },
44
+ "inputFormat": {
45
+ "default": "directory",
46
+ "description": "Input format for binaries. 'directory' expects binaries in dist/name-platform/name, 'tar.gz' expects archives in dist/name-platform.tar.gz",
47
+ "enum": ["directory", "tar.gz"],
48
+ "type": "string"
49
+ },
44
50
  "mainPackage": {
45
51
  "default": "./package.json",
46
52
  "description": "Path to main package.json for updating optionalDependencies",
@@ -55,6 +61,19 @@
55
61
  "description": "Output directory for generated npm packages",
56
62
  "type": "string"
57
63
  },
64
+ "packageNameTemplate": {
65
+ "description": "Template for package names. Placeholders: {{scope}}, {{name}}, {{platform}}. Default: '{{name}}-{{platform}}' (without scope) or '@{{scope}}/{{name}}-{{platform}}' (with scope)",
66
+ "examples": ["{{name}}-{{platform}}", "@{{scope}}/{{name}}-{{platform}}", "{{name}}-bin-{{platform}}"],
67
+ "type": "string"
68
+ },
69
+ "platformMap": {
70
+ "additionalProperties": {
71
+ "enum": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64", "win32-arm64"],
72
+ "type": "string"
73
+ },
74
+ "description": "Mapping of source file keys to npm platforms. Keys are identifiers in archive names (e.g., 'linux-x64'), values are npm platforms",
75
+ "type": "object"
76
+ },
58
77
  "platforms": {
59
78
  "default": ["linux-x64", "linux-arm64", "darwin-x64", "darwin-arm64", "win32-x64"],
60
79
  "description": "Platforms to publish",
@@ -78,7 +97,11 @@
78
97
  "type": "integer"
79
98
  },
80
99
  "scope": {
81
- "description": "npm scope for platform packages (e.g., '@rainypixel')",
100
+ "description": "npm scope for platform packages (e.g., '@rainypixel'). Optional - if not set, packages are published without scope",
101
+ "type": "string"
102
+ },
103
+ "sourceBinName": {
104
+ "description": "Binary name inside archive (if different from 'name'). Used only with inputFormat: 'tar.gz'",
82
105
  "type": "string"
83
106
  }
84
107
  },