@raketa-cloud/admin 0.0.31 → 0.0.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-cloud/admin",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "main": "src/index.js",
5
5
  "scripts": {
6
6
  "dev": "npx tailwindcss -i ./src/styles/application.css -o ../../apps/admin/static/application.css --watch",
package/src/Adapter.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import ejs from "ejs";
4
+ import Logger from "./Logger";
4
5
  import currentPath from "./currentPath.cjs";
5
6
  import FormBuilder from "./helpers/FormBuilder";
6
7
  import HTMLBuilder from "./helpers/HTMLBuilder";
7
8
  import form_for from "./helpers/form_for";
8
9
  import pagination from "./helpers/pagination_helper";
9
10
  import sort_button from "./helpers/sort_button";
11
+ import Inflector from "./helpers/Inflector";
10
12
 
11
13
  function escapeHtml(string) {
12
14
  var matchHtmlRegExp = /["'&<>]/;
@@ -66,12 +68,6 @@ const renderError = (message, stack) => {
66
68
  return `<style>${errorCSS}</style><div class="fail-squid">🦑</div><h1>${message}</h1><pre>${escapeHtml(stack)}</pre>`;
67
69
  };
68
70
 
69
- const Logger = {
70
- error: (msg) => {
71
- console.error(`\x1b[31m🦑 ${msg}\x1b[0m`);
72
- },
73
- };
74
-
75
71
  function putIn(result, key, value) {
76
72
  const segments = key.split(/[\[\]]+/).filter(Boolean);
77
73
  let current = result;
@@ -164,6 +160,7 @@ export default class Adapter {
164
160
  form_for: form_for(viewHelpersConfig),
165
161
  sort_button,
166
162
  pagination,
163
+ Inflector,
167
164
  };
168
165
  }
169
166
 
@@ -1,4 +1,5 @@
1
1
  import Adapter from "./Adapter";
2
+ import Logger from "./Logger";
2
3
  import RaketaContext from "./RaketaContext";
3
4
  import setupAuthentication from "./setupAuthentication";
4
5
 
@@ -101,6 +102,7 @@ export default class HonoAdapter extends Adapter {
101
102
  ctx.defaultLocale = this.globalConfig.i18n.defaultLocale;
102
103
  ctx.locale = currentLocale;
103
104
  ctx.remoteConfig = { ...this.globalConfig.remoteConfig };
105
+ ctx.logger = Logger;
104
106
 
105
107
  const _context = {
106
108
  timezones: this.globalConfig.i18n.timezones,
@@ -115,9 +117,7 @@ export default class HonoAdapter extends Adapter {
115
117
  resourceConfig: resourceConfig,
116
118
  };
117
119
 
118
- console.info(
119
- `\x1b[35m[${ctx.method}] ${ctx.rawPath}\x1b[0m -> ${resource}/${action} | ${JSON.stringify(ctx.params)}`
120
- );
120
+ ctx.logger.info(`${ctx.method} "${ctx.rawPath}" -> ${resource}/${action} | ${JSON.stringify(ctx.params)}`);
121
121
 
122
122
  const assigns = {
123
123
  beforeFilterAssigns: {},
package/src/Logger.js ADDED
@@ -0,0 +1,21 @@
1
+ import { inspect } from 'node:util';
2
+
3
+
4
+ const dump = (item) => inspect(item, { depth: null }).replace(/^\'/, '').replace(/\'$/, '')
5
+
6
+ const Logger = {
7
+ error: (item) => {
8
+ console.error('[ERROR]', dump(item));
9
+ },
10
+
11
+ info: (item) => {
12
+ console.info('[INFO]', dump(item));
13
+ },
14
+
15
+ debug: (item) => {
16
+ console.debug('[DEBUG]', dump(item));
17
+ },
18
+ }
19
+
20
+ export default Logger;
21
+
@@ -0,0 +1,6 @@
1
+ const Inflector = {
2
+ capitalize: (str) => str[0].toUpperCase() + str.slice(1),
3
+ };
4
+
5
+ export default Inflector;
6
+
package/src/index.js CHANGED
@@ -88,3 +88,5 @@ export { default as EventURLsHandler } from "./handlers/events/URLsHandler";
88
88
  export { default as EventsHandler } from "./handlers/events/EventsHandler";
89
89
 
90
90
  export { default as Factory } from "./tests/support/factory";
91
+ export { default as Logger } from "./Logger";
92
+
@@ -6,17 +6,12 @@
6
6
  --background: 255, 255, 255;
7
7
  --foreground: 0, 0, 0;
8
8
 
9
- /* --primary: 110, 110, 178; */
10
- /* --primary: 0, 0, 0; */
11
- /* --primary: 15, 82, 186; */
12
- /* --primary: 0, 67, 206; */
13
9
  --primary: 91, 95, 198;
14
10
 
15
- /* --primary-dark: 88, 88, 142; */
16
- /* --primary-dark: 0, 0, 0; */
17
11
  --primary-dark: var(--primary);
18
12
  }
19
13
 
14
+ /*
20
15
  @media (prefers-color-scheme: dark) {
21
16
  :root {
22
17
  --foreground: 255, 255, 255;
@@ -24,12 +19,14 @@
24
19
  --primary: 130, 133, 212;
25
20
  }
26
21
  }
22
+ */
27
23
 
28
24
  body {
29
25
  @apply text-raketa-foreground bg-raketa-background;
30
26
  }
31
27
 
32
28
  @layer components {
29
+
33
30
  /* Utils */
34
31
  .dbg {
35
32
  @apply outline-1 outline-dashed outline-red-500;
@@ -278,7 +275,7 @@ body {
278
275
  .pagination {
279
276
  @apply text-center py-8 text-raketa-foreground/50;
280
277
 
281
- & > div {
278
+ &>div {
282
279
  @apply inline-flex items-center gap-4;
283
280
  }
284
281
 
@@ -521,6 +518,7 @@ body {
521
518
  0% {
522
519
  transform: scale(1);
523
520
  }
521
+
524
522
  100% {
525
523
  transform: scale(1.5);
526
524
  }
@@ -534,9 +532,11 @@ body {
534
532
  0% {
535
533
  transform: translatey(0px);
536
534
  }
535
+
537
536
  50% {
538
537
  transform: translatey(-40px);
539
538
  }
539
+
540
540
  100% {
541
541
  transform: translatey(0px);
542
542
  }
@@ -1,6 +1,6 @@
1
1
  <div class="page-wrapper">
2
2
  <div class="page-title">
3
- <h1 class="heading-1"><%= _context.resourceConfig.articleTypePlural %></h1>
3
+ <h1 class="heading-1"><%= Inflector.capitalize(_context.resourceConfig.articleTypePlural) %></h1>
4
4
 
5
5
  <div class="actions-toolbar">
6
6
  <a href="<%= `/${_context.locale}/${_context.resourceConfig.articleTypePlural}/new` %>" class="btn-primary">
@@ -1,6 +1,6 @@
1
1
  <div class="page-wrapper">
2
2
  <div class="page-title">
3
- <h1 class="heading-1"><%= _context.resourceConfig.eventTypePlural %></h1>
3
+ <h1 class="heading-1"><%= Inflector.capitalize(_context.resourceConfig.eventTypePlural) %></h1>
4
4
 
5
5
  <div class="actions-toolbar">
6
6
  <a href="<%= `/${_context.locale}/${_context.resourceConfig.eventTypePlural}/new` %>" class="btn-primary">
@@ -1,6 +1,6 @@
1
1
  <div class="page-wrapper">
2
2
  <div class="page-title">
3
- <h1 class="heading-1"><%= _context.resourceConfig.pageTypePlural %></h1>
3
+ <h1 class="heading-1"><%= Inflector.capitalize(_context.resourceConfig.pageTypePlural) %></h1>
4
4
 
5
5
  <div class="actions-toolbar">
6
6
  <a href="<%= `/${_context.locale}/${_context.resourceConfig.pageTypePlural}/new` %>" class="btn-primary">
@@ -1,6 +1,7 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  module.exports = {
3
3
  content: ["./src/**/*.{html,js,ejs}", "../../apps/**/*.{html,js,ejs}"],
4
+ darkMode: 'selector',
4
5
  theme: {
5
6
  extend: {
6
7
  colors: {