( config: string | undefined, plan: ReleasePlan, rootDir: string, )
| 8 | |
| 9 | /** Resolve the commit message from config, falling back to the default */ |
| 10 | export async function resolveCommitMessage( |
| 11 | config: string | undefined, |
| 12 | plan: ReleasePlan, |
| 13 | rootDir: string, |
| 14 | ): Promise<string> { |
| 15 | if (!config) return defaultCommitMessage(plan); |
| 16 | |
| 17 | // Paths starting with "./" or "../" are treated as module paths |
| 18 | if (config.startsWith('./') || config.startsWith('../')) { |
| 19 | const fnPath = resolve(rootDir, config); |
| 20 | const mod = await import(fnPath); |
| 21 | const fn = mod.default ?? mod; |
| 22 | if (typeof fn !== 'function') { |
| 23 | throw new Error(`versionCommitMessage module "${config}" must export a function`); |
| 24 | } |
| 25 | return fn(plan); |
| 26 | } |
| 27 | |
| 28 | // Otherwise it's a static message |
| 29 | return config; |
| 30 | } |
no test coverage detected
searching dependent graphs…