Skip to content
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

🐛 Can't find package version in CHANGELOG during dry runs #25

Open
unicornware opened this issue Sep 16, 2021 · 0 comments
Open

🐛 Can't find package version in CHANGELOG during dry runs #25

unicornware opened this issue Sep 16, 2021 · 0 comments
Assignees
Labels
status:wip work in progress type:fix bug reports and fixes

Comments

@unicornware
Copy link
Member

unicornware commented Sep 16, 2021

Description

If a project version is being bumped after v1.0.0, options.dryRun === true, and release notes are being generated from a project CHANGELOG, the notes lifecycle does not log the generated release notes.

Instead, an Exception is thrown because the new project version hasn't been written to the CHANGELOG, and therefore can not be found within the CHANGELOG content.

Steps to reproduce

  1. Run grease with options.dryRun === true in a project versioned after v1.0.0
  2. See error during notes lifecycle

Expected behavior

The notes lifecycle should not require a version argument if options.dryRun === true.

Relevant screenshots

grease output for @flex-development/log@2.0.0

notes-lifecycle-dry-run-version-error

Environment

  • Node Version: v16.6.0
  • OS: macOS v11.3.1
  • Package Manager: yarn@3.0.2
  • Package version(s): grease<=1.1.0

Possible solution

If possible, the notes lifecycle should tap into standard-version changelog lifecycle to use its options.dryRun output.

The changelog lifecycle could also be re-implemented in grease, but it may be difficult to keep track of future updates to standard-version. If it is re-implemented, however, the lifecycle signature could be updated and the return type could be changed to Promise<string>, where string is the new CHANGELOG entry, Promise<void>:

const Changelog: (
  options?: IGreaseOptions,
  newVersion?: NullishSemanticVersion
) => Promise<NullishString>

The notes lifecycle signature could also be updated:

const Notes: (
  options?: IGreaseOptions,
  changelog?: NullishString,
  version?: NullishSemanticVersion
) => Promise<NullishString>

Additional context

Exception origin in notes lifecycle

  // Search for package version in changelog content
  if (!versions.includes(version)) {
    const data = { errors: { version }, versions }
    const message = `${version} not found in ${options.infile}`

    throw new Exception(ExceptionStatusCode.NOT_FOUND, message, data)
  }
@unicornware unicornware added status:needs-triage needs further assessment type:fix bug reports and fixes scope:lifecycles labels Sep 16, 2021
@unicornware unicornware self-assigned this Sep 16, 2021
@unicornware unicornware changed the title 🐛 Can't find bumped package version in CHANGELOG during dry runs 🐛 Can't find package version in CHANGELOG during dry runs Sep 16, 2021
@unicornware unicornware added status:wip work in progress and removed status:needs-triage needs further assessment labels Sep 19, 2021
@unicornware unicornware moved this from 🆕 New to 📋 Backlog in @flex-development/grease Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:wip work in progress type:fix bug reports and fixes
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant