11const initCommand = require ( '@dhis2/cli-app-scripts/init' )
2- const { reporter } = require ( '@dhis2/cli-helpers-engine' )
2+ const { reporter, chalk } = require ( '@dhis2/cli-helpers-engine' )
33const { input, select } = require ( '@inquirer/prompts' )
44
55process . 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,
0 commit comments