Skip to content

fix: generate correct changelogs when doing a PR #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2024
Merged

Conversation

Nemikolh
Copy link
Member

@Nemikolh Nemikolh commented Jul 3, 2024

This PR fix the changelog generation so that it when we do pnpm changelog it generate the changelog for every packages, in particular the CLI. The previous release PR didn't had the changelog for the CLI because we are bumping the CLI at a later point.

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@Nemikolh Nemikolh requested a review from AriPerkkio July 3, 2024 19:57
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tested locally and seems to work nicely.

$ pnpm --recursive --filter "@tutorialkit/*" exec pnpm version --no-git-tag-version --allow-same-version 0.0.1

v0.0.1
v0.0.1
v0.0.1
v0.0.1
v0.0.1

$ pnpm changelog

UPDATED packages/runtime/CHANGELOG.md 0.0.1
UPDATED packages/cli/CHANGELOG.md 0.0.1
UPDATED packages/astro/CHANGELOG.md 0.0.1
UPDATED packages/components/react/CHANGELOG.md 0.0.1
UPDATED packages/theme/CHANGELOG.md 0.0.1
UPDATED packages/types/CHANGELOG.md 0.0.1
UPDATED packages/create-tutorial/CHANGELOG.md 0.0.1-alpha.23
UPDATED CHANGELOG.md 0.0.1

$ git status

modified:   CHANGELOG.md
modified:   packages/astro/CHANGELOG.md
modified:   packages/cli/CHANGELOG.md
modified:   packages/components/react/CHANGELOG.md
modified:   packages/runtime/CHANGELOG.md
modified:   packages/theme/CHANGELOG.md
modified:   packages/types/CHANGELOG.md


export class Package {
/**
* @param {PackageDefinition} pkg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be PackageConfiguration?

Suggested change
* @param {PackageDefinition} pkg
* @param {PackageConfiguration} pkg

To be able to reference that, let's move it into this file from changelog.mjs instead:

/**
 * @typedef {{
 *  path: string;
 *  excluded?: true;
 *  sameAs?: string;
 * }} PackageConfiguration A package in the monorepo to generate changelog for.
 */

export class Package {
  /**
   * @param {PackageConfiguration} pkg
   */

Then use it in changelog.mjs:

/**
 * @type {import('./changelog/Package.mjs').PackageConfiguration[]}
 */
const PACKAGES = [
  { path: './packages/astro' },
  ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is nice! Thanks 😃

import fs from 'node:fs';
import addStream from 'add-stream';
import chalk from 'chalk';
import conventionalChangelog from 'conventional-changelog';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI the package I mentioned earlier: https://github.com/antfu/changelogithub. It creates changelogs like https://github.com/unocss/unocss/releases/tag/v0.39.0.

@Nemikolh Nemikolh merged commit 8b8b1ca into main Jul 4, 2024
8 checks passed
@Nemikolh Nemikolh deleted the joan/fix-changelog branch July 4, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants