Skip to content

Commit 6241a37

Browse files
committed
throw if the configured version assets are missin
1 parent 117aa0c commit 6241a37

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

build.cfm

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,35 @@
2121
if ( listFirst( server.lucee.version, "." ) < 7 ) {
2222
throw( type="BuildError", message="Lucee 7.x required", detail="This build requires Lucee 7.x or later. Current version: #server.lucee.version#" );
2323
}
24-
logger.logger ("assetBundleVersion: " & application.assetBundleVersion);
25-
logger.logger(" ");
24+
logger.logger( "assetBundleVersion: " & application.assetBundleVersion );
25+
26+
// Check all versioned asset files exist
27+
assetDir = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "builders/html/assets/";
28+
requiredAssets = [
29+
"css/base.#application.assetBundleVersion#.min.css",
30+
"js/dist/base.#application.assetBundleVersion#.min.js",
31+
"trycf/js/ace/ace-bundle.#application.assetBundleVersion#.js",
32+
"css/highlight.#application.assetBundleVersion#.css",
33+
"css/highlight-dark.#application.assetBundleVersion#.css"
34+
];
35+
missingAssets = [];
36+
for ( asset in requiredAssets ) {
37+
if ( !fileExists( assetDir & asset ) ) {
38+
missingAssets.append( asset );
39+
}
40+
}
41+
if ( missingAssets.len() ) {
42+
logger.logger( "Missing versioned asset files: #missingAssets.toList( ', ' )#" );
43+
throw( message="Run 'npm run build' in builders/html/assets/ to create missing assets" );
44+
}
45+
logger.logger( "All versioned assets present" );
46+
logger.logger( " " );
47+
48+
threads = 4;
49+
logger.logger("Using #threads# threads for building the documentation.");
2650
2751
//savecontent variable="suppressingwhitespacehere" {
28-
new api.build.BuildRunner(threads=1).buildAll();
52+
new api.build.BuildRunner(threads=threads).buildAll();
2953
//}
3054
3155
//content reset="true" type="text/plain";

0 commit comments

Comments
 (0)