From 4810fee20b7df879f3fa649e36d6a5e243d6b5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Tue, 12 Jun 2018 17:33:08 +0200 Subject: [PATCH] feat(cli): Print relative cd path --- packages/cli/cli.js | 1 + packages/tasks/node/teardown.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/cli/cli.js b/packages/cli/cli.js index da5356bda..2a88478c2 100644 --- a/packages/cli/cli.js +++ b/packages/cli/cli.js @@ -210,6 +210,7 @@ async function getConfig() { return { ...config, libraryVersion, + name: config.name || appName, template: templatePath, }; } diff --git a/packages/tasks/node/teardown.js b/packages/tasks/node/teardown.js index 5360102cd..30e242b5b 100644 --- a/packages/tasks/node/teardown.js +++ b/packages/tasks/node/teardown.js @@ -1,3 +1,4 @@ +const path = require('path'); const chalk = require('chalk'); const { isYarnAvailable } = require('../../shared/utils'); @@ -7,18 +8,21 @@ module.exports = function teardown(config) { const hasYarn = isYarnAvailable(); const installCommand = hasYarn ? 'yarn' : 'npm install'; const startCommand = hasYarn ? 'yarn start' : 'npm start'; + const currentDirectory = process.cwd(); + const cdPath = + path.join(currentDirectory, config.name) === config.path + ? config.name + : config.path; console.log(); console.log( - `🎉 Created ${chalk.bold.cyan(config.name)} at ${chalk.green( - config.path - )}.` + `🎉 Created ${chalk.bold.cyan(config.name)} at ${chalk.green(cdPath)}.` ); console.log(); console.log('Begin by typing:'); console.log(); - console.log(` ${chalk.cyan('cd')} ${config.path}`); + console.log(` ${chalk.cyan('cd')} ${cdPath}`); if (config.installation === false) { console.log(` ${chalk.cyan(`${installCommand}`)}`);