Comments (4)
@Badisi if your commit convention allows you to use other types than fix
or feat
you can configure your nx release command to ignore certain types of commits when the release command needs to determine the next version.
See the documentation here: https://nx.dev/recipes/nx-release/customize-conventional-commit-types
A change to non-projects files can always be affecting other projects. I believe this is a safe approach as it leaves it to the developer to use commit types such as chore
or test
to mark a commit to be 'hidden' in your changelog and not cause any version bump.
from nx.
@thdk, I'm using the default commit convention, nothing fancy here.
My real concern is that when using independent
mode and projectChangelogs
level, changelogs should only be scoped to a project level and not include any workspace changes.
And that's actually what the documentation says:
... they are generated for each project individually and only contain changes for that specific project ...
So in this particular scenario I completely disagree with you when you say that "a change to non-projects files can always be affecting other projects". The idea behind projectChangelogs
is purposely to ignore any changes that was made outside of a project scope and only include what was made inside it.
As for commit types such as chore
or test
, I agree they can help 'hide' a commit but it's just a dirty solution here and does not completely solves the problem. To err is human, and you can't depend on a developer always remembering to use the correct commit types to ensure proper scoping or exclusion within a project.
from nx.
I also found that there is an inconsistency in the way that commits are filtered for independent projects.
-
When resolving the
next semver version
, commits are filtered this way:
nx/packages/nx/src/command-line/release/utils/shared.ts
Lines 322 to 336 in 55197fb
-
When generating
changelog
, commits are filtered that way:
nx/packages/nx/src/command-line/release/changelog.ts
Lines 498 to 500 in 963f753
Even worse, when generating a changelog or github release, if useAutomaticFromRef
is not set, commits that will be used for the generation are... ALL commits (cf.getCommits
here).
This results in a changelog containing, for one individual project, every changes of every projects and even the workspace.
if (releaseGroup.projectsRelationship === 'independent') {
...
if (!fromRef && useAutomaticFromRef) {
const firstCommit = await getFirstGitCommit();
const allCommits = await getCommits(firstCommit, toSHA);
const commitsForProject = allCommits.filter((c) =>
c.affectedFiles.find((f) => f.startsWith(project.data.root))
);
...
}
...
if (!commits) {
commits = await getCommits(fromRef, toSHA); // <--- here, all commits will be used for the changelog generation
}
}
from nx.
Hey, I have a similar issue in my project. I am using projectChangelogs but without independent release.
In the index.js of the changelog renderer I did the following changes to fix my issue:
diff --git a/release/changelog-renderer/index.js b/release/changelog-renderer/index.js
index ca7ef3c27ea5c76819a85947a002d952285fd467..390254908990c04bfb5eb73b3dda18570b006302 100644
--- a/release/changelog-renderer/index.js
+++ b/release/changelog-renderer/index.js
@@ -75,8 +75,8 @@ const defaultChangelogRenderer = async ({ projectGraph, changes, releaseVersion,
}
else {
// project level changelog
- const relevantChanges = changes.filter((c) => c.affectedProjects &&
- (c.affectedProjects === '*' || c.affectedProjects.includes(project)));
+ // PATCH NOTE: removed the line === '*'. This way root level changes are not included in the project changelog.
+ const relevantChanges = changes.filter((c) => c.affectedProjects && c.affectedProjects.includes(project));
// Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
if (relevantChanges.length === 0) {
if (dependencyBumps?.length) {
from nx.
Related Issues (20)
- nestjs app is served with `--node-env=production`
- @nx/rspack react application does not load environment variables
- No update in Workspace References dependencies for `dist/<lib>/package.json` when using `conventional-commits` & projectsRelationship is `independent`, When only one lib is affected.
- Module Federation not working without barrel imports?
- Nx vite cannot load a vite plugin but the official scaffold loads the same plugin successfully
- bang in outputs does not work correctly
- esbuild should be a regular dependency, not a peerDependency, in @nx/angular
- New nextjs app fails when made from the nx/next CLI
- setupNodeEvents prevents Cypress from running. HOT 3
- eslint convert-to-inferred stopped working in 19.3
- Unable to use own libraries in e2e setup HOT 1
- Unable to npm install project dependencies on nx error HOT 10
- Error: ENOENT: no such file or directory" when moving/renaming projects
- NX daemon crashing due to OOM when generating project graph HOT 2
- Why is NX crashing out of my Application Support folder?
- NX format can't find path to prettier config HOT 3
- Running `nx reset` with WebStorm open fails HOT 2
- NX unable to rebuild project graph with more than ~ 250 libraries in the repo. HOT 1
- nx migrate latest fails with @ngrx/[email protected] HOT 1
- Vite plugin does not create serve, serve-static and preview targets anymore HOT 1
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 nx.