@seip/blue-bird 0.4.5 → 0.4.6

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.
Files changed (51) hide show
  1. package/.env_example +26 -25
  2. package/AGENTS.md +199 -199
  3. package/README.md +79 -79
  4. package/backend/index.js +13 -13
  5. package/backend/routes/frontend.js +41 -41
  6. package/backend/routes/seo.js +39 -39
  7. package/core/app.js +328 -325
  8. package/core/auth.js +114 -114
  9. package/core/cache.js +44 -44
  10. package/core/cli/component.js +42 -42
  11. package/core/cli/init.js +119 -118
  12. package/core/cli/react.js +435 -435
  13. package/core/cli/route.js +42 -42
  14. package/core/config.js +48 -47
  15. package/core/debug.js +248 -248
  16. package/core/logger.js +100 -100
  17. package/core/middleware.js +27 -27
  18. package/core/router.js +333 -333
  19. package/core/seo.js +95 -100
  20. package/core/template.js +472 -462
  21. package/core/upload.js +76 -76
  22. package/core/validate.js +380 -380
  23. package/frontend/index.html +26 -26
  24. package/frontend/landing.html +69 -69
  25. package/frontend/resources/css/tailwind.css +17 -17
  26. package/frontend/resources/js/App.jsx +70 -70
  27. package/frontend/resources/js/Main.jsx +18 -18
  28. package/frontend/resources/js/blue-bird/components/Button.jsx +67 -67
  29. package/frontend/resources/js/blue-bird/components/Card.jsx +18 -18
  30. package/frontend/resources/js/blue-bird/components/DataTable.jsx +126 -126
  31. package/frontend/resources/js/blue-bird/components/Input.jsx +21 -21
  32. package/frontend/resources/js/blue-bird/components/Label.jsx +12 -12
  33. package/frontend/resources/js/blue-bird/components/LanguageButton.jsx +23 -23
  34. package/frontend/resources/js/blue-bird/components/Link.jsx +15 -15
  35. package/frontend/resources/js/blue-bird/components/Modal.jsx +27 -27
  36. package/frontend/resources/js/blue-bird/components/Skeleton.jsx +44 -44
  37. package/frontend/resources/js/blue-bird/components/Translate.jsx +12 -12
  38. package/frontend/resources/js/blue-bird/components/Typography.jsx +69 -69
  39. package/frontend/resources/js/blue-bird/contexts/LanguageContext.jsx +41 -41
  40. package/frontend/resources/js/blue-bird/contexts/SPAContext.jsx +239 -237
  41. package/frontend/resources/js/blue-bird/contexts/SnackbarContext.jsx +38 -38
  42. package/frontend/resources/js/blue-bird/contexts/ThemeContext.jsx +49 -49
  43. package/frontend/resources/js/blue-bird/locales/en.json +47 -47
  44. package/frontend/resources/js/blue-bird/locales/es.json +47 -47
  45. package/frontend/resources/js/components/Header.jsx +55 -55
  46. package/frontend/resources/js/pages/About.jsx +31 -31
  47. package/frontend/resources/js/pages/Home.jsx +82 -82
  48. package/package.json +57 -57
  49. package/vite.config.js +22 -22
  50. package/frontend/public/robots.txt +0 -0
  51. package/frontend/public/sitemap.xml +0 -0
