Skip to content

Commit 2782f65

Browse files
committed
Merge branch 'development'
2 parents 31d9a80 + 798765e commit 2782f65

File tree

162 files changed

+7230
-4676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+7230
-4676
lines changed

.github/copilot-instructions.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# ColdBox Framework Development Guide
2+
3+
## Architecture Overview
4+
5+
ColdBox is an HMVC (Hierarchical Model-View-Controller) framework designed for two languages: BoxLang (which the ColdBox team owns and directs) and CFML. ColdBox provides four main subsystems:
6+
7+
- **ColdBox MVC**: Core framework in `/system/web/` - handles routing, events, interceptions, and request lifecycle
8+
- **WireBox DI**: Dependency injection container in `/system/ioc/` - manages object creation, injection and aop
9+
- **CacheBox**: Caching framework in `/system/cache/` - provides multi-provider caching abstraction and it's own caching engine
10+
- **LogBox**: Logging framework in `/system/logging/` - structured logging with multiple appenders
11+
12+
## JavaScript Coding Standards
13+
14+
### Spacing and Formatting
15+
- **Always add spaces inside parentheses**: Use `if ( condition )` not `if (condition)`
16+
- **Function parameters**: Use `functionName( param1, param2 )` with spaces
17+
- **Array/Object access**: Use `array[ index ]` and `object[ key ]` with spaces
18+
- **Method calls**: Use `obj.method( param )` with spaces in parentheses
19+
- **Template literals**: Use spaces in template expressions `${ variable }`
20+
- **Arrow functions**: Use `array.filter( item => condition )` with spaces
21+
- **Operators**: Always space around operators `a === b`, `x + y`, `result = value`
22+
23+
### Structure and Organization
24+
- Use consistent indentation (tabs preferred to match CFML style)
25+
- Group related methods together
26+
- Add proper JSDoc comments for all functions
27+
- Use descriptive variable names
28+
- Separate logical sections with blank lines for readability
29+
30+
### Examples
31+
```javascript
32+
// Good - ColdBox JavaScript Style
33+
if ( condition && anotherCondition ) {
34+
const result = someFunction( param1, param2 );
35+
array.forEach( item => {
36+
processItem( item );
37+
} );
38+
}
39+
40+
// Bad - Inconsistent spacing
41+
if (condition&&anotherCondition) {
42+
const result = someFunction(param1,param2);
43+
array.forEach(item => {
44+
processItem(item);
45+
});
46+
}
47+
```
48+
49+
## Key Components
50+
51+
- **Bootstrap.cfc**: Framework initialization and application lifecycle management
52+
- **Controller.cfc**: Central dispatcher that processes events and manages services
53+
- **Settings.cfc**: Default configuration values and conventions (handlers, views, layouts, models)
54+
- **EventHandler.cfc/RestHandler.cfc**: Base classes for request handlers with dependency injection
55+
- **RequestContext**: Event object containing RC/PRC scopes, routing info, and rendering methods
56+
- **WireBox.cfc**: Dependency injection container for managing service creation and injection
57+
- **CacheBox.cfc**: Caching container for managing cache providers and entries
58+
- **LogBox.cfc**: Logging container for managing loggers, appenders, and log entries
59+
- **BugReport.cfm**: Error reporting template showing framework state, routing info, and scopes
60+
- **ModuleConfig.cfc**: Module configuration for routes, models, and interceptors
61+
62+
## Key Web Application Services
63+
64+
The ColdBox framework includes several core services in `/system/web/services/` that manage different aspects of the application lifecycle:
65+
66+
- **BaseService.cfc**: Base helper class providing common functionality for all ColdBox services
67+
- **HandlerService.cfc**: Manages event handling, handler caching, event caching, and handler execution lifecycle
68+
- **InterceptorService.cfc**: Manages interception points, interceptor registration, and announcement of framework events
69+
- **LoaderService.cfc**: Responsible for loading and configuring a ColdBox application with all its services during startup
70+
- **ModuleService.cfc**: Oversees HMVC module management including registration, activation, and CF mapping management
71+
- **RequestService.cfc**: Handles request context preparation, FORM/URL processing, and flash scope management
72+
- **RoutingService.cfc**: Manages URL routing, route registration, and request-to-handler mapping via the Router component
73+
- **SchedulerService.cfc**: Manages application schedulers in an HMVC fashion for background task execution
74+
75+
## Development Workflows
76+
77+
### Testing
78+
79+
```bash
80+
# Run specific test suites
81+
box run-script tests:integration
82+
box run-script tests:cachebox
83+
box run-script tests:wirebox
84+
box run-script tests:logbox
85+
86+
# Start test servers for different engines
87+
box run-script start:boxlang # BoxLang engine (preferred)
88+
box run-script start:lucee # Lucee CFML engine
89+
box run-script start:2023 # Adobe ColdFusion 2023
90+
```
91+
92+
### Building & Formatting
93+
94+
```bash
95+
box run-script build # Build without docs
96+
box run-script format # Format all CFC files
97+
box run-script format:check # Check formatting compliance
98+
```
99+
100+
## Framework Conventions
101+
102+
- **Handlers**: `/handlers/` - event handlers (controllers) with `index()` as default action
103+
- **Models**: `/models/` - business logic with automatic DI registration when `autoMapModels=true`
104+
- **Views**: `/views/` - organized by handler name, rendered with `event.setView()`
105+
- **Layouts**: `/layouts/` - page templates with `renderView()` placeholder
106+
- **Modules**: `/modules/` - self-contained HMVC sub-applications with `ModuleConfig.cfc`
107+
108+
## Dependency Injection Patterns
109+
110+
WireBox uses several injection approaches:
111+
- **Property injection**: `property name="myService" inject="MyService";`
112+
- **Constructor injection**: Arguments automatically resolved by type/name
113+
- **Setter injection**: `setMyService()` methods called automatically
114+
- **Provider pattern**: `inject="provider:MyService"` for lazy loading
115+
116+
## Testing Patterns
117+
118+
Tests extend `BaseModelTest` or `BaseIntegrationTest`:
119+
```cfml
120+
component extends="coldbox.system.testing.BaseModelTest" {
121+
function run(testResults, testBox) {
122+
describe("My Service", function() {
123+
beforeEach(function() {
124+
mockService = createMock("app.models.MyService");
125+
});
126+
127+
it("can do something", function() {
128+
expect(mockService.doSomething()).toBe("expected");
129+
});
130+
});
131+
}
132+
}
133+
```
134+
135+
## Error Handling & Debugging
136+
137+
- **BugReport.cfm**: Comprehensive error template showing framework state, routing info, scopes
138+
- **Exception handling**: Uses `exceptionHandler` setting pointing to handler.action
139+
- **Reinit**: Use `?fwreinit=1` to reload framework or specific password via `reinitPassword` setting
140+
- **Debug mode**: Set `debugMode=true` in configuration for enhanced error reporting
141+
142+
## Module Development
143+
144+
Modules are self-contained with:
145+
- **ModuleConfig.cfc**: Configuration, routes, model mappings, interceptors
146+
- **handlers/models/views**: Standard MVC structure
147+
- **settings**: Module-specific configuration accessible via `getModuleSettings()`
148+
- **dependencies**: Other modules this module depends on
149+
150+
## Multi-Language & Engine Support
151+
152+
### Language Support
153+
154+
ColdBox is designed for two programming languages:
155+
156+
**BoxLang** (Owned and directed by the ColdBox team):
157+
- `.bx` - Components (classes, services, handlers)
158+
- `.bxm` - Templates (views, layouts, includes)
159+
- `.bxs` - Script files
160+
- Strategic future language with enhanced features and performance
161+
- Modern JVM language with superior type safety and performance
162+
163+
**CFML** (ColdFusion Markup Language):
164+
- `.cfc` - Components (classes, services, handlers)
165+
- `.cfm` - Templates (views, layouts, includes)
166+
- Legacy language support maintained for existing applications
167+
168+
BoxLang is the recommended language for new projects due to its modern design, enhanced performance, and direct support from the ColdBox team.
169+
170+
### Engine Compatibility
171+
172+
Framework supports BoxLang, Lucee 5+, and Adobe ColdFusion 2023+. Use engine-specific server configs:
173+
- `server-boxlang@1.json` - BoxLang development (port 8599, debug enabled)
174+
- `server-boxlang-cfml@1.json` - BoxLang with CFML compatibility
175+
- `server-lucee@5.json` - Lucee CFML engine
176+
- `server-adobe@2023.json` - Adobe ColdFusion
177+
178+
Key consideration: BoxLang requires `enableNullSupport` in Application.cfc/bx for full null handling.

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
# GitHub Actions - updates uses: statements in workflows
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Where your .github/workflows/ folder is
6+
schedule:
7+
interval: "monthly"
8+
9+
# NPM
10+
- package-ecosystem: "npm"
11+
directory: "/system/exceptions" # adjust if needed
12+
schedule:
13+
interval: "monthly"

