semver
semver copied to clipboard
🐞 `postTargets` don't trigger target dependencies
postTargets
should work just like targets which are run using nx run
meaning that they should follow the targetDependencies
described in nx.json
.
IMHO, @nrwl/devkit
's runExecutor()
should trigger target dependencies but it doesn't. Cf. https://github.com/nrwl/nx/issues/7560
If this isn't fixed in @nrwl/devkit
, we have to figure out a workaround like running nx run
like we run any other command.
I'm currently having this problem at https://github.com/nidomiro/ts-tools. My first try of a 'workaround' is to add the dependency-target, in my case the build target, at the top of the postTargets. Is there an easy way to call the build target with an extra parameter like '--production'?
My current workaround looks like this: https://github.com/nidomiro/ts-tools/commit/de6a73b2dde54f4a1913bbab589e41b3407fb7f4
I'm having the same problem. I want to execute a build in the postTargets. postTargets seem to ignore dependencies, it does not matter, if they are defined as dependsOn or in nx.json as targetDependencies. also the "built-in" dependencies for the build-target is ignored.
"version": {
"executor": "@jscutlery/semver:version",
"options": {
"allowEmptyRelease": true,
"preset": "conventional",
"trackDeps": true,
"commitMessageFormat": "chore(${projectName}): release version ${version}",
"postTargets": [
"my-lib:build",
"my-lib:publish",
"my-lib:release"
]
}
}
my-lib depends on my-other-lib, so I get an error:
Some of the project app-comm-lib's dependencies have not been built yet. Please build these libraries before:
- my-other-lib
Error: Some dependencies of 'my-lib' have not been built. This probably due to the build target being misconfigured.
My work around is to define this dependency in nx.json for the version-target, so the cli handles the dependency (builds depending-on libs before versioning):
"targetDependencies": {
"version": [
{
"target": "build",
"projects": "dependencies"
}
]
},
Im having the same problem, seems like this can solve it for the moment.
"targetDefaults": {
"release": {
"dependsOn": ["^build"]
}
}