Skip to content

Commit

Permalink
Merge pull request #12 from restfulhead/fix-version-in-changelog-title
Browse files Browse the repository at this point in the history
fix: missing version in changelog file
  • Loading branch information
restfulhead authored Feb 16, 2024
2 parents 08dc3c5 + a8aeb1c commit b1a15b1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
37 changes: 18 additions & 19 deletions packages/filter-by-workspace-path/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
# (Tue Feb 13 2024)
# v0.1.0 (Fri Feb 16 2024)

#### 🚀 Enhancement

- feat: omit commits that aren't related to a pull request [#9](https://github.com/restfulhead/npm-auto-plugins/pull/9) ([@restfulhead](https://github.com/restfulhead))

#### 📝 Documentation

- doc: provide more details about the merge commit issue [#8](https://github.com/restfulhead/npm-auto-plugins/pull/8) ([@restfulhead](https://github.com/restfulhead))

#### Authors: 1

- Patrick Ruhkopf ([@restfulhead](https://github.com/restfulhead))

---

# (Tue Feb 13 2024)
# v0.0.1 (Fri Feb 16 2024)

#### 🚀 Enhancement
#### 🐛 Patch

- chore: fix release [#30](https://github.com/restfulhead/npm-auto-plugins/pull/30) ([@restfulhead](https://github.com/restfulhead))
- fix: filter out commits in other ws dir with the same prefix [#5](https://github.com/restfulhead/npm-auto-plugins/pull/5) ([@restfulhead](https://github.com/restfulhead))

#### 🔩 Internal

- chore: prepare release [#32](https://github.com/restfulhead/npm-auto-plugins/pull/32) ([@restfulhead](https://github.com/restfulhead))
- chore: prepare release [#6](https://github.com/restfulhead/npm-auto-plugins/pull/6) ([@restfulhead](https://github.com/restfulhead))

#### Authors: 1

- Patrick Ruhkopf ([@restfulhead](https://github.com/restfulhead))

---

# (Mon Feb 12 2024)

#### 🚀 Enhancement

- fix: workflow and release [#25](https://github.com/restfulhead/npm-auto-plugins/pull/25) ([@restfulhead](https://github.com/restfulhead))
- fix: cleanup [#23](https://github.com/restfulhead/npm-auto-plugins/pull/23) ([@restfulhead](https://github.com/restfulhead))

#### 🐛 Patch

- fix: test and release workflow [#28](https://github.com/restfulhead/npm-auto-plugins/pull/28) ([@restfulhead](https://github.com/restfulhead))
- fix: hooks [#21](https://github.com/restfulhead/npm-auto-plugins/pull/21) ([@restfulhead](https://github.com/restfulhead))
# v0.0.1 (Tue Feb 13 2024)

#### 🔩 Internal

- chore: prepare release [#29](https://github.com/restfulhead/npm-auto-plugins/pull/29) ([@restfulhead](https://github.com/restfulhead))
- chore: prepare release [#27](https://github.com/restfulhead/npm-auto-plugins/pull/27) ([@restfulhead](https://github.com/restfulhead))
- chore: prepare release [#24](https://github.com/restfulhead/npm-auto-plugins/pull/24) ([@restfulhead](https://github.com/restfulhead))
- chore: prepare release [#4](https://github.com/restfulhead/npm-auto-plugins/pull/4) ([@restfulhead](https://github.com/restfulhead))
- refactor: renamed to follow auto's naming convention [#3](https://github.com/restfulhead/npm-auto-plugins/pull/3) ([@restfulhead](https://github.com/restfulhead))

#### Authors: 1

Expand Down
1 change: 0 additions & 1 deletion packages/filter-by-workspace-path/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ However, carefully read the following caveats section.
* have `[skip ci]` in their commit message
* This plugin modifies the behavior of `auto version`. By default, it seems to set the version to `patch` instead of `noVersion` even if all
commits were omitted. With this plugin, `noVersion` is returned if there are no relevant commits.
* While the title in the GitHub release notes is correct, the version is missing in the `CHANGELOG.md` file for currently unknown reasons
* You can't use the `shipit` command, because for example, the version in each package should only contain the version number
(e.g. `v1.0.0`), but the tag and Github release must include the package name to avoid ambigious release names/tags. Maybe this
customization can be added to the plugin in future. (Contributions welcome!)
Expand Down
14 changes: 12 additions & 2 deletions packages/filter-by-workspace-path/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { execSync } from 'child_process'
import * as path from 'path'
import { Auto, IExtendedCommit, ILogger, IPlugin, SEMVER } from '@auto-it/core'
import { Auto, IExtendedCommit, ILogger, IPlugin, SEMVER, inFolder } from '@auto-it/core'
import { inc, ReleaseType } from 'semver'

function shouldOmitCommit(currentDir: string, currentWorkspace: string, commit: IExtendedCommit, logger: ILogger): boolean {
if (!commit.pullRequest) {
Expand All @@ -11,7 +12,8 @@ function shouldOmitCommit(currentDir: string, currentWorkspace: string, commit:
const fixedFiles = commit.files.map((file) => path.relative(currentDir, file))
const wsDir = path.join(currentWorkspace, path.sep)

const atLeastOneFileInCurrentDir = fixedFiles.find((file) => file.startsWith(wsDir))
const atLeastOneFileInCurrentDir = fixedFiles.find((file) => inFolder(wsDir, file))

if (!atLeastOneFileInCurrentDir) {
logger.verbose.log(`All files are outside the current workspace directory ('${wsDir}'). Omitting commit '${commit.hash}'.`)
return true
Expand Down Expand Up @@ -53,6 +55,14 @@ export default class FilterByWorkspacePathPlugin implements IPlugin {
}
return origGetVersion(from, to)
}

release.calcNextVersion = async (lastTag: string) => {
const bump = await release.getSemverBump(lastTag)
const matches = lastTag.match(/(\d+\.\d+\.\d+)/)
const lastVersion = matches ? matches[0] : lastTag

return inc(lastVersion, bump as ReleaseType)
}
})
}
}

0 comments on commit b1a15b1

Please sign in to comment.