Skip to content

Commit

Permalink
feat(init): show removed files (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored May 11, 2022
1 parent acaba94 commit 1f3e869
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ const initCommand = (baseDir, logger) => {
* @param {string[]} restPath
*/
const removeForcibly = async (firstPath, ...restPath) => {
await rm(currentPath(firstPath, ...restPath), { force: true });
const file = currentPath(firstPath, ...restPath);
await rm(file, { force: true });
logger(`=> ${emphasize(relative(baseDir, file))} was removed`);
};

return {
Expand Down
26 changes: 14 additions & 12 deletions test/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,20 @@ test("End-to-End via CLI", () =>
cwd: ctx.initArgs.cwd,
});
expect(stdout).toMatchInlineSnapshot(`
"=> 'package.json' was updated
=> '.editorconfig' was updated
=> '.remarkignore' was updated
=> '.github/workflows/npm-audit-fix.yml' was updated
=> '.github/workflows/npm-diff.yml' was updated
=> '.github/workflows/release.yml' was updated
=> '.github/workflows/test.yml' was updated
=> '.husky/commit-msg' was updated
=> '.husky/post-commit' was updated
=> '.husky/pre-commit' was updated
"
`);
"=> 'package.json' was updated
=> '.editorconfig' was updated
=> '.remarkignore' was updated
=> '.github/workflows/npm-audit-fix.yml' was updated
=> '.github/workflows/npm-diff.yml' was updated
=> '.github/workflows/release.yml' was updated
=> '.github/workflows/test.yml' was updated
=> '.husky/commit-msg' was updated
=> '.husky/post-commit' was updated
=> '.husky/pre-commit' was updated
=> '.husky/.gitignore' was removed
=> '.github/workflows/commitlint.yml' was removed
"
`);
expect(stderr).toEqual("");
}));

Expand Down

0 comments on commit 1f3e869

Please sign in to comment.