-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm publish with folder package-spec acts on CWD instead #5136
Comments
your npm is pretty old, can you try updating? i'm going to close this as i'm not able to reproduce this on the latest published release. feel free to reopen if it's still not working for you after updating, though. here's what i did to try: > mkdir project
> cd project
> npm init -y
> mkdir build
> cd build
> npm init -y
> cd ..
> npm publish ./build --dry-run
npm notice
npm notice 📦 [email protected]
npm notice === Tarball Contents ===
npm notice 258B package.json
npm notice === Tarball Details ===
npm notice name: build
npm notice version: 1.0.0
npm notice filename: build-1.0.0.tgz
npm notice package size: 278 B
npm notice unpacked size: 258 B
npm notice shasum: 5c98428681eccf130f1f9a407f23193686498101
npm notice integrity: sha512-YuoskojI8dMFn[...]j5jUCJQiQBNwA==
npm notice total files: 1
npm notice
npm notice Publishing to https://registry.npmjs.org/ (dry-run) |
Thanks @nlf. I upgraded NodeJS last week and was under the impression I was using a new npm version (that was installed alongside NodeJS). However I had previously followed the upgrade guide and was still on the version I had previously installed. It does indeed seems to work without issues, on npm 8.14.0 now though. |
@nlf I was still experiencing the issue on my CI server, so I did some more investigation and actually still have the same issue locally as well. However, there's one more package.json involved: > mkdir root
> cd root
> mkdir proj
> cd proj
> npm init -y
> mkdir build
> cd build
> npm init -y
> cd ..
> mkdir src
> echo src > src\src.txt
> echo build > build\build.txt
> echo {"name":"root","workspaces":["proj"]} > ..\package.json
> npm publish ./build --dry-run
npm notice
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 8B build/build.txt
npm notice 218B package.json
npm notice 6B src/src.txt
npm notice === Tarball Details ===
npm notice name: proj
npm notice version: 1.0.0
npm notice filename: proj-1.0.0.tgz
npm notice package size: 313 B
npm notice unpacked size: 232 B
npm notice shasum: 50e174f63fccec2d1a67571fda17a825a45ebdee
npm notice integrity: sha512-4qqlR6hnfl+VM[...]yS287fBgam4YQ==
npm notice total files: 3
npm notice
npm WARN This command requires you to be logged in to https://registry.npmjs.org/ (dry-run)
npm notice Publishing to https://registry.npmjs.org/ (dry-run)
+ [email protected]
> npm pack ./build --dry-run
npm WARN Ignoring workspaces for specified package(s)
npm notice
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 8B build.txt
npm notice 219B package.json
npm notice === Tarball Details ===
npm notice name: build
npm notice version: 1.0.0
npm notice filename: build-1.0.0.tgz
npm notice package size: 282 B
npm notice unpacked size: 227 B
npm notice shasum: f7ecede13e1ea48f174bbfea4f5a084b976efd64
npm notice integrity: sha512-hryfO1NUvfGER[...]lFMnGTGbNywrw==
npm notice total files: 2
npm notice
build-1.0.0.tgz As you can see, I'm actually unable to reopen this, please reopen it for me. |
I'm having a similar issue. Running This is npm version 8.19.2 Edit: This is the only solution I've been able to use as a work-around
|
Hello, any updates on this ? i still have the same issue in workspaces project using npm v10.7.0 |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Given the following directory structure:
I develop my package in the
src
folder. When building I build to thebuild
folder, copy package.json tobuild
and alter package.json so it matches what I want to publish (to an internal server). Previously I would runnpm publish build
, however with npm 8(.7.0) that no longer results in the desired behavior. However, thepackage-spec
documentation states I can actually refer to thebuild
folder by using./build
, or perhaps.\build
on Windows (assuming CWD ispackage
). Using either results in a publish of the folderpackage
and all its content instead ofpackage\build
. CD-ing tobuild
and runningnpm publish
results in the expected behavior.Expected Behavior
npm publish <package-spec>
where package-spec is a folder acts identical topushd <package-spec> && npm publish && popd
.Steps To Reproduce
npm publish ./build --dry-run
src
andbuild
folders end up in package, instead ofbuild
contents only.Environment
The text was updated successfully, but these errors were encountered: