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

Commit 37907e1

Browse files
feat(cli): Print relative cd path (#45)
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`
1 parent 0d9cb6a commit 37907e1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/cli/cli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ async function getConfig() {
210210
return {
211211
...config,
212212
libraryVersion,
213+
name: config.name || appName,
213214
template: templatePath,
214215
};
215216
}

packages/tasks/node/teardown.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require('path');
12
const chalk = require('chalk');
23
const { isYarnAvailable } = require('../../shared/utils');
34

@@ -7,18 +8,21 @@ module.exports = function teardown(config) {
78
const hasYarn = isYarnAvailable();
89
const installCommand = hasYarn ? 'yarn' : 'npm install';
910
const startCommand = hasYarn ? 'yarn start' : 'npm start';
11+
const currentDirectory = process.cwd();
12+
const cdPath =
13+
path.join(currentDirectory, config.name) === config.path
14+
? config.name
15+
: config.path;
1016

1117
console.log();
1218
console.log(
13-
`🎉 Created ${chalk.bold.cyan(config.name)} at ${chalk.green(
14-
config.path
15-
)}.`
19+
`🎉 Created ${chalk.bold.cyan(config.name)} at ${chalk.green(cdPath)}.`
1620
);
1721
console.log();
1822

1923
console.log('Begin by typing:');
2024
console.log();
21-
console.log(` ${chalk.cyan('cd')} ${config.path}`);
25+
console.log(` ${chalk.cyan('cd')} ${cdPath}`);
2226

2327
if (config.installation === false) {
2428
console.log(` ${chalk.cyan(`${installCommand}`)}`);

0 commit comments

Comments
 (0)