Skip to content

Commit ea95ed1

Browse files
lmajanoelpete
andauthored
chore(BoxLang): BoxLang compatibility
* feat: added copilot instructions, updated all github actions from old/deprecated, to new standards. * feat: added copilot instructions * adding another way to test boxlang * feat: upgrade all dependencies and removed old engines * bug: the server hot path in Adobe 2025 always added an extra space, why, well because Adobe CF really did not test their junk. * adding boxlang for testing * removing boxlang due to issues to be resolved by the team * adding experimental engine until we fix some boxlang crap * feat: Added tons of docs * Update test mappings for BoxLang * More path updates * chore(BoxLang): Update paths for BoxLang --------- Co-authored-by: Eric Peterson <[email protected]>
1 parent 064b92b commit ea95ed1

File tree

13 files changed

+519
-46
lines changed

13 files changed

+519
-46
lines changed

.github/copilot-instructions.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copilot Instructions for vite-helpers
2+
3+
## Architecture Overview
4+
This ColdBox module provides seamless Vite integration through two operational modes:
5+
- **Development mode**: Assets served directly from Vite dev server when `/includes/hot` file exists
6+
- **Production mode**: Assets resolved via Vite manifest (`.vite/manifest.json`) in build directory
7+
8+
The module automatically detects mode by checking for the "hot" file and switches behavior accordingly.
9+
10+
## Core Components
11+
- `models/Vite.cfc`: Singleton service handling asset resolution, manifest parsing, and HTML tag generation
12+
- `includes/helpers.cfm`: Exposes global `vite()` function in views via ColdBox's applicationHelper
13+
- `ModuleConfig.cfc`: Configures default paths (`hotFilePath`, `buildDirectory`, `manifestFileName`)
14+
15+
## Key Patterns
16+
- **Dual rendering modes**: `vite()` returns either hot server URLs or manifest-resolved paths
17+
- **Dependency injection**: Settings injected via `box:setting:*@vite-helpers` pattern
18+
- **Tag generation**: Automatic `<script>` and `<link>` tag creation with proper attributes (`type="module"`, preload links)
19+
- **Asset detection**: File extension regex determines CSS vs JS handling
20+
21+
## Usage Examples
22+
```cfml
23+
<!-- Basic usage - outputs appropriate tags for current mode -->
24+
#vite('resources/assets/js/app.js')#
25+
26+
<!-- Returns array of asset paths without rendering -->
27+
#vite().getAssetPaths(['app.js', 'app.css'])#
28+
29+
<!-- Custom configuration -->
30+
#vite().setBuildDirectory('/custom/build').render('app.js')#
31+
```
32+
33+
## Testing Patterns
34+
- Tests in `tests/specs/unit/ViteHelperSpec.cfc` simulate both dev and prod modes
35+
- Use `fileWrite(hotFilePath, serverUrl)` to test dev mode
36+
- Use `fileWrite(manifestFilePath, serializeJSON(manifest))` to test prod mode
37+
- Tests verify exact HTML output including preload tags and module attributes
38+
39+
## Development Workflow
40+
- **Format code**: `box run-script format` (uses cfformat)
41+
- **Run tests**: Navigate to `/tests/runner.cfm` or use TestBox CLI
42+
- **Debug**: Check for manifest file existence and hot file presence in asset resolution logic
43+
44+
## Configuration Points
45+
Default settings (customizable in `ModuleConfig.cfc`):
46+
- `hotFilePath`: `/includes/hot` - signals dev mode when present
47+
- `buildDirectory`: `/includes/build` - where Vite outputs production assets
48+
- `manifestFileName`: `.vite/manifest.json` - Vite's asset manifest file