.github/workflows/lts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
name: Code Auto-Formatting
2121
runs-on: ubuntu-24.04
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2424

2525
- name: Auto-format
2626
uses: Ortus-Solutions/commandbox-action@v1.0.3
2727
with:
2828
cmd: run-script format
2929

3030
- name: Commit Format Changes
31-
uses: stefanzweifel/git-auto-commit-action@v5
31+
uses: stefanzweifel/git-auto-commit-action@v6
3232
with:
3333
commit_message: Apply cfformat changes
3434
push_options: --force

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
runs-on: ubuntu-24.04
2323
steps:
2424
- name: Checkout Repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626

27-
- uses: Ortus-Solutions/commandbox-action@v1.0.2
27+
- uses: Ortus-Solutions/commandbox-action@v1.0.3
2828
with:
2929
cmd: run-script format:check

.github/workflows/release.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ jobs:
4040
runs-on: ubuntu-24.04
4141
steps:
4242
- name: Checkout Repository
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@v5
4444

4545
- name: Setup Java
46-
uses: actions/setup-java@v4
46+
uses: actions/setup-java@v5
4747
with:
4848
distribution: "temurin"
4949
java-version: "11"
5050

51+
- name: Setup BoxLang
52+
uses: ortus-boxlang/setup-boxlang@1.1.0
53+
with:
54+
version: "snapshot"
55+
5156
- name: Setup CommandBox
5257
uses: Ortus-Solutions/setup-commandbox@v2.0.1
5358
with:
@@ -72,7 +77,7 @@ jobs:
7277
cd apidocs && box install
7378
7479
- name: Update changelog [unreleased] with latest version
75-
uses: thomaseizinger/keep-a-changelog-new-release@1.3.0
80+
uses: thomaseizinger/keep-a-changelog-new-release@3.1.0
7681
if: env.SNAPSHOT == 'false'
7782
with:
7883
changelogPath: ./changelog.md
@@ -83,8 +88,10 @@ jobs:
8388
# Fix changelog markdown
8489
npm install -g markdownlint-cli
8590
markdownlint changelog.md --fix
91+
8692
# Startup the server for API Docs mostly.
8793
box server start serverConfigFile="server-lucee@5.json" --debug
94+
8895
# Run the task
8996
box task run build/Build.cfc run ${{ env.COLDBOX_VERSION }} ${{ github.run_number }} ${{ env.BRANCH }}
9097
@@ -139,12 +146,13 @@ jobs:
139146
run: |
140147
ROOT_DIR=`pwd`
141148
cd $ROOT_DIR/.artifacts/coldbox/${{ env.COLDBOX_VERSION }} && box forgebox publish
149+
cd $ROOT_DIR/.artifacts/bx-coldbox/${{ env.COLDBOX_VERSION }} && box forgebox publish
142150
cd $ROOT_DIR/.artifacts/cachebox/${{ env.COLDBOX_VERSION }} && box forgebox publish
143151
cd $ROOT_DIR/.artifacts/wirebox/${{ env.COLDBOX_VERSION }} && box forgebox publish
144152
cd $ROOT_DIR/.artifacts/logbox/${{ env.COLDBOX_VERSION }} && box forgebox publish
145153
146154
- name: Create Github Release
147-
uses: taiki-e/create-gh-release-action@v1.8.0
155+
uses: taiki-e/create-gh-release-action@v1.9.1
148156
continue-on-error: true
149157
if: env.SNAPSHOT == 'false'
150158
with:
@@ -171,17 +179,17 @@ jobs:
171179
prep_next_release:
172180
name: Prep Next Release
173181
if: github.ref != 'refs/heads/development'
174-
runs-on: ubuntu-20.04
182+
runs-on: ubuntu-latest
175183
needs: [ build ]
176184
steps:
177185
- name: Checkout Development Repository
178-
uses: actions/checkout@v4
186+
uses: actions/checkout@v5
179187
if: env.LTS == 'false'
180188
with:
181189
ref: development
182190

183191
- name: Checkout LTS Repository
184-
uses: actions/checkout@v4
192+
uses: actions/checkout@v5
185193
if: env.LTS == 'true'
186194

187195
- name: Setup CommandBox
@@ -190,7 +198,7 @@ jobs:
190198
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
191199

192200
- name: Download build artifacts
193-
uses: actions/download-artifact@v4
201+
uses: actions/download-artifact@v5
194202
with:
195203
path: .tmp
196204

.github/workflows/snapshot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
name: Code Auto-Formatting
2828
runs-on: ubuntu-24.04
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v5
3131

3232
- name: Auto-format
33-
uses: Ortus-Solutions/commandbox-action@v1.0.2
33+
uses: Ortus-Solutions/commandbox-action@v1.0.3
3434
with:
3535
cmd: run-script format
3636

3737
- name: Commit Format Changes
38-
uses: stefanzweifel/git-auto-commit-action@v4
38+
uses: stefanzweifel/git-auto-commit-action@v6
3939
with:
4040
commit_message: Apply cfformat changes
4141
push_options: --force

0 commit comments

Comments
 (0)