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

Handle long path names in the "show files added since last release" feature #579

Merged
merged 4 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration-test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"any-observable": "^0.5.1",
"async-exit-hook": "^2.0.1",
"chalk": "^4.1.0",
"ci-info": "^2.0.0",
"cosmiconfig": "^7.0.0",
"del": "^6.0.0",
"escape-goat": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions source/git-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ exports.latestTag = async () => {

exports.newFilesSinceLastRelease = async () => {
try {
const {stdout} = await execa('git', ['diff', '--stat', '--diff-filter=A', await this.latestTag(), 'HEAD']);
const result = stdout.trim().split('\n').slice(0, -1).map(row => row.slice(0, row.indexOf('|')).trim());
const {stdout} = await execa('git', ['diff', '--name-only', '--diff-filter=A', await this.latestTag(), 'HEAD']);
const result = stdout.trim().split('\n').map(row => row.trim());
return result;
} catch {
// Get all files under version control
Expand Down
9 changes: 8 additions & 1 deletion source/ui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const inquirer = require('inquirer');
const chalk = require('chalk');
const ciInfo = require('ci-info');
sindresorhus marked this conversation as resolved.
Show resolved Hide resolved
const githubUrlFromGit = require('github-url-from-git');
const {htmlEscape} = require('escape-goat');
const isScoped = require('is-scoped');
Expand Down Expand Up @@ -56,10 +57,16 @@ const checkIgnoredFiles = async pkg => {
return true;
}

const message = `The following new files are not already part of your published package:\n${chalk.reset(ignoredFiles.map(path => `- ${path}`).join('\n'))}`;
if (ciInfo.isCI) {
console.log(message);
return true;
}

const answers = await inquirer.prompt([{
type: 'confirm',
name: 'confirm',
message: `The following new files are not already part of your published package:\n${chalk.reset(ignoredFiles.map(path => `- ${path}`).join('\n'))}\nContinue?`,
message: `${message}\nContinue?`,
default: false
}]);

Expand Down