Skip to content

Commit 916156d

Browse files
committed
feat(calendar): add cli-args and config schema for calver-scheme
1 parent 4b5139d commit 916156d

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

__snapshots__/cli.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ Options:
218218
[string]
219219
--date-format format in strftime format for updating dates
220220
[string]
221+
--calver-scheme CalVer scheme format for calendar versioning
222+
(e.g., YYYY.0M.MICRO) [string]
221223
--label comma-separated list of labels to add to
222224
from release PR
223225
[default: "autorelease: pending"]

schemas/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@
127127
"description": "Date format given as a strftime expression for the generic strategy.",
128128
"type": "string"
129129
},
130+
"calver-scheme": {
131+
"description": "CalVer scheme format for calendar versioning (e.g., YYYY.0M.MICRO).",
132+
"type": "string"
133+
},
130134
"extra-files": {
131135
"description": "Specify extra generic files to replace versions.",
132136
"type": "array",
@@ -481,6 +485,7 @@
481485
"always-update": true,
482486
"tag-separator": true,
483487
"date-format": true,
488+
"calver-scheme": true,
484489
"extra-files": true,
485490
"version-file": true,
486491
"snapshot-label": true,

src/factories/versioning-strategy-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface VersioningStrategyFactoryOptions {
3232
prereleaseType?: string;
3333
prerelease?: boolean;
3434
dateFormat?: string;
35+
calverScheme?: string;
3536
github: GitHub;
3637
}
3738

src/manifest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export interface ReleaserConfig {
124124
extraLabels?: string[];
125125
initialVersion?: string;
126126
dateFormat?: string;
127+
calverScheme?: string;
127128

128129
// Changelog options
129130
changelogSections?: ChangelogSection[];
@@ -187,6 +188,7 @@ interface ReleaserConfigJson {
187188
'initial-version'?: string;
188189
'exclude-paths'?: string[]; // manifest-only
189190
'date-format'?: string;
191+
'calver-scheme'?: string;
190192
}
191193

192194
export interface ManifestOptions {
@@ -212,6 +214,7 @@ export interface ManifestOptions {
212214
commitSearchDepth?: number;
213215
logger?: Logger;
214216
dateFormat?: string;
217+
calverScheme?: string;
215218
}
216219

217220
export interface ReleaserPackageConfig extends ReleaserConfigJson {
@@ -1407,6 +1410,7 @@ function extractReleaserConfig(
14071410
initialVersion: config['initial-version'],
14081411
excludePaths: config['exclude-paths'],
14091412
dateFormat: config['date-format'],
1413+
calverScheme: config['calver-scheme'],
14101414
};
14111415
}
14121416

@@ -1767,6 +1771,7 @@ function mergeReleaserConfig(
17671771
extraLabels: pathConfig.extraLabels ?? defaultConfig.extraLabels,
17681772
excludePaths: pathConfig.excludePaths ?? defaultConfig.excludePaths,
17691773
dateFormat: pathConfig.dateFormat ?? defaultConfig.dateFormat,
1774+
calverScheme: pathConfig.calverScheme ?? defaultConfig.calverScheme,
17701775
};
17711776
}
17721777

src/updaters/release-please-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ function releaserConfigToJsonConfig(
8484
'version-file': config.versionFile,
8585
'snapshot-label': config.snapshotLabels?.join(','), // Java-only
8686
'date-format': config.dateFormat,
87+
'calver-scheme': config.calverScheme,
8788
};
8889
return jsonConfig;
8990
}

0 commit comments

Comments
 (0)