vanilla-jet 1.0.30 → 1.0.31

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.
@@ -89,6 +89,8 @@ function main() {
89
89
  const newHtml = lines.join('\n');
90
90
  // -- Create HTML file
91
91
  createHTMLFile(newHtml, homePageName);
92
+ // -- Console finish
93
+ console.log("VanillaJet - Finish build");
92
94
  }
93
95
  });
94
96
  }
@@ -201,7 +203,7 @@ async function createHTMLFile(content, filePath) {
201
203
  fs.mkdirSync(publicPath, { recursive: true });
202
204
  const absolutePath = path.join(publicPath, filePath);
203
205
  fs.writeFileSync(absolutePath, minified, 'utf8');
204
- console.log(`Html :) file created at: ${absolutePath}`);
206
+ //console.log(`Html :) file created at: ${absolutePath}`);
205
207
  }
206
208
 
207
209
  // -- Helpers
package/bin.js CHANGED
@@ -6,6 +6,7 @@ const { execSync } = require('child_process');
6
6
 
7
7
  const generatePackagesJson = require(path.join(__dirname, './.scripts/generate_packages_json.js'));
8
8
 
9
+ console.log(args[0]);
9
10
  switch (args[0]) {
10
11
 
11
12
  case 'setup':
@@ -20,17 +21,17 @@ switch (args[0]) {
20
21
  }
21
22
  break;
22
23
 
23
- case 'qa':
24
+ case 'build:qa':
24
25
  try {
25
- execSync('grunt --env=qa', { stdio: 'inherit', cwd: __dirname });
26
+ execSync('grunt build --env=qa', { stdio: 'inherit', cwd: __dirname });
26
27
  } catch (error) {
27
28
  console.error('Error ejecutando grunt:', error.message);
28
29
  }
29
30
  break;
30
31
 
31
- case 'prod':
32
+ case 'build:prod':
32
33
  try {
33
- execSync('grunt --env=production', { stdio: 'inherit', cwd: __dirname });
34
+ execSync('grunt build --env=production', { stdio: 'inherit', cwd: __dirname });
34
35
  } catch (error) {
35
36
  console.error('Error ejecutando grunt:', error.message);
36
37
  }
@@ -1,103 +1,100 @@
1
1
  class Functions {
2
2
 
3
- constructor(endpoints) {
4
-
5
- // Dipper
6
- dipper = global.dipper;
7
-
8
- // -- Hydrate
9
- Functions.hydrate(dipper);
10
-
11
- // Creating endpoints array
12
- this.endpoints = endpoints || {};
13
- }
14
-
15
- static hydrate(dipper) {
16
-
17
- // -- Get vanillaJet.package.json
18
- let json = dipper.openJsonFile('vanillaJet.package.json');
19
-
20
- // -- Google Fonts
21
- if (json.fonts && json.fonts.length > 0) {
22
- dipper.registerStyle('google-fonts', dipper.get_google_fonts(json.fonts));
23
- }
24
-
25
- // - Styles
26
- let stylesKeys = [];
27
- if (json.styles) {
28
-
29
- // -- Gettign the keys
30
- stylesKeys = Object.keys(json.styles);
31
-
32
- // -- Add google-fonts to keys
33
- stylesKeys.push('google-fonts');
34
-
35
- // -- Adding styles
36
- for (let key in json.styles) {
37
- // -- Check if init with http or https
38
- let url = json.styles[key];
39
- if (!/^(https?:\/\/|\/\/)/.test(url)) {
40
- dipper.registerStyle(key, dipper.style(url));
41
- } else {
42
- dipper.registerStyle(key, url);
43
- }
44
- }
45
- }
46
- dipper.registerStyle('app', dipper.style('app.min.css'), stylesKeys);
47
- dipper.enqueueStyle('app');
48
-
49
- // -- Scripts
50
- let scriptsKeys = [];
51
- if (json.dependencies) {
52
-
53
- // -- Adding scripts
54
- for (let key in json.dependencies) {
55
-
56
- // -- Key name and requires
57
- let keyParts = key.split(':');
58
- let keyName = keyParts[0];
59
- let keyRequires = keyParts[1] || '';
60
-
61
- // -- Add key to scriptsKeys
62
- scriptsKeys.push(keyName);
63
-
64
- // -- Check if init with http or https
65
- let url = json.dependencies[key];
66
- if (!/^(https?:\/\/|\/\/)/.test(url)) {
67
- dipper.registerScript(
68
- keyName,
69
- dipper.script(url),
70
- (keyRequires !== '') ? [keyRequires] : undefined
71
- );
72
- } else {
73
- dipper.registerScript(
74
- keyName,
75
- url,
76
- (keyRequires !== '') ? [keyRequires] : undefined
77
- );
78
- }
79
- }
80
- }
81
- scriptsKeys.push('jquery');
82
- scriptsKeys.push('underscore');
83
- dipper.registerScript('vanillaJet', dipper.script('core/vanillaJet.js'), scriptsKeys);
84
- dipper.enqueueScript('vanillaJet');
85
-
86
- // -- Main app
87
- dipper.registerScript('vanilla', dipper.script('vanilla.js'));
88
- dipper.enqueueScript('vanilla');
89
-
90
- // Adding meta tags
91
- dipper.addMeta('UTF-8', '', 'charset');
92
- dipper.addMeta('viewport', 'width=device-width, minimum-scale=1');
93
- dipper.addMeta('og:title', dipper.getPageTitle(), 'property');
94
- dipper.addMeta('og:site_name', dipper.getSiteTitle(), 'property');
95
- dipper.addMeta('og:description', dipper.getDescription(), 'property');
96
- dipper.addMeta('og:image', dipper.img('logo.png'), 'property');
97
- dipper.addMeta('og:type', 'website', 'property');
98
- dipper.addMeta('og:url', dipper.urlTo(''), 'property');
99
- dipper.addMeta('theme-color', '#ffffff', '');
100
- }
3
+ constructor() {
4
+
5
+ // Dipper
6
+ dipper = global.dipper;
7
+
8
+ // -- Hydrate
9
+ Functions.hydrate(dipper);
10
+ }
11
+
12
+ static hydrate(dipper) {
13
+
14
+ // -- Get vanillaJet.package.json
15
+ let json = dipper.openJsonFile('vanillaJet.package.json');
16
+
17
+ // -- Google Fonts
18
+ if (json.fonts && json.fonts.length > 0) {
19
+ dipper.registerStyle('google-fonts', dipper.get_google_fonts(json.fonts));
20
+ }
21
+
22
+ // - Styles
23
+ let stylesKeys = [];
24
+ if (json.styles) {
25
+
26
+ // -- Gettign the keys
27
+ stylesKeys = Object.keys(json.styles);
28
+
29
+ // -- Add google-fonts to keys
30
+ stylesKeys.push('google-fonts');
31
+
32
+ // -- Adding styles
33
+ for (let key in json.styles) {
34
+ // -- Check if init with http or https
35
+ let url = json.styles[key];
36
+ if (!/^(https?:\/\/|\/\/)/.test(url)) {
37
+ dipper.registerStyle(key, dipper.style(url));
38
+ } else {
39
+ dipper.registerStyle(key, url);
40
+ }
41
+ }
42
+ }
43
+ dipper.registerStyle('app', dipper.style('app.min.css'), stylesKeys);
44
+ dipper.enqueueStyle('app');
45
+
46
+ // -- Scripts
47
+ let scriptsKeys = [];
48
+ if (json.dependencies) {
49
+
50
+ // -- Adding scripts
51
+ for (let key in json.dependencies) {
52
+
53
+ // -- Key name and requires
54
+ let keyParts = key.split(':');
55
+ let keyName = keyParts[0];
56
+ let keyRequires = keyParts[1] || '';
57
+
58
+ // -- Add key to scriptsKeys
59
+ scriptsKeys.push(keyName);
60
+
61
+ // -- Check if init with http or https
62
+ let url = json.dependencies[key];
63
+ if (!/^(https?:\/\/|\/\/)/.test(url)) {
64
+ dipper.registerScript(
65
+ keyName,
66
+ dipper.script(url),
67
+ (keyRequires !== '') ? [keyRequires] : undefined
68
+ );
69
+ } else {
70
+ dipper.registerScript(
71
+ keyName,
72
+ url,
73
+ (keyRequires !== '') ? [keyRequires] : undefined
74
+ );
75
+ }
76
+ }
77
+ }
78
+ scriptsKeys.push('jquery');
79
+ scriptsKeys.push('underscore');
80
+ dipper.registerScript('vanillaJet', dipper.script('core/vanillaJet.js'), scriptsKeys);
81
+ dipper.enqueueScript('vanillaJet');
82
+
83
+ // -- Main app
84
+ dipper.registerScript('vanilla', dipper.script('vanilla.js'));
85
+ dipper.enqueueScript('vanilla');
86
+
87
+ // Adding meta tags
88
+ dipper.addMeta('UTF-8', '', 'charset');
89
+ dipper.addMeta('viewport', 'width=device-width, minimum-scale=1');
90
+ dipper.addMeta('og:title', dipper.getPageTitle(), 'property');
91
+ dipper.addMeta('og:site_name', dipper.getSiteTitle(), 'property');
92
+ dipper.addMeta('og:description', dipper.getDescription(), 'property');
93
+ dipper.addMeta('og:image', dipper.img('logo.png'), 'property');
94
+ dipper.addMeta('og:type', 'website', 'property');
95
+ dipper.addMeta('og:url', dipper.urlTo(''), 'property');
96
+ dipper.addMeta('theme-color', '#ffffff', '');
97
+ }
101
98
  }
102
99
 
103
100
  module.exports = Functions;
@@ -181,7 +181,7 @@ class Router {
181
181
 
182
182
  validateCallback(clazz, method) {
183
183
 
184
- var obj = this, endpoints = obj.server.functions.endpoints;
184
+ var obj = this, endpoints = obj.server.endpoints;
185
185
 
186
186
  if (endpoints[clazz] != undefined) {
187
187
 
@@ -18,6 +18,7 @@ class Server {
18
18
  this.router = null;
19
19
  this.functions = null;
20
20
  this.dipper = null;
21
+ this.endpoints = {};
21
22
  this.init(options, endpoints);
22
23
  }
23
24
 
@@ -82,9 +83,10 @@ class Server {
82
83
  for (let endpoint of endpoints) {
83
84
  endpoints_built[endpoint.name] = new endpoint(obj.router);
84
85
  }
86
+ this.endpoints = endpoints_built;
85
87
 
86
88
  // Setting endpoints
87
- obj.functions = new Functions(endpoints_built);
89
+ obj.functions = new Functions();
88
90
  }
89
91
 
90
92
  start() {
@@ -96,7 +98,7 @@ class Server {
96
98
  obj.httpx.listen(port);
97
99
 
98
100
  // Logging
99
- obj.log('__________________ Dragonfly server started ___________________');
101
+ obj.log('__________________ VanillaJet server started ___________________');
100
102
  obj.log(` > Listening on ${obj.options.site_url}:${obj.options.port}${obj.options.base_url} < `);
101
103
  obj.log('-----------------------------------------------------------------');
102
104
  }
package/index.js CHANGED
@@ -1,15 +1,5 @@
1
- const Dipper = require('./framework/dipper.js');
2
- const Request = require('./framework/request.js');
3
- const Response = require('./framework/response.js');
4
- const Router = require('./framework/router.js');
5
1
  const Server = require('./framework/server.js');
6
- const Functions = require('./framework/functions.js');
7
2
 
8
3
  module.exports = {
9
- Dipper,
10
- Request,
11
- Response,
12
- Router,
13
- Server,
14
- Functions
4
+ Server
15
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-jet",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "VannilaJet framework",
5
5
  "main": "index.js",
6
6
  "bin": {