express-sweet-generator 1.0.4 → 1.0.5

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
@@ -1,6 +1,30 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [1.0.5] - 2022-07-27
5
+ ### Fixed
6
+ - You can now set hook functions that are called before the view is rendered.
7
+ Hook functions can be used, for example, to set local variables that can be used in the view.
8
+
9
+ To use, add the beforeRender hook function to "config/view.js" as follows.
10
+ ```js
11
+ /**
12
+ * Hook function just before the view is rendered.
13
+ * For example, you can set your own local variables that can be used within the view.
14
+ *
15
+ * @example
16
+ * // The message set here can be referenced in the view as {{message}}.
17
+ * beforeRender: res => {
18
+ * res.loclas.message = 'Hello World';
19
+ * }
20
+ *
21
+ * @type {(res: express.Response) => void}
22
+ */
23
+ beforeRender: res => {
24
+ res.loclas.message = 'Hello World';
25
+ }
26
+ ```
27
+
4
28
  ## [1.0.4] - 2022-05-18
5
29
  ### Fixed
6
30
  - Version 1.0.18 of express-sweet now supports redis as session store for authentication, so we have added the relevant options (session_store, redis_host) to the authentication configuration of the template.
@@ -33,4 +57,5 @@ All notable changes to this project will be documented in this file.
33
57
  [1.0.1]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.0...v1.0.1
34
58
  [1.0.2]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.1...v1.0.2
35
59
  [1.0.3]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.2...v1.0.3
36
- [1.0.4]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.3...v1.0.4
60
+ [1.0.4]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.3...v1.0.4
61
+ [1.0.5]: https://github.com/takuya-motoshima/express-sweet-generator/compare/v1.0.4...v1.0.5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-sweet-generator",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Express Sweet application generator.",
5
5
  "main": "bin/express-sweet-cli.js",
6
6
  "files": [
@@ -32,5 +32,19 @@ module.exports = {
32
32
  * Extension for templates & partials, defaults to `.hbs`,
33
33
  * @type {string}
34
34
  */
35
- extension: '.hbs'
35
+ extension: '.hbs',
36
+
37
+ /**
38
+ * Hook function just before the view is rendered.
39
+ * For example, you can set your own local variables that can be used within the view.
40
+ *
41
+ * @example
42
+ * // The message set here can be referenced in the view as {{message}}.
43
+ * beforeRender: res => {
44
+ * res.loclas.message = 'Hello World';
45
+ * }
46
+ *
47
+ * @type {(res: express.Response) => void}
48
+ */
49
+ beforeRender: (res) => {}
36
50
  }
@@ -32,5 +32,19 @@ export default {
32
32
  * Extension for templates & partials, defaults to `.hbs`,
33
33
  * @type {string}
34
34
  */
35
- extension: '.hbs'
35
+ extension: '.hbs',
36
+
37
+ /**
38
+ * Hook function just before the view is rendered.
39
+ * For example, you can set your own local variables that can be used within the view.
40
+ *
41
+ * @example
42
+ * // The message set here can be referenced in the view as {{message}}.
43
+ * beforeRender: res => {
44
+ * res.loclas.message = 'Hello World';
45
+ * }
46
+ *
47
+ * @type {(res: express.Response) => void}
48
+ */
49
+ beforeRender: (res) => {}
36
50
  }