np icon indicating copy to clipboard operation
np copied to clipboard

The following new files will not be part of your published package

Open CourtHive opened this issue 4 years ago • 11 comments
trafficstars

Description

I'm used to seeing ? The following new files are not already part of your published package: ... but today I got the following message

yarn run v1.22.10
$ np
? The following new files will not be part of your published package:

This didn't make any sense, because the functionality of the listed file was indeed included in the published package.

Expected behavior

I expected to be told that The following new files are not already part of your published package as I have always been told before

Environment

np - 7.5.0 Node.js - 14.15.1 npm - 7.5.4 Git - 2.9.3 OS - OSX 11.2.3

CourtHive avatar May 03 '21 14:05 CourtHive

Do you have an example repo we could look at that reproduces the issue?


// @bunysae

sindresorhus avatar May 03 '21 14:05 sindresorhus

It happened in https://github.com/CourtHive/tods-competition-factory earlier today. I have not idea how to reproduce.

CourtHive avatar May 03 '21 14:05 CourtHive

I just experienced the same issue in a private repository.

I think this message is inaccurate and left a comment on where it was added here: https://github.com/sindresorhus/np/pull/595/files#r637090752

jessieay avatar May 21 '21 17:05 jessieay

Also, fwiw, my new file was published when after this message showed up and I proceeded anyway.

jessieay avatar May 21 '21 17:05 jessieay

This is currently happening on my project. I added a new file to a branch, merged via PR. There are no untracked changes, and I don't see any reason for np to identify this file as something to keep out of the package. I absolutely want to include this file in the release. How can I get np to include this file?

This prompt doesn't offer me anyway to include this file.

kyeotic avatar Jun 18 '21 16:06 kyeotic

@kyeotic the message seems to be a false negative. I think the word 'not' is an error because as noted above - the package is still published with the new files. do a test publish and report back.

b-bot avatar Jun 18 '21 18:06 b-bot

It did include the file, so it does appear to be a false negative. @sindresorhus was asking for a repro though, so that link (to the exact sha) should provide it.

kyeotic avatar Jun 18 '21 19:06 kyeotic

I have the same issue here. This is with np 7.5.0.

To reproduce:

  • I had an untracked new file in the repo
  • I attempted a release
  • np correctly identified that the file would be missing, so I aborted
  • I added the file via Git
  • Now, trying to release again, it still reports the file as not part of the package

The above is a false negative — the file is tracked and committed, and published.

slhck avatar Aug 23 '21 09:08 slhck

np reports files, which are not published to npm's or a private registry. As you reported the file was just added to git. Is it published to the registry, too?

bunysae avatar Aug 23 '21 10:08 bunysae

Wait, am I missing the semantics here? The message "The following new files are not already part of your published package" is at least very misleading.

Is it telling me, "hey, you're about to publish a new file, did you really want this?" — in that case, the message is appropriate.

To me it seemed like a bug, and I interpreted it as, "The following files are not part of the package you want to publish right now." Which is most likely not the case here, so it's not a bug.

In that case, the message should ideally be reworded:

The following files are new and have not yet been part of any previously published package. Are you sure you want to publish them?

This makes the intent clearer.

slhck avatar Aug 23 '21 10:08 slhck

But then, what is this case for?

https://github.com/sindresorhus/np/blob/626aed670687c23cb6bb036a2e727cfd31821d84/source/ui.js#L93-L95

Here it is also indicating previously unpublished files.

slhck avatar Aug 23 '21 10:08 slhck