Skip to content

Commit d0796b0

Browse files
committed
### Added
- Make sure `commandbox-boxlang` is a dependency to detect BoxLang projects ### Fixed - Creation of `bx` classes when `--boxlang` is used was missing from handler creation - App generation install tweaks to avoid path issues by @gpickin - Fix on copying files starting with a dot, like `.babelrc` for vite support, which is ignored by default by git ignores.
1 parent d94352a commit d0796b0

16 files changed

+122
-45
lines changed

.github/copilot-instructions.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ColdBox CLI - AI Coding Instructions
22

3-
This is a CommandBox module providing CLI commands for ColdBox framework development. It generates scaffolded code for handlers, models, views, tests, and complete applications with support for both CFML and BoxLang.
3+
This is a CommandBox module (v7.10.0) providing CLI commands for ColdBox framework development. It generates scaffolded code for handlers, models, views, tests, and complete applications. **BoxLang is now the default language** for all new applications and generated code, with full CFML support available via the `--cfml` flag.
44

55
## Architecture & Key Components
66

@@ -16,6 +16,24 @@ This is a CommandBox module providing CLI commands for ColdBox framework develop
1616
2. Package.json `testbox.runner` setting
1717
3. Package.json `language` property
1818

19+
**Language Flags**:
20+
- `--boxlang` - Force BoxLang generation (usually not needed as it's the default)
21+
- `--cfml` - Force CFML generation (overrides BoxLang default)
22+
23+
**Application Creation Features**:
24+
- `coldbox create app-wizard` - Interactive wizard for creating applications
25+
- `--migrations` - Include database migrations support
26+
- `--docker` - Include Docker configuration and containerization
27+
- `--vite` - Include Vite frontend asset building (modern/BoxLang templates)
28+
- `--rest` - Configure as REST API application (BoxLang templates)
29+
30+
**Code Style Conventions**:
31+
- **Semicolons are optional** in CFML/BoxLang and should NOT be used in generated code except:
32+
- When demarcating property declarations
33+
- When required in inline component syntax
34+
- Example: `property name="userService" inject="UserService";` (property with semicolon)
35+
- Example: `var result = service.getData()` (no semicolon needed)
36+
1937
## Development Workflows
2038

2139
**Command Development**:
@@ -27,17 +45,20 @@ This is a CommandBox module providing CLI commands for ColdBox framework develop
2745
- Templates use token replacement with `replaceNoCase(content, "|token|", value, "all")`
2846
- BoxLang conversion uses `toBoxLangClass()` to transform `component` to `class`
2947
- Resource generation supports both REST and standard handlers via template selection
48+
- Modern templates (`boxlang`, `modern`) support additional features via flags: `--vite`, `--rest`, `--docker`, `--migrations`
49+
- Default skeleton is now `boxlang` instead of `advanced`
3050

3151
**Module Dependencies**: The module lazy-loads `testbox-cli` and `commandbox-migrations` via utility methods `ensureTestBoxModule()` and `ensureMigrationsModule()` only when needed.
3252

3353
## Key Patterns & Conventions
3454

3555
**File Generation Logic**: Commands typically:
3656
1. Resolve and validate paths using `resolvePath()`
37-
2. Read appropriate templates based on `--rest`, `--boxlang` flags
57+
2. Read appropriate templates based on `--rest`, `--boxlang`, `--cfml` flags
3858
3. Perform token replacements for customization
3959
4. Create directories if they don't exist
4060
5. Generate additional files (views, tests) based on flags
61+
6. For app creation: apply feature flags (`--vite`, `--docker`, `--migrations`) to configure project
4162

4263
**Cross-Component Integration**:
4364
- Models can generate handlers via `--handler` flag

box.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
},
3030
"dependencies":{
3131
"testbox-cli":"*",
32-
"commandbox-migrations":"*"
32+
"commandbox-migrations":"*",
33+
"commandbox-boxlang":"*"
3334
},
3435
"installPaths":{},
3536
"ignore":[

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
### Added
13+
14+
- Make sure `commandbox-boxlang` is a dependency to detect BoxLang projects
15+
16+
### Fixed
17+
18+
- Creation of `bx` classes when `--boxlang` is used was missing from handler creation
19+
- App generation install tweaks to avoid path issues by @gpickin
20+
- Fix on copying files starting with a dot, like `.babelrc` for vite support, which is ignored by default by git ignores.
21+
1222
## [8.3.0] - 2025-12-08
1323

1424
### Added

commands/coldbox/create/app.cfc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ component extends="coldbox-cli.models.BaseCommand" {
279279
} else {
280280
printInfo( "🥊 Setting up Vite for your frontend build system" )
281281
fileCopy(
282-
"#variables.settings.templatesPath#/vite/.babelrc",
282+
"#variables.settings.templatesPath#/vite/babelrc",
283283
arguments.directory & ".babelrc"
284284
)
285285
fileCopy(
@@ -292,6 +292,7 @@ component extends="coldbox-cli.models.BaseCommand" {
292292
)
293293

294294
// BoxLang Layout
295+
// Detect if they ar in BoxLang or CFML mode
295296
if ( fileExists( arguments.directory & "app/layouts/Main.bxm" ) ) {
296297
fileDelete( arguments.directory & "app/layouts/Main.bxm" )
297298
fileCopy(
@@ -301,6 +302,7 @@ component extends="coldbox-cli.models.BaseCommand" {
301302
}
302303

303304
// CFML Layout
305+
// Detect if they ar in BoxLang or CFML mode
304306
if ( fileExists( arguments.directory & "app/layouts/Main.cfm" ) ) {
305307
fileDelete( arguments.directory & "app/layouts/Main.cfm" )
306308
fileCopy(

commands/coldbox/create/handler.cfc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
102102
arguments.description,
103103
"all"
104104
);
105+
105106
// BoxLang replacements
106107
if ( arguments.boxlang ) {
107108
handlerContent = toBoxLangClass( handlerContent );
@@ -150,7 +151,7 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
150151
}
151152

152153
// Create dir if it doesn't exist
153-
var handlerPath = resolvePath( "#arguments.directory#/#arguments.name#.cfc" );
154+
var handlerPath = resolvePath( "#arguments.directory#/#arguments.name#.#arguments.boxlang ? 'bx' : 'cfc'#" );
154155
directoryCreate(
155156
getDirectoryFromPath( handlerPath ),
156157
true,
@@ -173,7 +174,7 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
173174

174175
// More Tests?
175176
if ( arguments.integrationTests ) {
176-
var testPath = resolvePath( "#arguments.testsDirectory#/#arguments.name#Test.cfc" );
177+
var testPath = resolvePath( "#arguments.testsDirectory#/#arguments.name#Test.#arguments.boxlang ? 'bx' : 'cfc'#" );
177178
// Create dir if it doesn't exist
178179
directoryCreate(
179180
getDirectoryFromPath( testPath ),

templates/ai/flat-copilot-instructions.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# ColdBox Flat Template - AI Coding Instructions
22

3-
This is a ColdBox HMVC framework template using the traditional "flat" structure where all application code lives in the webroot. Use CFML with ColdBox 7+ conventions. Compatible with Adobe ColdFusion 2018+, Lucee 5.x+, and BoxLang 1.0+.
3+
This is a ColdBox HMVC framework template using the traditional "flat" structure where all application code lives in the webroot. **Supports both BoxLang (when specified) and CFML (default for flat template)** with ColdBox 7+ conventions. Compatible with Adobe ColdFusion 2018+, Lucee 5.x+, and BoxLang 1.0+.
4+
5+
**Note**: For new projects, consider using the BoxLang or Modern templates which are now the recommended defaults.
46

57
## 🏗️ Architecture Overview
68

@@ -43,10 +45,12 @@ This is a ColdBox HMVC framework template using the traditional "flat" structure
4345

4446
### Standard Handler Structure
4547

48+
**Code Style Note**: Semicolons are optional in CFML/BoxLang. Only use them when demarcating properties or in inline component syntax.
49+
4650
```cfml
4751
component extends="coldbox.system.EventHandler" {
4852
49-
// Dependency injection
53+
// Dependency injection (semicolons used to demarcate properties)
5054
property name="userService" inject="UserService";
5155
5256
// All actions receive three arguments:
@@ -170,10 +174,13 @@ box run-script docker:run # Run container
170174
box run-script docker:stack up # Start docker-compose stack
171175
box run-script docker:stack down # Stop docker-compose stack
172176

173-
# ColdBox CLI scaffolding
174-
coldbox create handler name=Users actions=index,create,save,delete
175-
coldbox create model name=UserService methods=getAll,save,delete
176-
coldbox create integration-test handler=Users
177+
# ColdBox CLI scaffolding (use --cfml to ensure CFML generation)
178+
coldbox create handler name=Users actions=index,create,save,delete --cfml
179+
coldbox create model name=UserService methods=getAll,save,delete --cfml
180+
coldbox create integration-test handler=Users --cfml
181+
182+
# Interactive app wizard
183+
coldbox create app-wizard # Step-by-step app creation
177184
```
178185

179186
## 🎯 Configuration Patterns
@@ -254,6 +261,8 @@ component {
254261

255262
### Property Injection
256263

264+
**Note**: Semicolons are used to demarcate property declarations:
265+
257266
```cfml
258267
component {
259268
// Inject by model name (auto-resolved from models/ folder)
@@ -319,6 +328,17 @@ this.javaSettings = {
319328
- **`server.json`** - Server configuration (engine, JVM, rewrites)
320329
- **`tests/Application.cfc`** - Test bootstrap (mirrors main Application.cfc)
321330

331+
## ⚙️ Language Generation
332+
333+
Since **BoxLang is now the default** for the ColdBox CLI, use the `--cfml` flag when generating new components for CFML-based flat template projects:
334+
335+
```bash
336+
# Force CFML generation for traditional flat template projects
337+
coldbox create handler Users --cfml
338+
coldbox create model UserService --cfml
339+
coldbox create view users/index --cfml
340+
```
341+
322342
## 🔍 Debugging Tips
323343

324344
```cfml

templates/ai/modern-copilot-instructions.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# ColdBox Modern Template - AI Coding Instructions
22

3-
This is a ColdBox HMVC framework template with a "modern" folder structure that separates application code from the public webroot. Use CFML/BoxLang with ColdBox 7+ conventions.
3+
This is a ColdBox HMVC framework template with a "modern" folder structure that separates application code from the public webroot. **Supports both BoxLang (default) and CFML** with ColdBox 7+ conventions.
4+
5+
**Template Features**: This template supports Vite integration (`--vite`), Docker containerization (`--docker`), REST API configuration (`--rest`), and database migrations (`--migrations`).
46

57
## 🏗️ Architecture Overview
68

@@ -54,6 +56,8 @@ This template **requires** CommandBox aliases in `server.json` to expose interna
5456

5557
### Standard Handler Structure
5658

59+
**Code Style Note**: Semicolons are optional in CFML/BoxLang. Only use them when demarcating properties or in inline component syntax.
60+
5761
```cfml
5862
component extends="coldbox.system.EventHandler" {
5963
@@ -179,7 +183,7 @@ component extends="coldbox.system.testing.BaseTestCase" appMapping="/app" {
179183

180184
## 💉 Dependency Injection
181185

182-
Use WireBox annotations in components:
186+
Use WireBox annotations in components. **Note**: Semicolons are used here to demarcate property declarations:
183187

184188
```cfml
185189
component {
@@ -218,9 +222,16 @@ box run-script format # Format all code
218222
box run-script format:check # Check formatting
219223
box run-script format:watch # Watch mode
220224

221-
# Docker
222-
box run-script build:docker # Build Docker image
223-
box run-script run:docker # Run container
225+
# Vite (if --vite flag was used during creation)
226+
npm install # Install frontend dependencies
227+
npm run dev # Start Vite dev server with HMR
228+
npm run build # Build for production
229+
npm run preview # Preview production build
230+
231+
# Docker (if --docker flag was used during creation)
232+
docker-compose up -d # Start development environment
233+
docker-compose logs -f # View logs
234+
docker-compose down # Stop services
224235
```
225236

226237
## 📦 Java Dependencies (Optional)
@@ -275,7 +286,18 @@ When installing modules with web assets:
275286

276287
## 🎯 When to Use This Template
277288

278-
- **Use Modern Template**: Secure environments, production apps, when you want application code outside webroot
279-
- **Use Default Template**: Development, simple apps, when you need everything in webroot
289+
- **Use Modern Template**: Production apps, secure environments, when you want application code outside webroot, supports both BoxLang and CFML
290+
- **Use BoxLang Template** (default): BoxLang-first projects with modern conventions
291+
- **Use Flat Template**: Development, simple apps, traditional CFML when you need everything in webroot
280292

281293
This template requires understanding of web server aliases and CommandBox configuration.
294+
295+
## 🚀 Additional Features
296+
297+
**Created with --vite**: Includes Vite configuration for modern frontend development with hot module replacement.
298+
299+
**Created with --docker**: Includes Dockerfile and docker-compose.yml for containerized development and deployment.
300+
301+
**Created with --rest**: Pre-configured for REST API development with appropriate routing and response handlers.
302+
303+
**Created with --migrations**: Includes CommandBox Migrations setup for database version control.

templates/modules/bx/ModuleConfig.bx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ class {
6868
*/
6969
function configure(){
7070
// parent settings
71-
parentSettings = {};
71+
parentSettings = {}
7272

7373
// module settings - stored in modules.name.settings
74-
settings = {};
74+
settings = {}
7575

7676
// Layout Settings
77-
layoutSettings = { defaultLayout : "" };
77+
layoutSettings = { defaultLayout : "" }
7878

7979
// Custom Declared Points
80-
interceptorSettings = { customInterceptionPoints : [] };
80+
interceptorSettings = { customInterceptionPoints : [] }
8181

8282
// Custom Declared Interceptors
83-
interceptors = [];
83+
interceptors = []
8484

8585
// Binder Mappings
8686
// binder.map("Alias").to("#moduleMapping#.models.MyService");

templates/testing/HandlerBDDContent.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* ColdBox Integration Test
33
*
4-
* The 'appMapping' points by default to the '/root ' mapping created in the test folder Application.cfc. Please note that this
5-
* Application.cfc must mimic the real one in your root, including ORM settings if needed.
4+
* The 'appMapping' points by default to the '/ ' mapping created in the test folder Application.(bx|cfc). Please note that this
5+
* Application must mimic the real one in your root, including ORM settings if needed.
66
*
77
* The 'execute()' method is used to execute a ColdBox event, with the following arguments
88
* - event : the name of the event
@@ -13,7 +13,7 @@
1313
*
1414
* You can also use the HTTP executables: get(), post(), put(), path(), delete(), request()
1515
**/
16-
component extends="coldbox.system.testing.BaseTestCase" appMapping="|appMapping|"{
16+
component extends="coldbox.system.testing.BaseTestCase"{
1717

1818
/*********************************** LIFE CYCLE Methods ***********************************/
1919

templates/testing/HandlerTestContent.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
component extends="coldbox.system.testing.BaseTestCase" appMapping="|appMapping|" {
1+
component extends="coldbox.system.testing.BaseTestCase"{
22

33
/**
44
* You can remove this setup method if you do not have anything to setup
55
*/
66
void function setup(){
77
//Call the super setup method to setup the app.
8-
super.setup();
8+
super.setup()
99

1010
// Your own setup here if needed
1111
}

0 commit comments

Comments
 (0)