package/core/logger.js CHANGED
@@ -1,100 +1,100 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import Config from "./config.js"
4
-
5
- const __dirname = Config.dirname()
6
-
7
- /**
8
- * Logger class for managing application logs by creating dated folders and log files.
9
- */
10
- class Logger {
11
-
12
- /**
13
- * Initializes the Logger instance and ensures the logs directory exists.
14
- */
15
- constructor() {
16
- this.folder = path.join(__dirname, "logs");
17
- this._currentDay = null;
18
- this._currentDayFolder = null;
19
- if (!fs.existsSync(this.folder)) {
20
- fs.mkdirSync(this.folder, { recursive: true });
21
- }
22
- }
23
-
24
- /**
25
- * Ensures and returns the path to the log folder for the current day.
26
- * Caches the folder path for the current day to avoid repeated fs checks.
27
- * @returns {string} The absolute path to the current day's log folder.
28
- */
29
- nowFolder() {
30
- const today = this.now();
31
-
32
- if (this._currentDay === today && this._currentDayFolder) {
33
- return this._currentDayFolder;
34
- }
35
-
36
- const folder = path.join(this.folder, today);
37
-
38
- if (!fs.existsSync(folder)) {
39
- fs.mkdirSync(folder, { recursive: true });
40
- }
41
-
42
- this._currentDay = today;
43
- this._currentDayFolder = folder;
44
- return folder;
45
- }
46
-
47
- /**
48
- * Gets the current date formatted as YYYY-MM-DD.
49
- * @returns {string} The formatted date string.
50
- */
51
- now() {
52
- return new Date().toISOString().split("T")[0];
53
- }
54
-
55
- /**
56
- * Appends an informational message to the info.log file (non-blocking).
57
- * @param {string} message - The message to log.
58
- */
59
- info(message) {
60
- const logFile = path.join(this.nowFolder(), 'info.log');
61
- fs.appendFile(logFile, `${message}\n`, (err) => {
62
- if (err) console.error('Logger write error:', err.message);
63
- });
64
- }
65
-
66
- /**
67
- * Appends an error message to the error.log file (non-blocking).
68
- * @param {string} message - The error message to log.
69
- */
70
- error(message) {
71
- const logFile = path.join(this.nowFolder(), 'error.log');
72
- fs.appendFile(logFile, `${message}\n`, (err) => {
73
- if (err) console.error('Logger write error:', err.message);
74
- });
75
- }
76
-
77
- /**
78
- * Appends a warning message to the warn.log file (non-blocking).
79
- * @param {string} message - The warning message to log.
80
- */
81
- warning(message) {
82
- const logFile = path.join(this.nowFolder(), 'warn.log');
83
- fs.appendFile(logFile, `${message}\n`, (err) => {
84
- if (err) console.error('Logger write error:', err.message);
85
- });
86
- }
87
-
88
- /**
89
- * Appends a debug message to the debug.log file (non-blocking).
90
- * @param {string} message - The debug message to log.
91
- */
92
- debug(message) {
93
- const logFile = path.join(this.nowFolder(), 'debug.log');
94
- fs.appendFile(logFile, `${message}\n`, (err) => {
95
- if (err) console.error('Logger write error:', err.message);
96
- });
97
- }
98
- }
99
-
100
- export default Logger;
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import Config from "./config.js"
4
+
5
+ const __dirname = Config.dirname()
6
+
7
+ /**
8
+ * Logger class for managing application logs by creating dated folders and log files.
9
+ */
10
+ class Logger {
11
+
12
+ /**
13
+ * Initializes the Logger instance and ensures the logs directory exists.
14
+ */
15
+ constructor() {
16
+ this.folder = path.join(__dirname, "logs");
17
+ this._currentDay = null;
18
+ this._currentDayFolder = null;
19
+ if (!fs.existsSync(this.folder)) {
20
+ fs.mkdirSync(this.folder, { recursive: true });
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Ensures and returns the path to the log folder for the current day.
26
+ * Caches the folder path for the current day to avoid repeated fs checks.
27
+ * @returns {string} The absolute path to the current day's log folder.
28
+ */
29
+ nowFolder() {
30
+ const today = this.now();
31
+
32
+ if (this._currentDay === today && this._currentDayFolder) {
33
+ return this._currentDayFolder;
34
+ }
35
+
36
+ const folder = path.join(this.folder, today);
37
+
38
+ if (!fs.existsSync(folder)) {
39
+ fs.mkdirSync(folder, { recursive: true });
40
+ }
41
+
42
+ this._currentDay = today;
43
+ this._currentDayFolder = folder;
44
+ return folder;
45
+ }
46
+
47
+ /**
48
+ * Gets the current date formatted as YYYY-MM-DD.
49
+ * @returns {string} The formatted date string.
50
+ */
51
+ now() {
52
+ return new Date().toISOString().split("T")[0];
53
+ }
54
+
55
+ /**
56
+ * Appends an informational message to the info.log file (non-blocking).
57
+ * @param {string} message - The message to log.
58
+ */
59
+ info(message) {
60
+ const logFile = path.join(this.nowFolder(), 'info.log');
61
+ fs.appendFile(logFile, `${message}\n`, (err) => {
62
+ if (err) console.error('Logger write error:', err.message);
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Appends an error message to the error.log file (non-blocking).
68
+ * @param {string} message - The error message to log.
69
+ */
70
+ error(message) {
71
+ const logFile = path.join(this.nowFolder(), 'error.log');
72
+ fs.appendFile(logFile, `${message}\n`, (err) => {
73
+ if (err) console.error('Logger write error:', err.message);
74
+ });
75
+ }
76
+
77
+ /**
78
+ * Appends a warning message to the warn.log file (non-blocking).
79
+ * @param {string} message - The warning message to log.
80
+ */
81
+ warning(message) {
82
+ const logFile = path.join(this.nowFolder(), 'warn.log');
83
+ fs.appendFile(logFile, `${message}\n`, (err) => {
84
+ if (err) console.error('Logger write error:', err.message);
85
+ });
86
+ }
87
+
88
+ /**
89
+ * Appends a debug message to the debug.log file (non-blocking).
90
+ * @param {string} message - The debug message to log.
91
+ */
92
+ debug(message) {
93
+ const logFile = path.join(this.nowFolder(), 'debug.log');
94
+ fs.appendFile(logFile, `${message}\n`, (err) => {
95
+ if (err) console.error('Logger write error:', err.message);
96
+ });
97
+ }
98
+ }
99
+
100
+ export default Logger;
@@ -1,27 +1,27 @@
1
- import Auth from "./auth.js";
2
-
3
- /**
4
- * Common middlewares for the Blue Bird framework.
5
- */
6
- const Middleware = {
7
- /**
8
- * Authentication protection middleware.
9
- * @type {Function}
10
- */
11
- auth: Auth.protect(),
12
-
13
- /**
14
- * Web authentication protection middleware (redirects to home if fails).
15
- * @type {Function}
16
- */
17
- webAuth: Auth.protect({ redirect: "/" }),
18
-
19
- /**
20
- * Logging middleware (can be extended).
21
- */
22
- logger: (req, res, next) => {
23
- next();
24
- }
25
- };
26
-
27
- export default Middleware;
1
+ import Auth from "./auth.js";
2
+
3
+ /**
4
+ * Common middlewares for the Blue Bird framework.
5
+ */
6
+ const Middleware = {
7
+ /**
8
+ * Authentication protection middleware.
9
+ * @type {Function}
10
+ */
11
+ auth: Auth.protect(),
12
+
13
+ /**
14
+ * Web authentication protection middleware (redirects to home if fails).
15
+ * @type {Function}
16
+ */
17
+ webAuth: Auth.protect({ redirect: "/" }),
18
+
19
+ /**
20
+ * Logging middleware (can be extended).
21
+ */
22
+ logger: (req, res, next) => {
23
+ next();
24
+ }
25
+ };
26
+
27
+ export default Middleware;