.github/workflows/cron.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
cfengine: ["lucee@5", "lucee@be", "adobe@2018", "adobe@2021", "adobe@2023", "adobe@be"]
15-
coldbox: ["coldbox@6", "coldbox@7", "coldbox@be"]
16-
javaVersion: ["openjdk8", "openjdk11"]
14+
cfengine: [ "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ]
15+
coldbox: ["coldbox@7", "coldbox@be"]
16+
javaVersion: [ "openjdk21" ]
1717
steps:
1818
- name: Checkout Repository
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v5
2020

2121
- name: Setup Java JDK
22-
uses: actions/setup-java@v1.4.3
22+
uses: actions/setup-java@v5
2323
with:
24-
java-version: 11
24+
distribution: temurin
25+
java-version: 21
2526

2627
- name: Set Up CommandBox
27-
uses: elpete/setup-commandbox@v1.0.0
28+
uses: Ortus-Solutions/setup-commandbox@v2.0.1
2829

2930
- name: Install dependencies
3031
run: |

.github/workflows/pr.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ jobs:
2424
name: Format
2525
steps:
2626
- name: Checkout Repository
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v5
2828

2929
- name: Setup Java JDK
30-
uses: actions/setup-java@v1.4.3
30+
uses: actions/setup-java@v5
3131
with:
32-
java-version: 11
32+
distribution: temurin
33+
java-version: 21
3334

3435
- name: Set Up CommandBox
35-
uses: elpete/setup-commandbox@v1.0.0
36+
uses: Ortus-Solutions/setup-commandbox@v2.0.1
3637

3738
- name: Install CFFormat
3839
run: box install commandbox-cfformat
@@ -41,6 +42,6 @@ jobs:
4142
run: box run-script format
4243

4344
- name: Commit Format Changes
44-
uses: stefanzweifel/git-auto-commit-action@v4
45+
uses: stefanzweifel/git-auto-commit-action@v6
4546
with:
4647
commit_message: Apply cfformat changes

.github/workflows/prerelease.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717
# GA_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
1818
# steps:
1919
# - name: Checkout Repository
20-
# uses: actions/checkout@v2
20+
# uses: actions/checkout@v5
2121
# with:
2222
# fetch-depth: 0
2323

2424
# - name: Setup Java JDK
25-
# uses: actions/setup-java@v1.4.3
25+
# uses: actions/setup-java@v5
2626
# with:
2727
# java-version: 11
2828

2929
# - name: Set Up CommandBox
30-
# uses: elpete/setup-commandbox@v1.0.0
30+
# uses: Ortus-Solutions/setup-commandbox@v2.0.1
3131

3232
# - name: Install and Configure Semantic Release
3333
# run: |

.github/workflows/release.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,24 @@ jobs:
1919
GA_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
2020
steps:
2121
- name: Checkout Repository
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v5
2323
with:
2424
fetch-depth: 0
2525

2626
- name: Setup Java JDK
27-
uses: actions/setup-java@v1.4.3
27+
uses: actions/setup-java@v5
2828
with:
29-
java-version: 11
29+
distribution: temurin
30+
java-version: 21
3031

3132
- name: Set Up CommandBox
32-
uses: elpete/[email protected]
33+
uses: Ortus-Solutions/[email protected]
34+
with:
35+
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
36+
install: commandbox-semantic-release
3337

3438
- name: Install and Configure Semantic Release
3539
run: |
36-
box install commandbox-semantic-release
37-
box config set endpoints.forgebox.APIToken=${{ secrets.FORGEBOX_TOKEN }}
3840
box config set modules.commandbox-semantic-release.targetBranch=main
3941
box config set modules.commandbox-semantic-release.plugins='{ "VerifyConditions": "GitHubActionsConditionsVerifier@commandbox-semantic-release", "FetchLastRelease": "ForgeBoxReleaseFetcher@commandbox-semantic-release", "RetrieveCommits": "JGitCommitsRetriever@commandbox-semantic-release", "ParseCommit": "ConventionalChangelogParser@commandbox-semantic-release", "FilterCommits": "DefaultCommitFilterer@commandbox-semantic-release", "AnalyzeCommits": "DefaultCommitAnalyzer@commandbox-semantic-release", "VerifyRelease": "NullReleaseVerifier@commandbox-semantic-release", "GenerateNotes": "GitHubMarkdownNotesGenerator@commandbox-semantic-release", "UpdateChangelog": "FileAppendChangelogUpdater@commandbox-semantic-release", "CommitArtifacts": "NullArtifactsCommitter@commandbox-semantic-release", "PublishRelease": "ForgeBoxReleasePublisher@commandbox-semantic-release", "PublicizeRelease": "GitHubReleasePublicizer@commandbox-semantic-release" }'
4042

.github/workflows/tests.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,40 @@ jobs:
88
tests:
99
runs-on: ubuntu-latest
1010
name: Tests
11+
continue-on-error: ${{ matrix.experimental }}
1112
strategy:
1213
fail-fast: false
1314
matrix:
14-
cfengine: ["lucee@5", "adobe@2018", "adobe@2021", "adobe@2023"]
15-
coldbox: ["coldbox@6", "coldbox@7"]
15+
cfengine: [ "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ]
16+
coldbox: [ "coldbox@7", "coldbox@be" ]
17+
experimental: [ false ]
18+
include:
19+
- cfengine: "boxlang@1"
20+
coldbox: "coldbox@be"
21+
experimental: true
22+
1623
steps:
1724
- name: Checkout Repository
18-
uses: actions/checkout@v2
25+
uses: actions/checkout@v5
1926

2027
- name: Setup Java JDK
21-
uses: actions/setup-java@v1.4.3
28+
uses: actions/setup-java@v5
2229
with:
23-
java-version: 11
30+
distribution: temurin
31+
java-version: 21
2432

2533
- name: Set Up CommandBox
26-
uses: elpete/setup-commandbox@v1.0.0
34+
uses: Ortus-Solutions/setup-commandbox@v2.0.1
2735

2836
- name: Install dependencies
2937
run: |
3038
box install
3139
box install ${{ matrix.coldbox }} --noSave
3240
41+
- name: BoxLang Modules
42+
if: matrix.cfengine == 'boxlang@1'
43+
run: box server set scripts.onServerInitialInstall="install bx-compat-cfml,bx-esapi --noSave"
44+
3345
- name: Start server
3446
run: box server start cfengine=${{ matrix.cfengine }} --noSaveSettings
3547

0 commit comments

Comments
 (0)