From 1f3e86997f1c7eb556614022bf87b1460774d7a7 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 11 May 2022 09:41:20 +0900 Subject: [PATCH] feat(init): show removed files (#1264) --- lib/init.js | 4 +++- test/init.test.js | 26 ++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/init.js b/lib/init.js index f8a720fc..aafea055 100644 --- a/lib/init.js +++ b/lib/init.js @@ -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 { diff --git a/test/init.test.js b/test/init.test.js index e5144e45..5e6e0029 100644 --- a/test/init.test.js +++ b/test/init.test.js @@ -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(""); }));