Open
Description
Current Behavior
I created a Node monorepo specifically to publish libraries. When publishing a library the tarball doesn't include source code files (.js files).
Note that:
- libraries are generated in a directory named
libs
- I'm using swc to transpile the TS files.
Expected Behavior
The tarball should include the source code.
GitHub Repo
https://github.com/rlmcneary2/bug-nx-publish
Steps to Reproduce
npx create-nx-workspace node-pub --preset node-monorepo --docker false --framework none
cd node-pub
npx nx g @nx/node:library libs/lib-test --compiler swc --linter eslint --publishable --unitTestRunner jest --importPath lib-test --strict true --testEnvironment node
npx nx build lib-test
npx nx release --first-release --dry-run
npx nx release publish --dry-run
Publish output
> nx run lib-test:nx-release-publish
📦 lib-test@X.X.X-dry-run
=== Tarball Contents ===
230B README.md
228B package.json
=== Tarball Details ===
name: lib-test
version: X.X.X-dry-run
filename: lib-test-X.X.X-dry-run.tgz
package size: 398 B
unpacked size: 458 B
shasum: 50a8271df0617ee1e04442e5051a9170c02b52a5
integrity: sha512-b7mMs/VaZMz7u[...]hyj4YNPDNrziw==
total files: 2
Would publish to https://registry.npmjs.org/ with tag "latest", but [dry-run] was set
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target nx-release-publish for project lib-test
Nx Report
NX Report complete - copy this into the issue template
Node : 20.18.1
OS : darwin-x64
Native Target : x86_64-macos
npm : 10.8.2
nx : 20.4.4
@nx/js : 20.4.4
@nx/jest : 20.4.4
@nx/eslint : 20.4.4
@nx/workspace : 20.4.4
@nx/devkit : 20.4.4
@nx/esbuild : 20.4.4
@nx/eslint-plugin : 20.4.4
@nx/node : 20.4.4
typescript : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
Failure Logs
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
I suspect it's because the package.json files
property is incorrect. Maybe this is the node-standalone configuration?
{
"name": "lib-test",
"version": "0.0.1",
"type": "commonjs",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"files": [
"dist",
"!**/*.tsbuildinfo"
],
"dependencies": {
"tslib": "^2.3.0"
}
}
Activity