@@ -40,7 +40,7 @@ component extends="coldbox-cli.models.BaseCommand" {
4040 function init (){
4141 // Map these shortcut names to the actual ForgeBox slugs
4242 variables .templateMap = {
43- " flat" : " cbtemplate-flat" ,
43+ " flat" : " cbtemplate-flat" ,
4444 " boxlang" : " cbtemplate-boxlang" ,
4545 " modern" : " cbtemplate-modern" ,
4646 " rest" : " cbtemplate-rest" ,
@@ -49,7 +49,7 @@ component extends="coldbox-cli.models.BaseCommand" {
4949 " supersimple" : " cbtemplate-supersimple"
5050 };
5151
52- variables .defaultAppName = " My ColdBox App" ;
52+ variables .defaultAppName = " My ColdBox App" ;
5353 variables .defaultSkeleton = " boxlang" ;
5454
5555 return this ;
@@ -82,9 +82,9 @@ component extends="coldbox-cli.models.BaseCommand" {
8282 boolean verbose = false ,
8383 boolean migrations = false ,
8484 boolean boxlang = isBoxLangProject ( getCWD () ),
85- boolean docker = true ,
86- boolean vite = false ,
87- boolean rest = false
85+ boolean docker = true ,
86+ boolean vite = false ,
87+ boolean rest = false
8888 ){
8989 // Check for wizard argument
9090 if ( arguments .wizard ) {
@@ -156,7 +156,7 @@ component extends="coldbox-cli.models.BaseCommand" {
156156 slug : variables .formatterUtil .slugify ( arguments .name ),
157157 version : " 1.0.0" ,
158158 location : " forgeboxStorage" ,
159- ignore : []
159+ ignore : []
160160 )
161161 .run ();
162162
@@ -170,36 +170,50 @@ component extends="coldbox-cli.models.BaseCommand" {
170170 var envFile = arguments .directory & " .env" ;
171171 if ( ! fileExists ( envFile ) ) {
172172 printInfo ( " 🌿 Creating .env file" );
173- if ( fileExists ( arguments .directory & " .env.example" ) ){
174- fileCopy ( arguments .directory & " .env.example" , envFile );
173+ if ( fileExists ( arguments .directory & " .env.example" ) ) {
174+ fileCopy (
175+ arguments .directory & " .env.example" ,
176+ envFile
177+ );
175178 } else {
176- fileCopy ( variables .settings .templatesPath & " .env.example" , envFile );
179+ fileCopy (
180+ variables .settings .templatesPath & " .env.example" ,
181+ envFile
182+ );
177183 }
178184 } else {
179185 printInfo ( " ⏭️ .env file already exists, skipping creation." )
180186 }
181187
182188 // Copilot instructions
183189 printInfo ( " 🤖 Preparing GitHub Copilot configuration" );
184- var githubDir = arguments .directory & " .github" ;
190+ var githubDir = arguments .directory & " .github" ;
185191 var copilotFile = githubDir & " /copilot-instructions.md" ;
186- if ( ! directoryExists ( githubDir ) ){
192+ if ( ! directoryExists ( githubDir ) ) {
187193 directoryCreate ( githubDir , true )
188194 }
189- if ( ! fileExists ( copilotFile ) ){
195+ if ( ! fileExists ( copilotFile ) ) {
190196 printInfo ( " 🥊 Creating copilot file" )
191197 // If the template has a copilot-instructions.md, use it, otherwise use the default one
192- if ( fileExists ( arguments .directory & " resources/copilot-instructions.md" ) ){
193- fileCopy ( arguments .directory & " resources/copilot-instructions.md" , copilotFile );
198+ if ( fileExists ( arguments .directory & " resources/copilot-instructions.md" ) ) {
199+ fileCopy (
200+ arguments .directory & " resources/copilot-instructions.md" ,
201+ copilotFile
202+ );
194203 } else {
195- if ( arguments .skeleton == " modern" ){
196- fileCopy ( variables .settings .templatesPath & " modern-copilot-instructions.md" , copilotFile );
197- }
198- else {
199- fileCopy ( variables .settings .templatesPath & " flat-copilot-instructions.md" , copilotFile );
204+ if ( arguments .skeleton == " modern" ) {
205+ fileCopy (
206+ variables .settings .templatesPath & " modern-copilot-instructions.md" ,
207+ copilotFile
208+ );
209+ } else {
210+ fileCopy (
211+ variables .settings .templatesPath & " flat-copilot-instructions.md" ,
212+ copilotFile
213+ );
200214 }
201215 }
202- } else {
216+ } else {
203217 printInfo ( " ⏭️ copilot-instructions.md file already exists, skipping creation." )
204218 }
205219
@@ -213,9 +227,9 @@ component extends="coldbox-cli.models.BaseCommand" {
213227 .toConsole ();
214228 }
215229
216- if ( arguments .docker ){
230+ if ( arguments .docker ) {
217231 printInfo ( " 🥊 Setting up Docker for containerization" )
218- if ( directoryExists ( arguments .directory & " docker" ) ){
232+ if ( directoryExists ( arguments .directory & " docker" ) ) {
219233 printInfo ( " ⏭️ Docker directory already exists, skipping creation." )
220234 } else {
221235 directoryCreate ( arguments .directory & " docker" , true )
@@ -242,22 +256,35 @@ component extends="coldbox-cli.models.BaseCommand" {
242256 }
243257
244258 // VITE Setup
245- if ( arguments .vite ){
246- if ( arguments .skeleton ! = " modern" && arguments .skeleton ! = " boxlang" ){
259+ if ( arguments .vite ) {
260+ if ( arguments .skeleton ! = " modern" && arguments .skeleton ! = " boxlang" ) {
247261 printWarn ( " ⚠️ Vite setup is only supported for 'modern' or 'boxlang' skeletons. Skipping Vite setup." )
248262 } else {
249263 printInfo ( " 🥊 Setting up Vite for your frontend build system" )
250- fileCopy ( " #variables .settings .templatesPath #/vite/.babelrc" , arguments .directory & " .babelrc" )
251- fileCopy ( " #variables .settings .templatesPath #/vite/package.json" , arguments .directory & " package.json" )
252- fileCopy ( " #variables .settings .templatesPath #/vite/vite.config.mjs" , arguments .directory & " vite.config.mjs" )
264+ fileCopy (
265+ " #variables .settings .templatesPath #/vite/.babelrc" ,
266+ arguments .directory & " .babelrc"
267+ )
268+ fileCopy (
269+ " #variables .settings .templatesPath #/vite/package.json" ,
270+ arguments .directory & " package.json"
271+ )
272+ fileCopy (
273+ " #variables .settings .templatesPath #/vite/vite.config.mjs" ,
274+ arguments .directory & " vite.config.mjs"
275+ )
253276 fileDelete ( arguments .directory & " app/layouts/Main.bxm" )
254- fileCopy ( " #variables .settings .templatesPath #/vite/layouts/Main.bxm" , arguments .directory & " app/layouts/Main.bxm" )
255- fileCopy ( " #variables .settings .templatesPath #/vite/assets" , arguments .directory & " resources/assets" )
277+ fileCopy (
278+ " #variables .settings .templatesPath #/vite/layouts/Main.bxm" ,
279+ arguments .directory & " app/layouts/Main.bxm"
280+ )
281+ fileCopy (
282+ " #variables .settings .templatesPath #/vite/assets" ,
283+ arguments .directory & " resources/assets"
284+ )
256285
257286 printInfo ( " 🥊 Installing ColdBox Vite Helpers" )
258- command ( " install" )
259- .params ( " vite-helpers" )
260- .run ();
287+ command ( " install" ).params ( " vite-helpers" ).run ();
261288
262289 variables .print
263290 .line ( " ✅ Vite setup complete!" )
@@ -269,53 +296,65 @@ component extends="coldbox-cli.models.BaseCommand" {
269296 }
270297
271298 // REST Setup
272- if ( arguments .rest ){
273- if ( arguments .skeleton ! = " modern" && arguments .skeleton ! = " boxlang" ){
299+ if ( arguments .rest ) {
300+ if ( arguments .skeleton ! = " modern" && arguments .skeleton ! = " boxlang" ) {
274301 printWarn ( " ⚠️ REST setup is only supported for 'modern' or 'boxlang' skeletons. Skipping REST setup." )
275302 } else {
276303 printInfo ( " 🥊 Setting up a REST API only ColdBox application" )
277304 printInfo ( " 👉 You can always add views and layouts later if you change your mind" )
278305
279306 // Router
280307 fileDelete ( arguments .directory & " app/config/Router.bx" )
281- fileCopy ( " #variables .settings .templatesPath #/rest/Router.bx" , arguments .directory & " app/config/Router.bx" )
308+ fileCopy (
309+ " #variables .settings .templatesPath #/rest/Router.bx" ,
310+ arguments .directory & " app/config/Router.bx"
311+ )
282312 // Tests
283- directoryDelete ( arguments .directory & " tests/specs" , true )
313+ directoryDelete (
314+ arguments .directory & " tests/specs" ,
315+ true
316+ )
284317 directoryCopy (
285- source : " #variables .settings .templatesPath #/rest/specs" ,
318+ source : " #variables .settings .templatesPath #/rest/specs" ,
286319 destination : arguments .directory & " tests/specs" ,
287- recurse : true ,
288- createPath : true
320+ recurse : true ,
321+ createPath : true
289322 )
290323 // Configuration
291324 directoryCopy (
292- source : " #variables .settings .templatesPath #/rest/config/modules" ,
325+ source : " #variables .settings .templatesPath #/rest/config/modules" ,
293326 destination : arguments .directory & " app/config/modules" ,
294- recurse : false ,
295- createPath : true
327+ recurse : false ,
328+ createPath : true
296329 )
297330 // Models
298- directoryDelete ( arguments .directory & " app/models" , true )
331+ directoryDelete (
332+ arguments .directory & " app/models" ,
333+ true
334+ )
299335 directoryCopy (
300- source : " #variables .settings .templatesPath #/rest/models" ,
336+ source : " #variables .settings .templatesPath #/rest/models" ,
301337 destination : arguments .directory & " app/models" ,
302- recurse : false ,
303- createPath : true
338+ recurse : false ,
339+ createPath : true
304340 )
305341 // Handlers
306- directoryDelete ( arguments .directory & " app/handlers" , true )
342+ directoryDelete (
343+ arguments .directory & " app/handlers" ,
344+ true
345+ )
307346 directoryCopy (
308- source : " #variables .settings .templatesPath #/rest/handlers" ,
347+ source : " #variables .settings .templatesPath #/rest/handlers" ,
309348 destination : arguments .directory & " app/handlers" ,
310- recurse : false ,
311- createPath : true
349+ recurse : false ,
350+ createPath : true
312351 )
313352 // Api Docs
314353 directoryCopy (
315- source : " #variables .settings .templatesPath #/rest/apidocs" ,
354+ source : " #variables .settings .templatesPath #/rest/apidocs" ,
316355 destination : arguments .directory & " resources/apidocs" ,
317- recurse : true ,
318- createPath : true
356+ recurse : true ,
357+ createPath : true
319358 )
320359 var newConfig = fileRead ( arguments .directory & " app/config/Coldbox.bx" )
321360 .replace ( " Main.index" , " Echo.index" )
@@ -324,13 +363,14 @@ component extends="coldbox-cli.models.BaseCommand" {
324363
325364 // Install CommandBox Modules
326365 printInfo ( " 🥊 Installing ColdBox API Production Modules: Security, Mementifier, Validation" )
327- command ( " install" )
328- .params ( " cbsecurity,mementifier,cbvalidation" )
329- .run ();
366+ command ( " install" ).params ( " cbsecurity,mementifier,cbvalidation" ).run ();
330367
331368 printInfo ( " 🥊 Installing ColdBox API Development Modules: route-visualizer,relax" )
332369 command ( " install" )
333- .params ( " cbsecurity,mementifier,cbvalidation" , " --saveDev" )
370+ .params (
371+ " cbsecurity,mementifier,cbvalidation" ,
372+ " --saveDev"
373+ )
334374 .run ();
335375
336376 printInfo ( " ✅ REST API only setup complete!" )
0 commit comments