@vulkano/core 1.18.0 → 1.18.1

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/.oxlintrc.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "env": {
3
+ "node": true,
4
+ "browser": true,
5
+ "es6": true
6
+ },
7
+ "globals": {
8
+ "app": "readonly",
9
+ "io": "readonly",
10
+ "ApiClient": "readonly",
11
+ "Download": "readonly",
12
+ "Paginate": "readonly",
13
+ "Mixed": "readonly",
14
+ "Crontab": "readonly",
15
+ "Encrypter": "readonly",
16
+ "Filter": "readonly",
17
+ "i18n": "readonly",
18
+ "Jwt": "readonly",
19
+ "VSError": "readonly",
20
+ "ABS_PATH": "readonly",
21
+ "APP_PATH": "readonly",
22
+ "CORE_PATH": "readonly",
23
+ "PUBLIC_PATH": "readonly"
24
+ },
25
+ "rules": {
26
+ "curly": "error",
27
+ "no-console": "off",
28
+ "no-underscore-dangle": "off",
29
+ "no-throw-literal": "off",
30
+ "no-unneeded-ternary": "off",
31
+ "guard-for-in": "off"
32
+ },
33
+ "ignorePatterns": [
34
+ "node_modules",
35
+ "test",
36
+ "bundle",
37
+ "tasks",
38
+ "docs",
39
+ "public",
40
+ "setup"
41
+ ]
42
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "oxc.enable": true,
3
+ "oxc.configPath": ".oxlintrc.json",
4
+ "editor.defaultFormatter": "biomejs.biome",
5
+ "editor.formatOnSave": true,
6
+ "javascript.format.enable": false,
7
+ "typescript.format.enable": false,
8
+ "[javascript]": {
9
+ "editor.defaultFormatter": "biomejs.biome"
10
+ },
11
+ "[javascriptreact]": {
12
+ "editor.defaultFormatter": "biomejs.biome"
13
+ }
14
+ }
package/app.js CHANGED
@@ -81,11 +81,7 @@ const NODE_ENV = (process.env.NODE_ENV || 'development').toLowerCase();
81
81
 
82
82
  app.PRODUCTION = NODE_ENV === 'production' ? true : false;
83
83
 
84
- const {
85
- views,
86
- local,
87
- env
88
- } = config || {};
84
+ const { views, local, env } = config || {};
89
85
 
90
86
  // NODE_ENV
91
87
  const environmentConfig = env ? env[NODE_ENV] || {} : {};
@@ -121,12 +117,7 @@ app.config = allConfig;
121
117
  app.pkg = appPkg;
122
118
 
123
119
  // Include all components
124
- const {
125
- lineWidth,
126
- colors,
127
- showCenteredText,
128
- showColumn
129
- } = require('./bootstrap/logger');
120
+ const { lineWidth, colors, showCenteredText, showColumn } = require('./bootstrap/logger');
130
121
 
131
122
  // Include all components
132
123
  const loadDatabase = require('./database/mongodb');
@@ -135,7 +126,6 @@ const loadControllers = require('./controllers/controllers');
135
126
  const loadServer = require('./bootstrap/server');
136
127
 
