Comments (8)
Hi @azat-io, currently is pending, because I waiting for those PR's to merge
from changelogen.
Are the values in workspaces in the config file the same as package.json workspaces ?
I think we might return an object from resolveWorkspace
like { root: '', type: '', workspaces: string[] }
Why there is this usecase? or user how to use that?
Subdir can be used by CLI to run changelog update against each package. Also manually by user to read config from root but update changeloges in a subdir only (even without workspace support)
I think there is another feature that can be implemented - "A filter for monorepos".
Here is the usecase:
We are using pnpm to manage a monorepo, but we only want to automatically generate changelogs for certain packages. Specifically, we need to generate changelogs for awesome-pkg, @awesome-pkg/core, and @awesome-pkg/shared, but not for playground or example.
Yes this also 👍🏼
from changelogen.
Configurable git commit template
I believe that this feature has been completed in this PR #68
from changelogen.
Expose a new
workspaces
config object (auto-detected withresolveWorkspace
from pkg-types)
Are the values in workspaces
in the config file the same as package.json workspaces ?
from changelogen.
A new
subDir
config defaulting to/
and when is set, filters commits only relevant to this subpath and also operatespackage.json
andCHANGELOG.md
in{rootDir}/{subDir}
for updating
Why there is this usecase? or user how to use that?
from changelogen.
I think there is another feature that can be implemented - "A filter for monorepos".
Here is the usecase:
We are using pnpm to manage a monorepo, but we only want to automatically generate changelogs for certain packages. Specifically, we need to generate changelogs for awesome-pkg
, @awesome-pkg/core
, and @awesome-pkg/shared
, but not for playground
or example
.
from changelogen.
Any progress?
Is it works with pnpm workspaces?
from changelogen.
Tips
To manage my monorepo versions and have the advantages of changelogen
(beautiful changelog and release publish to github), I use lerna
at first, and then I use changelogen
to generate and publish the changelog:
- Bump version without changelog generation with lerna:
lerna version
(lerna will bump the version in package.json files if needed, create a commit to push it, create and push the new tag). My lerna config bellow - Then, generate the new changelog with
changelogen
in a custom script, amend the previous commit of lerna and push it to github to create a new release. Script bellow.
lerna.json
{
"loglevel": "verbose",
"version": "0.47.26",
"yes": true,
"command": {
"version": {
"allowBranch": ["master"],
"message": "chore(release): bump version %v",
"conventionalCommits": true,
"forceGitTag": false,
"changelog": false,
"push": true,
"gitTagVersion": true,
"tagVersionPrefix": "v",
"commitHooks": true
}
},
"npmClient": "pnpm",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
``
import { exec } from 'node:child_process'
import { existsSync, promises as fsp } from 'node:fs'
import { generateMarkDown, getGitDiff, parseCommits, loadChangelogConfig, syncGithubRelease } from 'changelogen'
async function execPromise(command: string): Promise<{ stdout: string; stderr: string }> {
return await new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`🔴 [cli](${command}) Execution failed - ${error.message}.`)
reject(error)
} else {
resolve({ stdout, stderr })
}
})
})
}
async function updateChangelog() {
const { stdout: lastTag } = await execPromise("git tag --sort=-v:refname | sed -n '1p'")
const { stdout: penultimateTag } = await execPromise("git tag --sort=-v:refname | sed -n '2p'")
const lastTagTrimed = lastTag.trim()
const penultimateTagTrimed = penultimateTag.trim()
const config = await loadChangelogConfig(process.cwd(), {
from: penultimateTagTrimed,
to: lastTagTrimed,
})
const rawCommits = await getGitDiff(penultimateTagTrimed, lastTagTrimed)
const commits = parseCommits(rawCommits, config).filter((commit) => {
return (
config.types[commit.type] &&
!(commit.type === 'chore' && (commit.scope === 'deps' || commit.scope === 'release') && !commit.isBreaking)
)
})
const newChangelog = await generateMarkDown(commits, config)
let changelogMD: string
if (typeof config.output === 'string' && existsSync(config.output)) {
changelogMD = await fsp.readFile(config.output, 'utf8')
} else {
changelogMD = '# Changelog\n\n'
}
const lastEntry = changelogMD.match(/^###?\s+.*$/m)
if (lastEntry) {
changelogMD = changelogMD.slice(0, lastEntry.index) + newChangelog + '\n\n' + changelogMD.slice(lastEntry.index)
} else {
changelogMD += '\n' + newChangelog + '\n\n'
}
await fsp.writeFile(config.output as string, changelogMD)
const changelogWithoutTitle = newChangelog.split('\n').slice(2).join('\n')
console.log(changelogWithoutTitle)
await execPromise(`git add -u`)
await execPromise(`git commit --amend --no-edit`)
await execPromise(`git push origin HEAD --force`)
try {
await syncGithubRelease(config, {
version: lastTagTrimed.replace('v', ''),
body: changelogWithoutTitle,
})
console.log('Release pushed to GitHub.')
} catch (error: any) {
console.error('error', error)
}
}
updateChangelog()
package.json
{
"scripts": {
"release": "pnnp release:bump-version && pnpm release:changelogen",
"release:bump-version": "lerna version",
"release:changelogen": "ts-node ./changelog-generate.ts"
},
}
You have to run
pnpm release
from changelogen.
Related Issues (20)
- extra space in Contributors title HOT 2
- Implement `--release --no-bump` options HOT 6
- [feature request] "changeset" support
- postchecks to verify release
- Auto bump version for monorepo packages HOT 1
- Raw commit emoji support
- Docs: example of how to create version like "v1.0.0-beta.0" HOT 1
- Allow Custom Titles HOT 1
- commits prefixed with "chore(deps)" are ignored in changelog HOT 1
- [cli] Support `--nightly` flag
- Handle when git repo is fetched without history / no commits
- Add the possibility to only generate the changelog and publish it on Github without bumping the version
- How to add package name to tag? HOT 3
- `package.json` conflicting with `eol-last` eslint rule HOT 7
- Hide contributors
- Use commit body to generate additional changelog entries
- introduce "GitLab Self Managed" in providerToDomain
- Hope to support changelog.md generation annually or every month or every week
- CI succeeds although `npm publish` did not
- Group commit messages by scope
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from changelogen.