Skip to content

Commit

Permalink
fix(projects): fix changelog new version without date
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jun 5, 2023
1 parent 6f21797 commit 361388b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog


## [v0.5.0](https://github.com/soybeanjs/cli/compare/v0.4.2...main)
## [v0.5.0](https://github.com/soybeanjs/cli/compare/v0.4.2...v0.5.0) (2023-06-05)

### 🐞 Bug Fixes

Expand All @@ -15,6 +15,10 @@

- **projects**: Update CHANGELOG.md - by @soybeanjs [<samp>(94d6f)</samp>](https://github.com/soybeanjs/cli/commit/94d6f97)

### 🏡 Chore

- **projects**: Release v0.5.0 - by @soybeanjs [<samp>(44a9d)</samp>](https://github.com/soybeanjs/cli/commit/44a9d62)

### ❤️ Contributors

![soybeanjs](https://github.com/soybeanjs.png?size=48)
Expand Down
7 changes: 5 additions & 2 deletions src/changelog/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { existsSync } from 'fs';
import { readFile, writeFile } from 'fs/promises';
import dayjs from 'dayjs';
import { convert } from 'convert-gitmoji';
import { partition, groupBy, capitalize, join } from '../shared';
import type { Reference, GitCommit, ChangelogOption, AuthorInfo } from '../types';
Expand Down Expand Up @@ -132,9 +133,11 @@ export function generateMarkdown(params: {
const url = `https://github.com/${options.github}/compare/${options.from}...${options.to}`;

if (showTitle) {
const version = VERSION_REG.test(options.to) ? options.to : options.newVersion;
const isNewVersion = !VERSION_REG.test(options.to);

const date = options.tagDateMap.get(options.to);
const version = isNewVersion ? options.newVersion : options.to;

const date = isNewVersion ? dayjs().format('YY-MM-DD') : options.tagDateMap.get(options.to);

let title = `## [${version}](${url})`;

Expand Down

0 comments on commit 361388b

Please sign in to comment.