@itrocks/framework 0.1.6 → 0.2.1

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.
@@ -41,6 +41,7 @@ const transformer_3 = require("@itrocks/transformer");
41
41
  const translate_1 = require("@itrocks/translate");
42
42
  const date_fns_1 = require("date-fns");
43
43
  const node_path_1 = require("node:path");
44
+ const node_path_2 = require("node:path");
44
45
  const menu = new menu_1.Menu(config_1.config.menu);
45
46
  async function propertyOutput(object, property) {
46
47
  return (0, transformer_1.applyTransformer)(await object[property], object, property, transformer_2.HTML, transformer_3.OUTPUT);
@@ -110,14 +111,16 @@ function bind() {
110
111
  action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
111
112
  const containerData = {
112
113
  action: request.action,
114
+ favicon: config_1.config.container?.favicon ?? (0, node_path_2.normalize)((0, node_path_1.join)(__dirname, '../favicon.ico')),
115
+ manifest: config_1.config.container?.manifest ? [config_1.config.container.manifest] : [],
113
116
  menu,
114
117
  request,
115
- scripts: config_1.config.container.scripts,
118
+ scripts: config_1.config.container?.scripts,
116
119
  session: request.request.session,
117
- styleSheets: config_1.config.container.styleSheets,
120
+ styleSheets: config_1.config.container?.styleSheets,
118
121
  };
119
122
  Object.assign(containerData, this);
120
- const contained = !request.request.headers['xhr-info'];
123
+ const contained = !request.request.headers['xhr-info'] && config_1.config.container?.file;
121
124
  const template = new template_insight_1.Template(data, containerData);
122
125
  return this.htmlResponse(await template.parseFile(templateFile, contained && (0, node_path_1.join)(app_dir_1.appDir, config_1.config.container.file)), statusCode, headers);
123
126
  };
package/cjs/main.js CHANGED
@@ -13,6 +13,7 @@ const route_1 = require("@itrocks/route");
13
13
  const store_1 = require("@itrocks/store");
14
14
  const template_1 = require("@itrocks/template");
15
15
  const node_path_1 = require("node:path");
16
+ const node_path_2 = require("node:path");
16
17
  template_1.frontScripts.push('/node_modules/air-datepicker/locale/en.js', '/node_modules/air-datepicker/locale/fr.js');
17
18
  async function execute(request) {
18
19
  // Access control
@@ -55,13 +56,14 @@ async function run() {
55
56
  return new fastify_1.FastifyServer({
56
57
  assetPath: app_dir_1.appDir,
57
58
  execute: request => execute(new action_request_2.Request(request)),
58
- favicon: '/node_modules/@itrocks/framework/favicon.ico',
59
+ favicon: config_1.config.container?.favicon ?? (0, node_path_2.normalize)((0, node_path_1.join)(__dirname, '../favicon.png')),
59
60
  frontScripts: template_1.frontScripts,
60
- host: config_1.config.server.host ?? '127.0.0.1',
61
- port: config_1.config.server.port ?? 3000,
61
+ host: config_1.config.server.host,
62
+ manifest: config_1.config.container?.manifest,
63
+ port: config_1.config.server.port,
62
64
  scriptCalls: ['loadCss', 'loadScript'],
63
- secret: config_1.config.session.secret ?? config_1.config.secret ?? 'defaultSecretForTesting',
64
- store: new fastify_file_session_store_1.FileStore((0, node_path_1.join)(app_dir_1.appDir, config_1.config.session.path))
65
+ secret: config_1.config.session.secret ?? config_1.config.secret ?? 'defaultSecret',
66
+ store: new fastify_file_session_store_1.FileStore((0, node_path_2.normalize)((0, node_path_1.join)(app_dir_1.appDir, config_1.config.session.path)))
65
67
  }).run();
66
68
  }
67
69
  //# sourceMappingURL=main.js.map
package/config.yaml CHANGED
@@ -2,5 +2,9 @@ compose:
2
2
  '@itrocks/reflect:ReflectClass': '@itrocks/framework:ReflectClass'
3
3
  '@itrocks/reflect:ReflectProperty': '@itrocks/framework:ReflectProperty'
4
4
 
5
+ server:
6
+ host: 127.0.0.1
7
+ port: 3000
8
+
5
9
  session:
6
10
  path: /session
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "build:front": "tsc -p src/front/tsconfig.json && sed -i 's#../../##g' *.js *.d.ts"
92
92
  },
93
93
  "types": "./cjs/framework.d.ts",
94
- "version": "0.1.6"
94
+ "version": "0.2.1"
95
95
  }
package/favicon.ico DELETED
Binary file