diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc new file mode 100644 index 0000000..478d346 --- /dev/null +++ b/ModuleConfig.cfc @@ -0,0 +1,32 @@ +/** + * ColdBox auto-wire for Coldspa. + * + * In a ColdBox app this runs at startup and appends the module's directory to + * the app's customTagPaths so and resolve without any + * manual Application.cfc edits. + * + * Plain (non-ColdBox) CFML apps don't load this file -- they need to add the + * path manually: + * + * this.customTagPaths = expandPath("/modules/coldspa"); + */ +component { + + this.title = "Coldspa"; + this.author = "crutchcorn"; + this.webURL = "https://github.com/crutchcorn/coldspa"; + this.description = "Give your CFML a spa day. The Islands Architecture for ColdFusion."; + this.version = "0.1.0"; + this.autoMapping = true; + this.entryPoint = "coldspa"; + this.modelNamespace = "coldspa"; + this.cfmapping = "coldspa"; + + function configure() { + var settings = controller.getApplicationSettings(); + var current = settings.customTagPaths ?: ""; + var sep = (len(current) gt 0) ? ";" : ""; + settings.customTagPaths = current & sep & moduleMapping; + controller.setApplicationSettings(settings); + } +} diff --git a/README.md b/README.md index 7d1fe81..aef48df 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,32 @@ Give your CFML a spa day. The Islands Architecture for ColdFusion. Mount Vue or ## Install +CFML side (via [CommandBox](https://www.ortussolutions.com/products/commandbox) / ForgeBox): + +```bash +box install coldspa +``` + +Node side (Vite plugin + SSR sidecar): + ```bash npm install coldspa vite vue # or: react react-dom ``` +## Setup + +Register the module's directory as a custom tag path so `` and `` resolve from anywhere in your app: + +```cfc +// Application.cfc +component { + this.name = "MyApp"; + this.customTagPaths = expandPath("/modules/coldspa"); +} +``` + +ColdBox users can skip this — the bundled `ModuleConfig.cfc` wires the custom tag path automatically. + ## Configure Vite ```js diff --git a/box.json b/box.json new file mode 100644 index 0000000..2cd7707 --- /dev/null +++ b/box.json @@ -0,0 +1,87 @@ +{ + "name":"Coldspa", + "slug":"coldspa", + "version":"0.1.0", + "author":"crutchcorn", + "location":"ForgeboxStorage", + "private":false, + "type":"modules", + "shortDescription":"Give your CFML a spa day. The Islands Architecture for ColdFusion.", + "description":"Mount Vue or React components into CFML pages with server-side rendering and progressive hydration. Astro-style framework islands for ColdFusion.", + "keywords":[ + "coldfusion", + "cfml", + "islands", + "islands-architecture", + "vite", + "vue", + "react", + "ssr", + "hydration" + ], + "homepage":"https://github.com/crutchcorn/coldspa", + "documentation":"https://github.com/crutchcorn/coldspa#readme", + "repository":{ + "type":"git", + "URL":"https://github.com/crutchcorn/coldspa" + }, + "bugs":"https://github.com/crutchcorn/coldspa/issues", + "projectURL":"https://github.com/crutchcorn/coldspa", + "changelog":"", + "contributors":[], + "license":[ + { + "type":"MIT", + "URL":"https://github.com/crutchcorn/coldspa/blob/main/LICENSE" + } + ], + "dependencies":{}, + "devDependencies":{}, + "installPaths":{}, + "ignore":[ + "**/.*", + "/test/", + "/tests/", + "/demos/", + "/dist/", + "/dist-ssr/", + "/node_modules/", + "/src/", + "/WEB-INF/", + "package.json", + "package-lock.json", + "vite.config.js", + "vite.config.vue.js", + "vite.config.react.js", + "coldspa.config.json", + "index.cfm", + "Application.cfc", + "crossdomain.xml", + "cfproject.md" + ], + "instructions":"See https://github.com/crutchcorn/coldspa#readme for setup. Non-ColdBox apps must add `this.customTagPaths = expandPath(\"/modules/coldspa\");` to Application.cfc. Requires the companion npm package `coldspa` for the Vite plugin and Node SSR sidecar.", + "scripts":{}, + "reinitWatchDelay":500, + "reinitWatchDirectory":"", + "reinitWatchPaths":"", + "testbox":{ + "bundles":"", + "directory":"tests.specs", + "excludes":"", + "labels":"", + "options":{}, + "recurse":true, + "reporter":"", + "runner":[ + { + "default":"" + } + ], + "testBundles":"", + "testSpecs":"", + "testSuites":"", + "verbose":true, + "watchDelay":500, + "watchPaths":"**.cfc" + } +}