Skip to content

Commit 7b9f07d

Browse files
committed
fix(release): adjust publish error message and version schema
1 parent 3f5fd89 commit 7b9f07d

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

e2e/release/src/private-js-packages.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ describe('nx release - private JS packages', () => {
206206
207207
- {private-project-name}
208208
209-
This is usually caused by not having an appropriate plugin, such as "@nx/js" installed, which will add the appropriate "nx-release-publish" target for you automatically.
210-
209+
This is usually caused by either
210+
- not having an appropriate plugin, such as "@nx/js" installed, which will add the appropriate "nx-release-publish" target for you automatically
211+
- having "private": true set in your package.json, which prevents the target from being created
212+
211213
Pass --verbose to see the stacktrace.
212214
213215

packages/nx/schemas/nx-schema.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,28 @@
745745
"manifestRootsToUpdate": {
746746
"type": "array",
747747
"items": {
748-
"type": "string"
748+
"oneOf": [
749+
{
750+
"type": "string",
751+
"description": "Path to the directory containing manifest files to update. Supports placeholders like {projectRoot} and {projectName}."
752+
},
753+
{
754+
"type": "object",
755+
"properties": {
756+
"path": {
757+
"type": "string",
758+
"description": "Path to the directory containing manifest files to update. Supports placeholders like {projectRoot} and {projectName}."
759+
},
760+
"preserveLocalDependencyProtocols": {
761+
"type": "boolean",
762+
"description": "Whether to preserve local dependency references using protocols like 'workspace:' or 'file:'. Set to false for dist files that need to be published.",
763+
"default": true
764+
}
765+
},
766+
"required": ["path"],
767+
"additionalProperties": false
768+
}
769+
]
749770
},
750771
"description": "A list of directories containing manifest files (such as package.json) to apply updates to when versioning. By default, only the project root will be used, but you could customize this to only version a manifest in a dist directory, or even version multiple manifests in different directories, such as both source and dist."
751772
},

packages/nx/src/command-line/release/publish.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ async function runPublishOnProjects(
257257
`Based on your config, the following projects were matched for publishing but do not have the "${requiredTargetName}" target specified:\n${[
258258
...projectsToRun.map((p) => `- ${p.name}`),
259259
'',
260-
`This is usually caused by not having an appropriate plugin, such as "@nx/js" installed, which will add the appropriate "${requiredTargetName}" target for you automatically.`,
260+
`This is usually caused by either`,
261+
`- not having an appropriate plugin, such as "@nx/js" installed, which will add the appropriate "${requiredTargetName}" target for you automatically`,
262+
`- having "private": true set in your package.json, which prevents the target from being created`,
261263
].join('\n')}\n`
262264
);
263265
}

0 commit comments

Comments
 (0)