@videinfra/static-website-builder 1.13.3 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [1.14.0] - 2025-01-16
8
+ ### Added
9
+ - Fail build process when TWIG task fails
10
+
11
+ ## [1.13.4] - 2024-10-08
12
+ ### Fixed
13
+ - Fail gulp process when htmlmin task fails
14
+
7
15
  ## [1.13.1] - 2024-09-19
8
16
  ### Added
9
17
  - Fail whole gulp process when one of the tasks fail
package/lib/log-error.js CHANGED
@@ -1,14 +1,15 @@
1
1
  const chalk = require('chalk');
2
2
 
3
3
  module.exports = function (error, failOnError = false) {
4
- console.log(chalk.red('Error') + ' in \'' + chalk.cyan(error.plugin || error.type) + '\'\nMessage:\n ' + (error.messageFormatted || error.message));
4
+ const message = String(error.messageFormatted || error.message);
5
+ const messageTrimmed = message.length > 4096 ? message.slice(0, 512) + '...' : message;
5
6
 
6
- // Emit the end event, to properly end the task
7
- if (typeof this.emit === 'function') {
8
- this.emit('end');
9
- }
7
+ console.log(chalk.red('Error') + ' in \'' + chalk.cyan(error.plugin || error.type) + '\'\nMessage:\n ' + messageTrimmed);
10
8
 
11
9
  if (failOnError) {
12
10
  throw error;
11
+ } else if (typeof this.emit === 'function') {
12
+ // Emit the end event, to properly end the task
13
+ this.emit('end');
13
14
  }
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videinfra/static-website-builder",
3
- "version": "1.13.3",
3
+ "version": "1.14.0",
4
4
  "description": "Customizable static site project builder",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -27,6 +27,12 @@ module.exports = function preprocessHTMLConfig (config = {}, fullConfig) {
27
27
  if (config.twig.filters) {
28
28
  config.twig.filters = flattenDeep(config.twig.filters);
29
29
  }
30
+ if (Array.isArray(config.twig.extend)) {
31
+ const extendFnList = config.twig.extend;
32
+ config.twig.extend = function (Twig) {
33
+ extendFnList.forEach((fn) => fn(Twig));
34
+ };
35
+ }
30
36
 
31
37
  // Main 'dependents' config is shared between all tasks
32
38
  if (config.dependents) {
package/plugins/twig.js CHANGED
@@ -33,6 +33,9 @@ exports.html = {
33
33
  // Disabled cache by default, it's enabled for production build only
34
34
  cache: false,
35
35
 
36
+ // Rethrow TWIG error so that process exists
37
+ rethrow: true,
38
+
36
39
  // Custom functions
37
40
  functions: [
38
41
  // require('../../plugins/twig/symfony-functions.js'),
@@ -43,7 +43,7 @@ module.exports = function (options) {
43
43
  twig = Twig.twig,
44
44
  twigOpts = {
45
45
  path: file.path,
46
- async: false
46
+ async: false,
47
47
  },
48
48
  template;
49
49
 
@@ -59,6 +59,9 @@ module.exports = function (options) {
59
59
  if (options.namespaces !== undefined) {
60
60
  twigOpts.namespaces = options.namespaces;
61
61
  }
62
+ if (options.rethrow !== undefined) {
63
+ twigOpts.rethrow = options.rethrow;
64
+ }
62
65
  if (options.cache !== true) {
63
66
  Twig.cache(false);
64
67
  }