zyket 1.1.1 → 1.1.2
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/.claude/settings.json +3 -0
- package/index.js +3 -1
- package/package.json +20 -16
- package/src/services/index.js +3 -1
- package/src/services/template-manager/index.js +3 -2
- package/src/services/vite/index.js +76 -0
- package/src/templates/default/frontend/index.html +13 -0
- package/src/templates/default/frontend/main.jsx +6 -0
- package/src/templates/default/frontend/styles.css +1 -0
- package/src/templates/default/frontend/vite.config.js +11 -0
- package/src/utils/EnvManager.js +4 -1
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const InteractiveStorageExtension = require("./src/extensions/interactive-storag
|
|
|
13
13
|
const AuthService = require("./src/services/auth");
|
|
14
14
|
const MulterMiddleware = require("./src/extensions/interactive-storage/middlewares/MulterMiddleware");
|
|
15
15
|
const RedirectResponse = require("./src/services/express/RedirectResponse");
|
|
16
|
+
const ViteService = require("./src/services/vite");
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
module.exports = {
|
|
@@ -27,5 +28,6 @@ module.exports = {
|
|
|
27
28
|
Extension,
|
|
28
29
|
AuthService,
|
|
29
30
|
MulterMiddleware,
|
|
30
|
-
RedirectResponse
|
|
31
|
+
RedirectResponse,
|
|
32
|
+
ViteService,
|
|
31
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zyket",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -13,27 +13,31 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"description": "",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@bull-board/express": "^6.
|
|
17
|
-
"
|
|
18
|
-
"
|
|
16
|
+
"@bull-board/express": "^6.20.6",
|
|
17
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
18
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
19
|
+
"better-auth": "^1.5.6",
|
|
20
|
+
"bullmq": "^5.71.0",
|
|
19
21
|
"colors": "^1.4.0",
|
|
20
|
-
"cors": "^2.8.
|
|
21
|
-
"dotenv": "^17.
|
|
22
|
-
"express": "^5.1
|
|
22
|
+
"cors": "^2.8.6",
|
|
23
|
+
"dotenv": "^17.3.1",
|
|
24
|
+
"express": "^5.2.1",
|
|
23
25
|
"fast-glob": "^3.3.3",
|
|
24
|
-
"mariadb": "^3.
|
|
25
|
-
"minio": "^8.0.
|
|
26
|
-
"multer": "^2.
|
|
26
|
+
"mariadb": "^3.5.2",
|
|
27
|
+
"minio": "^8.0.7",
|
|
28
|
+
"multer": "^2.1.1",
|
|
27
29
|
"node-cron": "^4.2.1",
|
|
28
|
-
"node-dependency-injection": "^3.2.
|
|
29
|
-
"pg": "^8.
|
|
30
|
+
"node-dependency-injection": "^3.2.6",
|
|
31
|
+
"pg": "^8.20.0",
|
|
30
32
|
"prompts": "^2.4.2",
|
|
31
|
-
"redis": "^5.
|
|
32
|
-
"sequelize": "^6.37.
|
|
33
|
-
"socket.io": "^4.8.
|
|
33
|
+
"redis": "^5.11.0",
|
|
34
|
+
"sequelize": "^6.37.8",
|
|
35
|
+
"socket.io": "^4.8.3",
|
|
34
36
|
"sqlite3": "^6.0.1",
|
|
35
37
|
"swagger-jsdoc": "^6.2.8",
|
|
36
38
|
"swagger-ui-express": "^5.0.1",
|
|
37
|
-
"
|
|
39
|
+
"tailwindcss": "^4.2.2",
|
|
40
|
+
"umzug": "^3.8.2",
|
|
41
|
+
"vite": "^8.0.1"
|
|
38
42
|
}
|
|
39
43
|
}
|
package/src/services/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const s3Activated = process.env.S3_ENDPOINT && process.env.S3_ACCESS_KEY && proc
|
|
|
14
14
|
const schedulerActivated = process.env.DISABLE_SCHEDULER !== 'true';
|
|
15
15
|
const socketActivated = process.env.DISABLE_SOCKET !== 'true';
|
|
16
16
|
const expressActivated = process.env.DISABLE_EXPRESS !== 'true';
|
|
17
|
+
const viteActivated = process.env.VITE_ROOT && process.env.DISABLE_VITE !== 'true';
|
|
17
18
|
|
|
18
19
|
module.exports = [
|
|
19
20
|
["logger", require("./logger"), ["@service_container", process.env.LOG_DIRECTORY || `${process.cwd()}/logs`, process.env.DEBUG === "true"]],
|
|
@@ -25,5 +26,6 @@ module.exports = [
|
|
|
25
26
|
schedulerActivated ? ["scheduler", Scheduler, ["@service_container"]] : null,
|
|
26
27
|
bullmqActivated ? ["bullmq", require("./bullmq"), ["@service_container"]] : null,
|
|
27
28
|
socketActivated ? ["socketio", SocketIO, ["@service_container"]] : null,
|
|
28
|
-
expressActivated ? ["express", Express, ["@service_container"]] : null
|
|
29
|
+
expressActivated ? ["express", Express, ["@service_container"]] : null,
|
|
30
|
+
viteActivated ? ["vite", require("./vite"), ["@service_container", process.env.VITE_ROOT, Number(process.env.VITE_PORT) || 5173]] : null,
|
|
29
31
|
].filter(Boolean);
|
|
@@ -11,13 +11,14 @@ module.exports = class TemplateManager extends Service {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async boot() {
|
|
14
|
-
const zyketTemplates = await fg(['
|
|
14
|
+
const zyketTemplates = await fg(['**/*'], {
|
|
15
15
|
cwd: path.join(__dirname, '../../templates'),
|
|
16
16
|
});
|
|
17
|
+
console.log('Found templates:', zyketTemplates);
|
|
17
18
|
for (const template of zyketTemplates) {
|
|
18
19
|
const templatePath = path.join(__dirname, '../../templates', template);
|
|
19
20
|
const templateContent = fs.readFileSync(templatePath, 'utf-8');
|
|
20
|
-
this.templates[template.replace('.js', '')] = {
|
|
21
|
+
this.templates[template.replace('.jsx', '').replace('.js', '').replace('.html', '').replace('.css', '')] = {
|
|
21
22
|
route: template,
|
|
22
23
|
content: templateContent
|
|
23
24
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const Service = require("../Service");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
module.exports = class Vite extends Service {
|
|
6
|
+
#container;
|
|
7
|
+
#viteServer;
|
|
8
|
+
#root;
|
|
9
|
+
#port;
|
|
10
|
+
|
|
11
|
+
constructor(container, root, port) {
|
|
12
|
+
super("vite");
|
|
13
|
+
this.#container = container;
|
|
14
|
+
this.#root = path.resolve(process.cwd(), root || process.cwd());
|
|
15
|
+
this.#port = port || 5173;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async boot() {
|
|
19
|
+
await this.#loadViteFolder();
|
|
20
|
+
const { createServer } = await import("vite");
|
|
21
|
+
|
|
22
|
+
const configFile = this.#resolveConfigFile();
|
|
23
|
+
|
|
24
|
+
this.#viteServer = await createServer({
|
|
25
|
+
root: this.#root,
|
|
26
|
+
configFile,
|
|
27
|
+
server: {
|
|
28
|
+
port: this.#port,
|
|
29
|
+
strictPort: false,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
await this.#viteServer.listen();
|
|
34
|
+
|
|
35
|
+
const resolvedPort = this.#viteServer.httpServer?.address()?.port ?? this.#port;
|
|
36
|
+
this.#container.get("logger").info(
|
|
37
|
+
`Vite dev server running on http://localhost:${resolvedPort} (root: ${this.#viteServer.config.root})`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#resolveConfigFile() {
|
|
42
|
+
const candidates = ["vite.config.js", "vite.config.ts", "vite.config.mjs"];
|
|
43
|
+
for (const candidate of candidates) {
|
|
44
|
+
const fullPath = path.join(this.#root, candidate);
|
|
45
|
+
if (fs.existsSync(fullPath)) return fullPath;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async #loadViteFolder() {
|
|
51
|
+
// exists folder named procces.env.VITE_ROOT in root of project, if not create it and add index.html and main.jsx
|
|
52
|
+
const viteRoot = path.join(process.cwd(), process.env.VITE_ROOT || "frontend");
|
|
53
|
+
|
|
54
|
+
if (!fs.existsSync(viteRoot)) fs.mkdirSync(viteRoot, { recursive: true });
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(path.join(viteRoot, "index.html"))) {
|
|
57
|
+
this.#container.get('template-manager').installFile('default/frontend/index', path.join(process.cwd(), process.env.VITE_ROOT || "frontend", "index.html"));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!fs.existsSync(path.join(viteRoot, "main.jsx"))) {
|
|
61
|
+
this.#container.get('template-manager').installFile('default/frontend/main', path.join(process.cwd(), process.env.VITE_ROOT || "frontend", "main.jsx"));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!fs.existsSync(path.join(viteRoot, "vite.config.js"))) {
|
|
65
|
+
this.#container.get('template-manager').installFile('default/frontend/vite.config', path.join(process.cwd(), process.env.VITE_ROOT || "frontend", "vite.config.js"));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!fs.existsSync(path.join(viteRoot, "styles.css"))) {
|
|
69
|
+
this.#container.get('template-manager').installFile('default/frontend/styles', path.join(process.cwd(), process.env.VITE_ROOT || "frontend", "styles.css"));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
server() {
|
|
74
|
+
return this.#viteServer;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Test Website</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="./main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "tailwindcss";
|
package/src/utils/EnvManager.js
CHANGED
|
@@ -15,7 +15,7 @@ module.exports = class EnvManager {
|
|
|
15
15
|
const envsToCreate = {
|
|
16
16
|
DEBUG: true,
|
|
17
17
|
PORT: 3000,
|
|
18
|
-
DISABLE_SOCKET:
|
|
18
|
+
DISABLE_SOCKET: true,
|
|
19
19
|
DISABLE_EXPRESS: false,
|
|
20
20
|
DISABLE_EVENTS: true,
|
|
21
21
|
DISABLE_BULLMQ: true,
|
|
@@ -30,6 +30,9 @@ module.exports = class EnvManager {
|
|
|
30
30
|
S3_SECRET_KEY: '',
|
|
31
31
|
LOG_DIRECTORY: "./logs",
|
|
32
32
|
QUEUES: '',
|
|
33
|
+
VITE_ROOT: './frontend',
|
|
34
|
+
VITE_PORT: 5173,
|
|
35
|
+
DISABLE_VITE: true,
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
return Object.entries(envsToCreate).reduce((acc, [key, value]) => {
|