Skip to content

Commit d091055

Browse files
committed
fix: update the CLI interface
1 parent fa933cf commit d091055

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@dhis2/create",
2+
"name": "@dhis2/create-app",
33
"version": "5.2.0-alpha.17",
44
"description": "",
55
"main": "src/index.js",
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const initCommand = require('@dhis2/cli-app-scripts/init')
2-
const { reporter } = require('@dhis2/cli-helpers-engine')
2+
const { reporter, chalk } = require('@dhis2/cli-helpers-engine')
33
const { input, select } = require('@inquirer/prompts')
44

55
process.on('uncaughtException', (error) => {
@@ -24,9 +24,9 @@ const command = {
2424
let name = argv._[0] || argv.name
2525

2626
reporter.debug(
27-
`running "npm create @dhis2" (or npx) command which is an alias to "d2 app scripts init"`
27+
`running "npm create @dhis2/app" (or npx) command which is an alias to "d2 app scripts init"`
2828
)
29-
const interactive = argv.i || argv.interactive
29+
const useDefauls = argv.yes
3030

3131
if (!name) {
3232
name = await input({
@@ -40,8 +40,8 @@ const command = {
4040

4141
let pnpm = true
4242
let npm = false
43-
let typeScript = false
44-
if (interactive) {
43+
let typeScript = argv.typescript || true
44+
if (!useDefauls) {
4545
const packageManager = await select({
4646
message: 'Select a package manager',
4747
default: 'pnpm',
@@ -57,7 +57,7 @@ const command = {
5757

5858
const template = await select({
5959
message: 'Select a template',
60-
default: 'js',
60+
default: 'ts',
6161
choices: [
6262
{ name: 'JavaScript', value: 'js' },
6363
{ name: 'TypeScript', value: 'ts' },
@@ -72,6 +72,16 @@ const command = {
7272
typeScript = template === 'ts'
7373
}
7474

75+
if (useDefauls) {
76+
reporter.info(
77+
chalk.greenBright(
78+
`These default options will be used to create a new app: \n${chalk.greenBright(
79+
'- Language: TypeScript\n- Package manager: pnpm'
80+
)}`
81+
)
82+
)
83+
}
84+
7585
await initCommand.handler({
7686
...argv,
7787
pnpm,

packages/main/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const command = namespace('d2', {
1717
`Check the D2 CLI documentation: ${chalk.underline(
1818
'https://developers.dhis2.org/docs/cli'
1919
)}. To create new web apps, you can also now run ${chalk.cyan(
20-
'npm create @dhis2@alpha'
21-
)} or ${chalk.cyan('npx @dhis2/create@alpha')}.\n`
20+
'npm create @dhis2/app'
21+
)}.\n`
2222
)
2323
)
2424
}

0 commit comments

Comments
 (0)