137
128
  async function startVulkano() {
138
-
139
129
  // Load Services
140
130
  loadServices();
141
131
 
@@ -155,17 +145,17 @@ async function startVulkano() {
155
145
  const cutLine = '-'.padEnd(lineWidth, '-');
156
146
 
157
147
  console.log('');
158
- console.log(`${colors.fg.magenta}${cutLine}`, colors.reset);
148
+ console.log(`${colors.fg.magenta}${cutLine}${colors.reset}`);
159
149
  console.log('');
160
- console.log(colors.fg.cyan, showCenteredText('🌋'), colors.reset);
161
- console.log(colors.fg.cyan, showCenteredText(`${appName} ${appVersion}`), colors.reset);
162
- console.log(colors.fg.cyan, showCenteredText(`${pkg.name} ${pkg.version}`.toUpperCase()), colors.reset);
150
+ console.log(`${colors.fg.cyan}${showCenteredText('🌋')}${colors.reset}`);
151
+ console.log(`${colors.fg.cyan}${showCenteredText(`${appName} ${appVersion}`)}${colors.reset}`);
152
+ console.log(`${colors.fg.cyan}${showCenteredText(`${pkg.name} ${pkg.version}`.toUpperCase())}${colors.reset}`);
163
153
  console.log('');
164
- console.log(colors.fg.blue, '🔗 github.com/vulkanojs/vulkano', colors.reset);
165
- console.log(colors.fg.cyan, '☕ buymeacoffee.com/argordmel', colors.reset);
154
+ console.log(`${colors.fg.blue}🔗 github.com/vulkanojs/vulkano${colors.reset}`);
155
+ console.log(`${colors.fg.cyan}☕ buymeacoffee.com/argordmel${colors.reset}`);
166
156
  console.log('');
167
157
  console.log(` Author: ${colors.fg.green}${author}${colors.reset}`);
168
- console.log(`${colors.fg.magenta}${cutLine}`, colors.reset);
158
+ console.log(`${colors.fg.magenta}${cutLine}${colors.reset}`);
169
159
 
170
160
  // Routes
171
161
  app.routes = controllers;
@@ -181,33 +171,21 @@ async function startVulkano() {
181
171
  ...app.config.routes
182
172
  };
183
173
 
184
- const {
185
- bootstrap
186
- } = config;
174
+ const { bootstrap } = config;
187
175
 
188
176
  if (!bootstrap || typeof bootstrap !== 'function') {
189
177
  console.log('Missing the boostrap file to start app: app/config/bootstrap.js');
190
178
  return;
191
179
  }
192
180
 
193
- bootstrap( (callbackAfterInitVulkano) => {
194
-
181
+ bootstrap((callbackAfterInitVulkano) => {
195
182
  // Start Express
196
- app.server.start( () => {
183
+ app.server.start(() => {
184
+ const { sockets, settings: configSettings, vite } = app.config || {};
197
185
 
198
- const {
199
- sockets,
200
- settings: configSettings,
201
- vite
202
- } = app.config || {};
186
+ const { database } = configSettings || {};
203
187
 
204
- const {
205
- database
206
- } = configSettings || {};
207
-
208
- const {
209
- connection
210
- } = database || {};
188
+ const { connection } = database || {};
211
189
 
212
190
  const connectionToShow = connection && process.env.MONGO_URI ? 'MONGO_URI' : connection;
213
191
 
@@ -215,12 +193,15 @@ async function startVulkano() {
215
193
 
216
194
  const nodeVersion = process.version.match(/^v(\d+\.\d+\.\d+)/)[1];
217
195
  const portText = String(app.vulkano.get('port') || 8000);
218
- const socketText = sockets.enabled ? 'YES' : 'NO';
219
- const adapterText = sockets.enabled ? String(sockets.adapter || 'memory').toUpperCase() : 'NO';
196
+ const socketText = sockets.enabled
197
+ ? String(sockets.adapter || 'memory').toUpperCase()
198
+ : 'NO';
220
199
 
221
- serverConfig.push(` PORT: ${colors.fg.green}${showColumn(portText, 7)}${colors.reset}`);
200
+ serverConfig.push(`🚀 PORT: ${colors.fg.green}${showColumn(portText, 7)}${colors.reset}`);
222
201
  serverConfig.push(' | ');
223
- serverConfig.push(` ENV: ${app.PRODUCTION ? colors.fg.red : colors.fg.green}${showColumn(NODE_ENV, 0)}${colors.reset}`);
202
+ serverConfig.push(
203
+ `🌿 ENV: ${app.PRODUCTION ? colors.fg.red : colors.fg.green}${showColumn(NODE_ENV, 0)}${colors.reset}`
204
+ );
224
205
 
225
206
  console.log(serverConfig.join(''));
226
207
 
@@ -228,26 +209,39 @@ async function startVulkano() {
228
209
  const totalHeapSizeGb = (totalHeapSize / 1024 / 1024 / 1024).toFixed(2);
229
210
 
230
211
  const nodeConfig = [];
231
- nodeConfig.push(` NODE: ${colors.fg.green}${showColumn(nodeVersion, 7)}${colors.reset}`);
212
+ nodeConfig.push(`📦 NODE: ${colors.fg.green}${showColumn(nodeVersion, 7)}${colors.reset}`);
232
213
  nodeConfig.push(' | ');
233
- nodeConfig.push(' MAX MEM: ', `${colors.fg.green}${totalHeapSizeGb} GB${colors.reset}`);
214
+ nodeConfig.push(`🧠 MAX MEM: `, `${colors.fg.green}${totalHeapSizeGb} GB${colors.reset}`);
234
215
  console.log(nodeConfig.join(''));
235
216
 
236
217
  const startUpConfig = [];
237
- startUpConfig.push(' SOCKETS: ', `${colors.fg.green}${showColumn(socketText, 10)}${colors.reset}`);
218
+ startUpConfig.push(
219
+ `🔌 SOCKETS: `,
220
+ `${sockets.enabled ? colors.fg.green : colors.fg.blue}${showColumn(socketText, 10)}${colors.reset}`
221
+ );
238
222
  startUpConfig.push(' | ');
239
- startUpConfig.push(` STARTUP: ${colors.fg.green}${((Date.now() - global.START_TIME) / 1000).toFixed(3)}s${colors.reset}`);
223
+ startUpConfig.push(
224
+ `🍃 DB: `,
225
+ connection
226
+ ? `${colors.fg.green}${connectionToShow}${colors.reset}`
227
+ : `${colors.fg.blue}NO DATABASE${colors.reset}`
228
+ );
240
229
  console.log(startUpConfig.join(''));
241
230
 
242
- const dbConfig = [];
243
- dbConfig.push(' ADAPTER: ', `${colors.fg.green}${showColumn(adapterText, 10)}${colors.reset}`);
244
- dbConfig.push(' | ');
245
- dbConfig.push(' DB: ', connection ? `${colors.fg.green}${connectionToShow}${colors.reset}` : `${colors.fg.blue}NO DATABASE${colors.reset}`);
246
- console.log(dbConfig.join(''));
231
+ if (vite?.enabled) {
232
+ console.log(
233
+ `${colors.fg.yellow}⚡ VITE${colors.reset}`,
234
+ `${colors.fg.green}${showColumn('ENABLED', 5)}${colors.reset}`,
235
+ `${colors.dim}${vite.buildPath || 'public/.vite'}${colors.reset}`
236
+ );
237
+ }
247
238
 
248
- console.log(`${colors.fg.magenta}${cutLine}`, colors.reset);
239
+ const startupMs = ((Date.now() - global.START_TIME) / 1000).toFixed(3);
240
+ console.log(`${colors.fg.magenta}${cutLine}${colors.reset}`);
241
+ console.log(`${colors.bright}${colors.fg.cyan}${showCenteredText(`⚡ Ready in ${startupMs}s`)}${colors.reset}`);
242
+ console.log(`${colors.fg.magenta}${cutLine}${colors.reset}`);
249
243
 
250
- if (vite && vite.enabled) {
244
+ if (vite?.enabled) {
251
245
  app.vite = Vite.init(vite.buildPath || 'public/.vite');
252
246
  }
253
247
 
@@ -255,11 +249,8 @@ async function startVulkano() {
255
249
  if (callbackAfterInitVulkano && typeof callbackAfterInitVulkano === 'function') {
256
250
  callbackAfterInitVulkano();
257
251
  }
258
-
259
252
  });
260
-
261
253
  });
262
-
263
254
  }
264
255
 
265
256
  module.exports = startVulkano;
package/biome.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
3
+ "files": {
4
+ "includes": [
5
+ "**",
6
+ "!node_modules",
7
+ "!test",
8
+ "!bundle",
9
+ "!tasks",
10
+ "!docs",
11
+ "!public",
12
+ "!setup"
13
+ ]
14
+ },
15
+ "formatter": {
16
+ "enabled": true,
17
+ "indentStyle": "space",
18
+ "indentWidth": 2,
19
+ "lineWidth": 100
20
+ },
21
+ "linter": {
22
+ "enabled": true
23
+ },
24
+ "javascript": {
25
+ "formatter": {
26
+ "quoteStyle": "single",
27
+ "trailingCommas": "none",
28
+ "semicolons": "always"
29
+ }
30
+ }
31
+ }
@@ -1,6 +1,6 @@
1
1
  const logger = {
2
2
 
3
- lineWidth: 39,
3
+ lineWidth: 41,
4
4
 
5
5
  colors: {
6
6
  reset: '\x1b[0m',
@@ -36,7 +36,7 @@ const logger = {
36
36
 
37
37
  showCenteredText(text) {
38
38
 
39
- const colSize = (logger.lineWidth / 2) - 3;
39
+ const colSize = logger.lineWidth / 2;
40
40
  const textLength = (text || '').length;
41
41
  const textLeftSize = Math.trunc(textLength / 2);
42
42
  const textRightSize = textLength - textLeftSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulkano/core",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "A MVC framework using Express 4",
5
5
  "license": "MIT",
6
6
  "author": "Vulkano Team",
@@ -12,6 +12,8 @@
12
12
  "vulkano": "./bin/vulkano.js"
13
13
  },
14
14
  "scripts": {
15
+ "format": "biome format --write .",
16
+ "lint": "oxlint . && biome check .",
15
17
  "test": "jest",
16
18
  "test:watch": "jest --watch",
17
19
  "test:coverage": "jest --coverage",
@@ -61,21 +63,9 @@
61
63
  "undici": "^6.25.0"
62
64
  },
63
65
  "devDependencies": {
64
- "@babel/core": "^7.26.9",
65
- "@babel/eslint-parser": "^7.26.8",
66
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
67
- "@babel/plugin-syntax-jsx": "^7.25.9",
68
- "@babel/preset-env": "^7.26.9",
69
- "@babel/preset-react": "^7.26.3",
70
- "@babel/preset-stage-1": "^7.8.3",
71
- "eslint": "^8.57.0",
72
- "eslint-config-airbnb": "^19.0.4",
73
- "eslint-import-resolver-alias": "^1.1.2",
74
- "eslint-plugin-import": "^2.31.0",
75
- "eslint-plugin-jsx-a11y": "^6.10.2",
76
- "eslint-plugin-react": "^7.37.4",
77
- "eslint-plugin-react-hooks": "^4.6.2",
66
+ "@biomejs/biome": "^2.4.15",
78
67
  "jest": "^29.7.0",
79
- "nodemon": "^3.1.14"
68
+ "nodemon": "^3.1.14",
69
+ "oxlint": "^1.64.0"
80
70
  }
81
- }
71
+ }