@seip/blue-bird 0.4.5 → 0.4.7
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/.env_example +26 -25
- package/AGENTS.md +199 -199
- package/README.md +79 -79
- package/backend/index.js +13 -13
- package/backend/routes/frontend.js +41 -41
- package/backend/routes/seo.js +39 -39
- package/core/app.js +330 -325
- package/core/auth.js +142 -114
- package/core/cache.js +44 -44
- package/core/cli/component.js +42 -42
- package/core/cli/init.js +119 -118
- package/core/cli/react.js +435 -435
- package/core/cli/route.js +42 -42
- package/core/config.js +51 -47
- package/core/debug.js +248 -248
- package/core/logger.js +100 -100
- package/core/middleware.js +27 -27
- package/core/router.js +333 -333
- package/core/seo.js +95 -100
- package/core/template.js +478 -462
- package/core/upload.js +77 -76
- package/core/validate.js +380 -380
- package/frontend/index.html +31 -26
- package/frontend/landing.html +70 -69
- package/frontend/resources/css/tailwind.css +17 -17
- package/frontend/resources/js/App.jsx +70 -70
- package/frontend/resources/js/Main.jsx +18 -18
- package/frontend/resources/js/blue-bird/components/Button.jsx +67 -67
- package/frontend/resources/js/blue-bird/components/Card.jsx +18 -18
- package/frontend/resources/js/blue-bird/components/DataTable.jsx +126 -126
- package/frontend/resources/js/blue-bird/components/Input.jsx +21 -21
- package/frontend/resources/js/blue-bird/components/Label.jsx +12 -12
- package/frontend/resources/js/blue-bird/components/LanguageButton.jsx +23 -23
- package/frontend/resources/js/blue-bird/components/Link.jsx +15 -15
- package/frontend/resources/js/blue-bird/components/Modal.jsx +27 -27
- package/frontend/resources/js/blue-bird/components/Skeleton.jsx +44 -44
- package/frontend/resources/js/blue-bird/components/Translate.jsx +12 -12
- package/frontend/resources/js/blue-bird/components/Typography.jsx +69 -69
- package/frontend/resources/js/blue-bird/contexts/LanguageContext.jsx +41 -41
- package/frontend/resources/js/blue-bird/contexts/SPAContext.jsx +239 -237
- package/frontend/resources/js/blue-bird/contexts/SnackbarContext.jsx +38 -38
- package/frontend/resources/js/blue-bird/contexts/ThemeContext.jsx +49 -49
- package/frontend/resources/js/blue-bird/locales/en.json +47 -47
- package/frontend/resources/js/blue-bird/locales/es.json +47 -47
- package/frontend/resources/js/components/Header.jsx +55 -55
- package/frontend/resources/js/pages/About.jsx +31 -31
- package/frontend/resources/js/pages/Home.jsx +82 -82
- package/package.json +1 -1
- package/vite.config.js +22 -22
- package/frontend/public/robots.txt +0 -0
- package/frontend/public/sitemap.xml +0 -0
package/core/cli/route.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import Config from "../config.js";
|
|
4
|
-
|
|
5
|
-
const __dirname = Config.dirname();
|
|
6
|
-
|
|
7
|
-
class RouteCLI {
|
|
8
|
-
/**
|
|
9
|
-
* Create route
|
|
10
|
-
*/
|
|
11
|
-
create() {
|
|
12
|
-
let nameRoute = process.argv[2];
|
|
13
|
-
if (!nameRoute) {
|
|
14
|
-
console.log("Please provide a route name. Usage: npm run route <route-name>");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
nameRoute =nameRoute.charAt(0).toUpperCase() + nameRoute.slice(1);
|
|
18
|
-
const folder= path.join(__dirname, 'backend/routes');
|
|
19
|
-
if (!fs.existsSync(folder)){
|
|
20
|
-
fs.mkdirSync(folder, { recursive: true });
|
|
21
|
-
}
|
|
22
|
-
const filePath = path.join(folder, `${nameRoute}.js`);
|
|
23
|
-
if (fs.existsSync(filePath)) {
|
|
24
|
-
console.log(`Route ${nameRoute} already exists.`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const content =`import Router from "@seip/blue-bird/core/router.js"
|
|
28
|
-
|
|
29
|
-
const router${nameRoute} = new Router("/${nameRoute.toLowerCase()}");
|
|
30
|
-
|
|
31
|
-
router${nameRoute}.get("/", (req, res) => {
|
|
32
|
-
res.json({ message: "Hello from ${nameRoute} route!" });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export default router${nameRoute};
|
|
36
|
-
`;
|
|
37
|
-
fs.writeFileSync(filePath, content);
|
|
38
|
-
console.log(`Route ${nameRoute} created successfully at ${filePath}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const routeCLI = new RouteCLI();
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import Config from "../config.js";
|
|
4
|
+
|
|
5
|
+
const __dirname = Config.dirname();
|
|
6
|
+
|
|
7
|
+
class RouteCLI {
|
|
8
|
+
/**
|
|
9
|
+
* Create route
|
|
10
|
+
*/
|
|
11
|
+
create() {
|
|
12
|
+
let nameRoute = process.argv[2];
|
|
13
|
+
if (!nameRoute) {
|
|
14
|
+
console.log("Please provide a route name. Usage: npm run route <route-name>");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
nameRoute =nameRoute.charAt(0).toUpperCase() + nameRoute.slice(1);
|
|
18
|
+
const folder= path.join(__dirname, 'backend/routes');
|
|
19
|
+
if (!fs.existsSync(folder)){
|
|
20
|
+
fs.mkdirSync(folder, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
const filePath = path.join(folder, `${nameRoute}.js`);
|
|
23
|
+
if (fs.existsSync(filePath)) {
|
|
24
|
+
console.log(`Route ${nameRoute} already exists.`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const content =`import Router from "@seip/blue-bird/core/router.js"
|
|
28
|
+
|
|
29
|
+
const router${nameRoute} = new Router("/${nameRoute.toLowerCase()}");
|
|
30
|
+
|
|
31
|
+
router${nameRoute}.get("/", (req, res) => {
|
|
32
|
+
res.json({ message: "Hello from ${nameRoute} route!" });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default router${nameRoute};
|
|
36
|
+
`;
|
|
37
|
+
fs.writeFileSync(filePath, content);
|
|
38
|
+
console.log(`Route ${nameRoute} created successfully at ${filePath}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const routeCLI = new RouteCLI();
|
|
43
43
|
routeCLI.create()
|
package/core/config.js
CHANGED
|
@@ -1,47 +1,51 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
let _cachedProps = null;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Configuration class to manage application-wide settings and environment variables.
|
|
7
|
-
*/
|
|
8
|
-
class Config {
|
|
9
|
-
/**
|
|
10
|
-
* Returns the base directory of the application.
|
|
11
|
-
* @returns {string} The current working directory.
|
|
12
|
-
*/
|
|
13
|
-
static dirname() {
|
|
14
|
-
return process.cwd();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Retrieves application properties from environment variables or default values.
|
|
19
|
-
* Results are cached after first call for performance.
|
|
20
|
-
* @returns {Object} The configuration properties object.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
3
|
+
let _cachedProps = null;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration class to manage application-wide settings and environment variables.
|
|
7
|
+
*/
|
|
8
|
+
class Config {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the base directory of the application.
|
|
11
|
+
* @returns {string} The current working directory.
|
|
12
|
+
*/
|
|
13
|
+
static dirname() {
|
|
14
|
+
return process.cwd();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves application properties from environment variables or default values.
|
|
19
|
+
* Results are cached after first call for performance.
|
|
20
|
+
* @returns {{debug: boolean, descriptionMeta: string, keywordsMeta: string, titleMeta: string, authorMeta: string, description: string, title: string, version: string, langMeta: string, host: string, appUrl: string, port: number, static: {path: string, options: Object}}} The configuration properties object.
|
|
21
|
+
* @example
|
|
22
|
+
* const props = Config.props();
|
|
23
|
+
* console.log(props);
|
|
24
|
+
*/
|
|
25
|
+
static props() {
|
|
26
|
+
if (_cachedProps) return _cachedProps;
|
|
27
|
+
|
|
28
|
+
const portRaw = parseInt(process.env.PORT);
|
|
29
|
+
|
|
30
|
+
_cachedProps = {
|
|
31
|
+
debug: process.env.DEBUG === "true",
|
|
32
|
+
descriptionMeta: process.env.DESCRIPTION_META || "",
|
|
33
|
+
keywordsMeta: process.env.KEYWORDS_META || "",
|
|
34
|
+
titleMeta: process.env.TITLE_META || "",
|
|
35
|
+
authorMeta: process.env.AUTHOR_META || "",
|
|
36
|
+
description: process.env.DESCRIPTION || "",
|
|
37
|
+
title: process.env.TITLE || "",
|
|
38
|
+
version: process.env.VERSION || "1.0.0",
|
|
39
|
+
langMeta: process.env.LANGMETA || "en",
|
|
40
|
+
host: process.env.HOST || "http://localhost",
|
|
41
|
+
appUrl: process.env.APP_URL || process.env.HOST || "http://localhost",
|
|
42
|
+
port: Number.isNaN(portRaw) ? 3000 : portRaw,
|
|
43
|
+
static: {
|
|
44
|
+
path: process.env.STATIC_PATH || "frontend/public",
|
|
45
|
+
options: {},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
return _cachedProps;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export default Config;
|