1
1
import process from 'node:process'
2
2
import { runAction } from '@stacksjs/actions'
3
- import { intro , log , outro , prompt } from '@stacksjs/cli'
3
+ import { intro , log , outro } from '@stacksjs/cli'
4
4
import type { BuildOptions , CLI } from '@stacksjs/types'
5
5
import { ExitCode } from '@stacksjs/types'
6
6
import { Action } from '@stacksjs/enums'
7
- import { isString } from '@stacksjs/validation'
8
7
9
8
export function build ( buddy : CLI ) {
10
9
const descriptions = {
@@ -41,6 +40,8 @@ export function build(buddy: CLI) {
41
40
. option ( '--server' , descriptions . server , { default : false } )
42
41
. option ( '--verbose' , descriptions . verbose , { default : false } )
43
42
. action ( async ( server : string | undefined , options : BuildOptions ) => {
43
+ log . debug ( 'Running `buddy build` ...' , options )
44
+
44
45
switch ( server ) {
45
46
case 'components' :
46
47
options . components = true
@@ -76,28 +77,29 @@ export function build(buddy: CLI) {
76
77
break
77
78
}
78
79
79
- if ( hasNoOptions ( options ) ) {
80
- let answers = await prompt . require ( )
81
- . multiselect ( descriptions . select , {
82
- options : [
83
- { label : 'Components' , value : 'components' } ,
84
- // { label: 'Vue Components', value: 'vue-components' },
85
- { label : 'Web Components' , value : 'web-components' } ,
86
- { label : 'Functions' , value : 'functions' } ,
87
- { label : 'Views' , value : 'views' } ,
88
- { label : 'Documentation' , value : 'docs' } ,
89
- ] ,
90
- } )
91
-
92
- if ( answers !== null )
93
- process . exit ( ExitCode . InvalidArgument )
94
-
95
- if ( isString ( answers ) )
96
- answers = [ answers ]
97
-
98
- // creates an object out of array and sets answers to true
99
- options = answers . reduce ( ( a : any , v : any ) => ( { ...a , [ v ] : true } ) , { } )
100
- }
80
+ // TODO: uncomment this when prompt is available
81
+ // if (hasNoOptions(options)) {
82
+ // let answers = await prompt.require
83
+ // .multiselect(descriptions.select, {
84
+ // options: [
85
+ // { label: 'Components', value: 'components' },
86
+ // // { label: 'Vue Components', value: 'vue-components' },
87
+ // { label: 'Web Components', value: 'web-components' },
88
+ // { label: 'Functions', value: 'functions' },
89
+ // { label: 'Views', value: 'views' },
90
+ // { label: 'Documentation', value: 'docs' },
91
+ // ],
92
+ // })
93
+ //
94
+ // if (answers !== null)
95
+ // process.exit(ExitCode.InvalidArgument)
96
+ //
97
+ // if (isString(answers))
98
+ // answers = [answers]
99
+ //
100
+ // // creates an object out of array and sets answers to true
101
+ // options = answers.reduce((a: any, v: any) => ({ ...a, [v]: true }), {})
102
+ // }
101
103
102
104
await runAction ( Action . BuildStacks , options )
103
105
@@ -111,6 +113,7 @@ export function build(buddy: CLI) {
111
113
. option ( '-p, --project' , descriptions . project , { default : false } )
112
114
. option ( '--verbose' , descriptions . verbose , { default : false } )
113
115
. action ( async ( options : BuildOptions ) => {
116
+ log . debug ( 'Running `buddy build:components` ...' , options )
114
117
await runAction ( Action . BuildComponentLibs , options )
115
118
} )
116
119
@@ -121,6 +124,7 @@ export function build(buddy: CLI) {
121
124
. option ( '-p, --project' , descriptions . project , { default : false } )
122
125
. option ( '--verbose' , descriptions . verbose , { default : false } )
123
126
. action ( async ( options : BuildOptions ) => {
127
+ log . debug ( 'Running `buddy build:cli` ...' , options )
124
128
await runAction ( Action . BuildCli , options )
125
129
} )
126
130
@@ -131,6 +135,7 @@ export function build(buddy: CLI) {
131
135
. option ( '-p, --project' , descriptions . project , { default : false } )
132
136
. option ( '--verbose' , descriptions . verbose , { default : false } )
133
137
. action ( async ( options : BuildOptions ) => {
138
+ log . debug ( 'Running `buddy build:server` ...' , options )
134
139
await runAction ( Action . BuildServer , options )
135
140
} )
136
141
@@ -140,6 +145,7 @@ export function build(buddy: CLI) {
140
145
. option ( '-p, --project' , descriptions . project , { default : false } )
141
146
. option ( '--verbose' , descriptions . verbose , { default : false } )
142
147
. action ( async ( options : BuildOptions ) => {
148
+ log . debug ( 'Running `buddy `build:functions` ...' , options )
143
149
await runAction ( Action . BuildFunctionLib , options )
144
150
} )
145
151
@@ -153,6 +159,7 @@ export function build(buddy: CLI) {
153
159
. option ( '--verbose' , descriptions . verbose , { default : false } )
154
160
. alias ( 'build:vue' )
155
161
. action ( async ( options : BuildOptions ) => {
162
+ log . debug ( 'Running `buddy build:vue-components` ...' , options )
156
163
await runAction ( Action . BuildVueComponentLib , options )
157
164
} )
158
165
@@ -165,6 +172,7 @@ export function build(buddy: CLI) {
165
172
. option ( '-p, --project' , descriptions . project , { default : false } )
166
173
. option ( '--verbose' , descriptions . verbose , { default : false } )
167
174
. action ( async ( options : BuildOptions ) => {
175
+ log . debug ( 'Running `buddy build:web-components` ...' , options )
168
176
await runAction ( Action . BuildWebComponentLib , options )
169
177
} )
170
178
@@ -177,6 +185,7 @@ export function build(buddy: CLI) {
177
185
. option ( '-p, --project' , descriptions . project , { default : false } )
178
186
. option ( '--verbose' , descriptions . verbose , { default : false } )
179
187
. action ( async ( options : BuildOptions ) => {
188
+ log . debug ( 'Running `buddy build:docs` ...' , options )
180
189
await runAction ( Action . BuildDocs , options )
181
190
} )
182
191
@@ -185,6 +194,8 @@ export function build(buddy: CLI) {
185
194
. option ( '-p, --project' , descriptions . project , { default : false } )
186
195
. option ( '--verbose' , descriptions . verbose , { default : false } )
187
196
. action ( async ( options : BuildOptions ) => {
197
+ log . debug ( 'Running `buddy build:core` ...' , options )
198
+
188
199
const startTime = await intro ( 'buddy build:core' )
189
200
const result = await runAction ( Action . BuildCore , options )
190
201
@@ -202,6 +213,8 @@ export function build(buddy: CLI) {
202
213
. option ( '-p, --project' , descriptions . project , { default : false } )
203
214
. option ( '--verbose' , descriptions . verbose , { default : false } )
204
215
. action ( async ( options : BuildOptions ) => {
216
+ log . debug ( 'Running `buddy build:desktop` ...' , options )
217
+
205
218
const perf = await intro ( 'buddy build:desktop' )
206
219
const result = await runAction ( Action . BuildDesktop , options )
207
220
@@ -222,6 +235,8 @@ export function build(buddy: CLI) {
222
235
. option ( '-p, --project' , descriptions . project , { default : false } )
223
236
. option ( '--verbose' , descriptions . verbose , { default : false } )
224
237
. action ( async ( options : BuildOptions ) => {
238
+ log . debug ( 'Running `buddy build:stacks` ...' , options )
239
+
225
240
const startTime = await intro ( 'buddy build:stacks' )
226
241
const result = await runAction ( Action . BuildStacks , options )
227
242
@@ -239,6 +254,6 @@ export function build(buddy: CLI) {
239
254
} )
240
255
}
241
256
242
- function hasNoOptions ( options : BuildOptions ) {
243
- return ! options . components && ! options . vueComponents && ! options . webComponents && ! options . elements && ! options . functions && ! options . views && ! options . docs && ! options . stacks && ! options . buddy
244
- }
257
+ // function hasNoOptions(options: BuildOptions) {
258
+ // return !options.components && !options.vueComponents && !options.webComponents && !options.elements && !options.functions && !options.views && !options.docs && !options.stacks && !options.buddy
259
+ // }
0 commit comments