@vulkano/core 1.17.1 → 1.17.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.
Files changed (2) hide show
  1. package/bin/postinstall.js +146 -147
  2. package/package.json +2 -1
@@ -9,6 +9,7 @@
9
9
 
10
10
  const fs = require('fs');
11
11
  const path = require('path');
12
+ const readline = require('readline');
12
13
 
13
14
  // npm sets INIT_CWD to the directory where `npm install` was invoked.
14
15
  // npm_config_local_prefix is the project root (directory containing node_modules).
@@ -23,7 +24,7 @@ if (projectRoot === coreRoot) {
23
24
  process.exit(0);
24
25
  }
25
26
 
26
- const appDir = path.join(projectRoot, 'app');
27
+ const appDir = path.join(projectRoot, 'app');
27
28
  const vulkanoDir = path.join(projectRoot, 'vulkano');
28
29
 
29
30
  if (fs.existsSync(appDir) || fs.existsSync(vulkanoDir)) {
@@ -31,52 +32,31 @@ if (fs.existsSync(appDir) || fs.existsSync(vulkanoDir)) {
31
32
  process.exit(0);
32
33
  }
33
34
 
34
- // ─────────────────────────────────────────────
35
- // Prompt
36
- // ─────────────────────────────────────────────
37
-
38
- const readline = require('readline');
39
-
40
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
41
-
42
- rl.question('\n 🌋 Vulkano: Would you like to scaffold a new project? (Y/n) ', (answer) => {
43
-
44
- rl.close();
45
-
46
- if (answer.trim().toLowerCase() === 'n') {
47
- console.log('\n Skipped. You can scaffold manually at any time.\n');
48
- process.exit(0);
49
- }
50
-
51
- scaffold();
52
-
53
- });
54
-
55
35
  // ─────────────────────────────────────────────
56
36
  // Scaffold
57
37
  // ─────────────────────────────────────────────
58
38
 
59
39
  function scaffold() {
60
40
 
61
- function write(relPath, content) {
62
- const abs = path.join(appDir, relPath);
63
- fs.mkdirSync(path.dirname(abs), { recursive: true });
64
- if (!fs.existsSync(abs)) {
65
- fs.writeFileSync(abs, content, 'utf8');
41
+ function write(relPath, content) {
42
+ const abs = path.join(appDir, relPath);
43
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
44
+ if (!fs.existsSync(abs)) {
45
+ fs.writeFileSync(abs, content, 'utf8');
46
+ }
66
47
  }
67
- }
68
48
 
69
- function dir(relPath) {
70
- const abs = path.join(appDir, relPath);
71
- fs.mkdirSync(abs, { recursive: true });
72
- const keep = path.join(abs, '.gitkeep');
73
- if (!fs.existsSync(keep)) fs.writeFileSync(keep, '', 'utf8');
74
- }
49
+ function dir(relPath) {
50
+ const abs = path.join(appDir, relPath);
51
+ fs.mkdirSync(abs, { recursive: true });
52
+ const keep = path.join(abs, '.gitkeep');
53
+ if (!fs.existsSync(keep)) fs.writeFileSync(keep, '', 'utf8');
54
+ }
75
55
 
76
- // ─────────────────────────────────────────────
77
- // app/config/bootstrap.js (required by Vulkano)
78
- // ─────────────────────────────────────────────
79
- write('config/bootstrap.js', `/**
56
+ // ─────────────────────────────────────────────
57
+ // app/config/bootstrap.js (required by Vulkano)
58
+ // ─────────────────────────────────────────────
59
+ write('config/bootstrap.js', `/**
80
60
  * Bootstrap — called once the server is ready to start.
81
61
  * @param {Function} cb Call cb() to finish startup
82
62
  */
@@ -89,10 +69,10 @@ module.exports = (cb) => {
89
69
  };
90
70
  `);
91
71
 
92
- // ─────────────────────────────────────────────
93
- // app/config/settings.js
94
- // ─────────────────────────────────────────────
95
- write('config/settings.js', `/**
72
+ // ─────────────────────────────────────────────
73
+ // app/config/settings.js
74
+ // ─────────────────────────────────────────────
75
+ write('config/settings.js', `/**
96
76
  * Application settings
97
77
  */
98
78
  module.exports = {
@@ -112,10 +92,10 @@ module.exports = {
112
92
  };
113
93
  `);
114
94
 
115
- // ─────────────────────────────────────────────
116
- // app/config/connections.js
117
- // ─────────────────────────────────────────────
118
- write('config/connections.js', `/**
95
+ // ─────────────────────────────────────────────
96
+ // app/config/connections.js
97
+ // ─────────────────────────────────────────────
98
+ write('config/connections.js', `/**
119
99
  * Database connections
120
100
  * The key here is referenced from settings.js → database.connection
121
101
  */
@@ -126,10 +106,10 @@ module.exports = {
126
106
  };
127
107
  `);
128
108
 
129
- // ─────────────────────────────────────────────
130
- // app/config/routes.js
131
- // ─────────────────────────────────────────────
132
- write('config/routes.js', `/**
109
+ // ─────────────────────────────────────────────
110
+ // app/config/routes.js
111
+ // ─────────────────────────────────────────────
112
+ write('config/routes.js', `/**
133
113
  * Explicit routes (optional)
134
114
  * Format: 'METHOD /path': 'ControllerName.action'
135
115
  *
@@ -153,10 +133,10 @@ module.exports = {
153
133
  };
154
134
  `);
155
135
 
156
- // ─────────────────────────────────────────────
157
- // app/config/express/settings.js
158
- // ─────────────────────────────────────────────
159
- write('config/express/settings.js', `/**
136
+ // ─────────────────────────────────────────────
137
+ // app/config/express/settings.js
138
+ // ─────────────────────────────────────────────
139
+ write('config/express/settings.js', `/**
160
140
  * Express server settings
161
141
  */
162
142
  module.exports = {
@@ -177,10 +157,10 @@ module.exports = {
177
157
  };
178
158
  `);
179
159
 
180
- // ─────────────────────────────────────────────
181
- // app/config/express/cors.js
182
- // ─────────────────────────────────────────────
183
- write('config/express/cors.js', `/**
160
+ // ─────────────────────────────────────────────
161
+ // app/config/express/cors.js
162
+ // ─────────────────────────────────────────────
163
+ write('config/express/cors.js', `/**
184
164
  * CORS configuration
185
165
  */
186
166
  module.exports = {
@@ -200,10 +180,10 @@ module.exports = {
200
180
  };
201
181
  `);
202
182
 
203
- // ─────────────────────────────────────────────
204
- // app/config/express/jwt.js
205
- // ─────────────────────────────────────────────
206
- write('config/express/jwt.js', `/**
183
+ // ─────────────────────────────────────────────
184
+ // app/config/express/jwt.js
185
+ // ─────────────────────────────────────────────
186
+ write('config/express/jwt.js', `/**
207
187
  * JWT authentication middleware
208
188
  */
209
189
  module.exports = {
@@ -265,10 +245,10 @@ module.exports = {
265
245
  };
266
246
  `);
267
247
 
268
- // ─────────────────────────────────────────────
269
- // app/config/express/cookies.js
270
- // ─────────────────────────────────────────────
271
- write('config/express/cookies.js', `/**
248
+ // ─────────────────────────────────────────────
249
+ // app/config/express/cookies.js
250
+ // ─────────────────────────────────────────────
251
+ write('config/express/cookies.js', `/**
272
252
  * Cookie parser
273
253
  */
274
254
  module.exports = {
@@ -287,10 +267,10 @@ module.exports = {
287
267
  };
288
268
  `);
289
269
 
290
- // ─────────────────────────────────────────────
291
- // app/config/encryption.js
292
- // ─────────────────────────────────────────────
293
- write('config/encryption.js', `/**
270
+ // ─────────────────────────────────────────────
271
+ // app/config/encryption.js
272
+ // ─────────────────────────────────────────────
273
+ write('config/encryption.js', `/**
294
274
  * Encryption settings (used by Encrypter)
295
275
  */
296
276
  module.exports = {
@@ -307,10 +287,10 @@ module.exports = {
307
287
  };
308
288
  `);
309
289
 
310
- // ─────────────────────────────────────────────
311
- // app/controllers/HomeController.js
312
- // ─────────────────────────────────────────────
313
- write('controllers/HomeController.js', `/**
290
+ // ─────────────────────────────────────────────
291
+ // app/controllers/HomeController.js
292
+ // ─────────────────────────────────────────────
293
+ write('controllers/HomeController.js', `/**
314
294
  * HomeController
315
295
  * Convention-based routes → GET /home/, GET /home/:id, POST /home/save, etc.
316
296
  *
@@ -327,21 +307,21 @@ module.exports = {
327
307
  };
328
308
  `);
329
309
 
330
- // ─────────────────────────────────────────────
331
- // Empty placeholder directories
332
- // ─────────────────────────────────────────────
333
- dir('models');
334
- dir('services');
335
- dir('responses');
336
-
337
- // ─────────────────────────────────────────────
338
- // app/views structure
339
- // ─────────────────────────────────────────────
340
- dir('views/home');
341
- dir('views/_shared/errors');
342
- dir('views/_shared/templates');
343
-
344
- write('views/_shared/templates/default.html', `<!DOCTYPE html>
310
+ // ─────────────────────────────────────────────
311
+ // Empty placeholder directories
312
+ // ─────────────────────────────────────────────
313
+ dir('models');
314
+ dir('services');
315
+ dir('responses');
316
+
317
+ // ─────────────────────────────────────────────
318
+ // app/views structure
319
+ // ─────────────────────────────────────────────
320
+ dir('views/home');
321
+ dir('views/_shared/errors');
322
+ dir('views/_shared/templates');
323
+
324
+ write('views/_shared/templates/default.html', `<!DOCTYPE html>
345
325
  <html lang="en">
346
326
  <head>
347
327
  <meta charset="UTF-8">
@@ -358,7 +338,7 @@ write('views/_shared/templates/default.html', `<!DOCTYPE html>
358
338
  </html>
359
339
  `);
360
340
 
361
- write('views/home/index.html', `{% extends "_shared/templates/default.html" %}
341
+ write('views/home/index.html', `{% extends "_shared/templates/default.html" %}
362
342
 
363
343
  {% block title %}Home — Vulkano{% endblock %}
364
344
 
@@ -367,7 +347,7 @@ write('views/home/index.html', `{% extends "_shared/templates/default.html" %}
367
347
  {% endblock %}
368
348
  `);
369
349
 
370
- write('views/_shared/errors/404.html', `<!DOCTYPE html>
350
+ write('views/_shared/errors/404.html', `<!DOCTYPE html>
371
351
  <html lang="en">
372
352
  <head>
373
353
  <meta charset="UTF-8">
@@ -379,7 +359,7 @@ write('views/_shared/errors/404.html', `<!DOCTYPE html>
379
359
  </html>
380
360
  `);
381
361
 
382
- write('views/_shared/errors/500.html', `<!DOCTYPE html>
362
+ write('views/_shared/errors/500.html', `<!DOCTYPE html>
383
363
  <html lang="en">
384
364
  <head>
385
365
  <meta charset="UTF-8">
@@ -391,59 +371,78 @@ write('views/_shared/errors/500.html', `<!DOCTYPE html>
391
371
  </html>
392
372
  `);
393
373
 
394
- // public/files for multer uploads
395
- const publicFiles = path.join(projectRoot, 'public', 'files');
396
- fs.mkdirSync(publicFiles, { recursive: true });
397
-
398
- // public/css for css files
399
- const publicCss = path.join(projectRoot, 'public', 'css');
400
- fs.mkdirSync(publicCss, { recursive: true });
401
-
402
- // public/js for js files
403
- const publicJs = path.join(projectRoot, 'public', 'js');
404
- fs.mkdirSync(publicJs, { recursive: true });
405
-
406
- // public/img for image files
407
- const publicImg = path.join(projectRoot, 'public', 'img');
408
- fs.mkdirSync(publicImg, { recursive: true });
409
-
410
- // public/fonts for font files
411
- const publicFonts = path.join(projectRoot, 'public', 'fonts');
412
- fs.mkdirSync(publicFonts, { recursive: true });
413
-
414
- // .env example
415
- const envExample = path.join(projectRoot, '.env');
416
- if (!fs.existsSync(envExample)) {
417
- fs.writeFileSync(envExample, [
418
- '# Copy to .env and fill in your values',
419
- 'PORT=8000',
420
- 'MONGO_URI=',
421
- 'JWT_SECRET=',
422
- 'COOKIE_SECRET=',
423
- 'ENCRYPTION_KEY=',
424
- 'ENCRYPTION_SALT=salt',
425
- 'ENCRYPTION_ALGORITHM=aes-256-cbc',
426
- ''
427
- ].join('\n'), 'utf8');
428
- }
374
+ // public/files for multer uploads
375
+ const publicFiles = path.join(projectRoot, 'public', 'files');
376
+ fs.mkdirSync(publicFiles, { recursive: true });
377
+
378
+ // public/css for css files
379
+ const publicCss = path.join(projectRoot, 'public', 'css');
380
+ fs.mkdirSync(publicCss, { recursive: true });
381
+
382
+ // public/js for js files
383
+ const publicJs = path.join(projectRoot, 'public', 'js');
384
+ fs.mkdirSync(publicJs, { recursive: true });
385
+
386
+ // public/img for image files
387
+ const publicImg = path.join(projectRoot, 'public', 'img');
388
+ fs.mkdirSync(publicImg, { recursive: true });
389
+
390
+ // public/fonts for font files
391
+ const publicFonts = path.join(projectRoot, 'public', 'fonts');
392
+ fs.mkdirSync(publicFonts, { recursive: true });
393
+
394
+ // .env example
395
+ const envExample = path.join(projectRoot, '.env');
396
+ if (!fs.existsSync(envExample)) {
397
+ fs.writeFileSync(envExample, [
398
+ '# Copy to .env and fill in your values',
399
+ 'PORT=8000',
400
+ 'MONGO_URI=',
401
+ 'JWT_SECRET=',
402
+ 'COOKIE_SECRET=',
403
+ 'ENCRYPTION_KEY=',
404
+ 'ENCRYPTION_SALT=salt',
405
+ 'ENCRYPTION_ALGORITHM=aes-256-cbc',
406
+ ''
407
+ ].join('\n'), 'utf8');
408
+ }
409
+
410
+ console.log([
411
+ '',
412
+ ' ✔ Vulkano scaffold created:',
413
+ ' app/config/ ← settings, connections, routes, express, jwt…',
414
+ ' app/controllers/ ← HomeController.js',
415
+ ' app/models/ ← (empty — add your models here)',
416
+ ' app/services/ ← (empty — add your services here)',
417
+ ' app/views/ ← home/index.html, _shared/templates/default.html, errors/404, 500',
418
+ ' public/css/ ← css files',
419
+ ' public/js/ ← js files',
420
+ ' public/img/ ← image files',
421
+ ' public/fonts/ ← font files',
422
+ ' .env ← fill in values',
423
+ '',
424
+ ' Next steps:',
425
+ ' 1. Set MONGO_URI, JWT_SECRET, etc.',
426
+ '',
427
+ ].join('\n'));
428
+
429
+ } // end scaffold()
429
430
 
430
- console.log([
431
- '',
432
- ' ✔ Vulkano scaffold created:',
433
- ' app/config/ ← settings, connections, routes, express, jwt…',
434
- ' app/controllers/ ← HomeController.js',
435
- ' app/models/ ← (empty — add your models here)',
436
- ' app/services/ ← (empty add your services here)',
437
- ' app/views/ ← home/index.html, _shared/templates/default.html, errors/404, 500',
438
- ' public/css/ ← css files',
439
- ' public/js/ ← js files',
440
- ' public/img/ ← image files',
441
- ' public/fonts/ ← font files',
442
- ' .env ← fill in values',
443
- '',
444
- ' Next steps:',
445
- ' 1. Set MONGO_URI, JWT_SECRET, etc.',
446
- '',
447
- ].join('\n'));
448
-
449
- } // end scaffold()
431
+ // ─────────────────────────────────────────────
432
+ // Prompt
433
+ // ─────────────────────────────────────────────
434
+
435
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
436
+
437
+ rl.question('\n 🌋 Vulkano: Would you like to scaffold a new project? (Y/n) ', (answer) => {
438
+
439
+ rl.close();
440
+
441
+ if (answer.trim().toLowerCase() === 'n') {
442
+ console.log('\n Skipped. You can scaffold manually at any time.\n');
443
+ process.exit(0);
444
+ }
445
+
446
+ scaffold();
447
+
448
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulkano/core",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "A MVC framework using Express 4",
5
5
  "license": "MIT",
6
6
  "author": "Vulkano Team",
@@ -54,6 +54,7 @@
54
54
  "nunjucks": "^3.2.4",
55
55
  "redis": "^5.12.1",
56
56
  "socket.io": "^4.8.1",
57
+ "socket.io-adapter": "^2.5.6",
57
58
  "undici": "^6.25.0"
58
59
  },
59
60
  "devDependencies": {