Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
feat(cli): Print relative cd path (#45)
Browse files Browse the repository at this point in the history
If generating the app `my-app-4` from `/tmp/apps`, recommend to change directory to:

- Before: `/tmp/apps/my-app-4`
- After: `my-app-4`
  • Loading branch information
francoischalifour authored Jun 13, 2018
1 parent 0d9cb6a commit 37907e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ async function getConfig() {
return {
...config,
libraryVersion,
name: config.name || appName,
template: templatePath,
};
}
Expand Down
12 changes: 8 additions & 4 deletions packages/tasks/node/teardown.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path');
const chalk = require('chalk');
const { isYarnAvailable } = require('../../shared/utils');

Expand All @@ -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}`)}`);
Expand Down

0 comments on commit 37907e1

Please sign in to comment.