Open or-orchid opened 1 month ago
Please share your nx.json
contents and any "release"
or "nx-release-publish"
config found in project.json
files
@JamesHenry Hey,attached
{
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": true
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"extends": "nx/presets/npm.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": []
},
"defaultBase": "main",
"plugins": [
{
"plugin": "@nx/eslint/plugin",
"options": {
"targetName": "lint"
}
},
{
"plugin": "@nx/jest/plugin",
"options": {
"targetName": "test"
},
"exclude": ["test-e2e/**/*", "apps/test-e2e/**/*"]
},
{
"plugin": "@nx/webpack/plugin",
"options": {
"buildTargetName": "build",
"serveTargetName": "serve",
"previewTargetName": "preview"
}
}
],
"targetDefaults": {
"@nx/js:tsc": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/{projectRoot}",
"tsConfig": "{projectRoot}/tsconfig.lib.json",
"packageJson": "{projectRoot}/package.json",
"main": "{projectRoot}/src/index.ts"
}
},
"@nx/js:eslint": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["default", "^default"],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"{projectRoot}/**/*.{ts,tsx,js,jsx}",
"{projectRoot}/package.json"
]
}
},
"@nx/jest:jest": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["default", "^default"],
"outputs": ["{options.outputFile}"],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts"
}
},
"@nx/js:swc": {
"dependsOn": ["^build"],
"cache": true,
"inputs": ["production", "^production"],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/{projectRoot}",
"main": "{projectRoot}/src/index.ts",
"tsConfig": "{projectRoot}/tsconfig.lib.json",
"assets": []
}
},
"install": {
"inputs": ["{projectRoot}/package.json"],
"outputs": [
"{projectRoot}/node_modules",
"{projectRoot}/package-lock.json"
],
"executor": "nx:run-commands",
"options": {
"command": "npm install",
"cwd": "{projectRoot}"
}
},
"ci": {
"inputs": [
"{projectRoot}/package.json",
"{projectRoot}/package-lock.json"
],
"outputs": ["{projectRoot}/node_modules"],
"executor": "nx:run-commands",
"options": {
"command": "npm ci",
"cwd": "{projectRoot}"
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
}
},
"release": {
"projects": ["*", "!source"],
"projectsRelationship": "independent",
"releaseTagPattern": "{projectName}/v{version}",
"version": {
"preVersionCommand": "npx nx run-many -t build",
"generatorOptions": {
"packageRoot": "{projectRoot}",
"skipLockFileUpdate": false,
"fallbackCurrentVersionResolver": "disk"
},
"conventionalCommits": true
},
"git": {
"commitMessage": "chore: release [skip ci]"
},
"changelog": {
"automaticFromRef": true,
"projectChangelogs": true,
"workspaceChangelog": false
}
},
"tasksRunnerOptions": {
"default": {
"options": {
"cacheableOperations": []
}
},
"ci": {
"runner": "@nx-aws-plugin/nx-aws-cache",
"options": {
"cacheableOperations": [],
"awsRegion": "eu-central-1",
"awsForcePathStyle": true
}
},
"local": {
"runner": "@nx-aws-plugin/nx-aws-cache",
"options": {
"cacheableOperations": [],
"awsRegion": "eu-central-1",
"awsForcePathStyle": true
}
}
}
}
as for project.json
, there isn't any release
or nx-release-publish
config found there.
Also according to the error message above, nx/js
plugin should inject the nx-release-publish
config to the project.json automatically
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.
This code should handle it for package.json
based libs. I can't find the equivalent for project.json
https://github.com/nrwl/nx/blob/b91d78809e9ef88744fefa90b66903216f134ba3/packages/nx/src/utils/package-json.ts#L186
@or-orchid are you saying that those libraries do not have a package.json file in their project root?
@JamesHenry This is our dir structure
.
├── README.md
├── commitlint.config.ts
├── jest.config.ts
├── jest.preset.js
├── libs
│ ├── redis
│ │ ├── CHANGELOG.md
│ │ ├── jest.config.ts
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── project.json
│ │ ├── src
│ │ ├── tsconfig.json
│ │ ├── tsconfig.lib.json
│ │ └── tsconfig.spec.json
├── migrations.json
├── nx.json
├── package-lock.json
├── package.json
├── tsconfig.base.json
├── tsconfig.build.json
└── tsconfig.json
redis/package.json
{
"name": "@XXXXX/redis",
"repository": {
"type": "git",
"url": "https://github.com/XXXXXX/YYYYY.git"
},
"version": "0.3.3",
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"publishConfig": {
"access": "restricted"
},
"peerDependencies": {
"@nestjs/common": "^10.3.10",
"@nestjs/config": "^3.1.1"
},
"dependencies": {
"ioredis": "^5.4.0"
},
"devDependencies": {}
}
redis/project.json
{
"name": "redis",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/redis/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:swc"
},
"tsc": {
"executor": "@nx/js:tsc"
},
"lint": {
"dependsOn": ["ci"],
"executor": "@nx/eslint:lint"
},
"test": {
"dependsOn": ["ci"],
"executor": "@nx/jest:jest",
"options": {
"passWithNoTests": true
}
},
"install": {},
"ci": {}
}
}
This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Bump
This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
@or-orchid Sorry for the delay, but as you can appreciate, things always go much faster if you take the time to provide a minimal reproduction repo for us to investigate.
I am now taking the time to manually recreate the outline you have listed
What is the reason for having a nested lock file? Are you running a fully independent install command within that nested directory?
Are you not using npm workspaces? These two points make a big difference here so I cannot continue further.
If you can provide a minimal reproduction repo that will naturally be most time efficient, but otherwise please provide clear guidance on how your package management concerns are set up.
And a minimal repro: https://github.com/thdk/nx-repro-nx-release-publish-target-missing
Contains only a single project and configuration for nx release
in nx.json
.
Node : 22.2.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.8.0
nx : 19.6.5
@nx/js : 19.6.5
@nx/linter : 19.6.5
@nx/eslint : 19.6.5
@nx/workspace : 19.6.5
@nx/devkit : 19.6.5
@nx/eslint-plugin : 19.6.5
@nrwl/tao : 19.6.5
typescript : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
UPDATE: this repro didn't contain any library created with the --publishable
flag and therefor the release publish
command was failing with the error.
NX Your filter "tag:type:package" matched the following projects:
- some-lib
NX Based on your config, the following projects were matched for publishing but do not have the "nx-release-publish" target specified:
- some-lib
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.
@thdk Thank you for repro. In this case it’s because you have marked the library as private, which means it is not publishable, so there is correctly no associated target
@JamesHenry thanks for spotting the issue!
I actually used the interactive approach to generate the library and I haven't been prompted to tell if the generate library should be publishable or not. My bad here. Do you think it would make sense to at that options to the interactive prompts? I could try to submit a PR for that :)
I also encountered this issue and need help.
Current Behavior
After upgrading NX to 19.5.X, the publish command fails
Expected Behavior
Should publish libs
GitHub Repo
No response
Steps to Reproduce
nx release publish --dry-run --verbose
and see that the packages should be publishednx migrate 19.5.7
nx migrate --run-migrations --if-exists
nx release publish --dry-run --verbose
and see the errorsNx Report
Failure Logs
Package Manager Version
10.8.2
Operating System
Additional Information
I suspect it's related to this PR