Skip to content
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

Fix showing files added since the last release #595

Merged
merged 2 commits into from
Apr 25, 2021

Conversation

bunysae
Copy link
Contributor

@bunysae bunysae commented Jan 31, 2021

Add support for unpublished as well as first time published files as mention in #588 (comment).

@sindresorhus
Copy link
Owner

Tests are failing.

@sindresorhus
Copy link
Owner

I created a file foo, added it to files in package.json, committed, ran np, but did not get a warning about a new file being added to the package.

@bunysae
Copy link
Contributor Author

bunysae commented Mar 8, 2021

@sindresorhus
this issue may have several causes:

  • it's a private package
  • publishing step is skipped (np --no-publish)
  • file foo wasn't added to git properly
  • foo is the main-file in package.json

When these bullet points were all negative, the prompt shows file foo in my tests.
In source/ui.js we just show the prompt when publishing step is invoked:

if (options.runPublish) {
                checkIgnoreStrategy(pkg);

                const answerIgnoredFiles = await checkNewFiles(pkg);
...

@sindresorhus sindresorhus changed the title Fix show files added since the last release Fix showing files added since the last release Apr 24, 2021
@sindresorhus sindresorhus merged commit 626aed6 into sindresorhus:main Apr 25, 2021
@sindresorhus
Copy link
Owner

I cannot reproduce anymore, so you're probably right that it had either of those conditions.

const message = `The following new files are not already part of your published package:\n${chalk.reset(ignoredFiles.map(path => `- ${path}`).join('\n'))}`;
const messages = [];
if (newFiles.unpublished.length > 0) {
messages.push(`The following new files will not be part of your published package:\n${chalk.reset(newFiles.unpublished.map(path => `- ${path}`).join('\n'))}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this message is inaccurate? Maybe it should read:

The following new files are not already part of your published package

instead?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jessieay I agree! This is a very confusing message! Happens on files which have no apparent reason not to be included!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok great seems to be fixed in new version. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants