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}`)}`);