vanilla-jet 1.0.29 → 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.
@@ -18,9 +18,8 @@ jobs:
18
18
  - name: Setup Node.js
19
19
  uses: actions/setup-node@v3
20
20
  with:
21
- node-version: '20'
21
+ node-version: '16'
22
22
  registry-url: 'https://registry.npmjs.org/'
23
- cache: 'npm'
24
23
 
25
24
  - name: Install dependencies
26
25
  run: npm install
@@ -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/Gruntfile.js CHANGED
@@ -16,7 +16,7 @@ module.exports = function(grunt) {
16
16
  require('./.grunt/build_styles_task')(grunt);
17
17
 
18
18
  // -- Functions
19
- function getCleanedCWD() {
19
+ function getCwd() {
20
20
  const cwd = process.cwd();
21
21
  let newCwd = cwd
22
22
  .replace('/node_modules', '')
@@ -28,19 +28,19 @@ module.exports = function(grunt) {
28
28
 
29
29
 
30
30
  // -- Vars
31
- const cssDestination = `${getCleanedCWD()}/public/styles/app.min.css`;
32
- const cssOrigin = `${getCleanedCWD()}/assets/styles/less/admin_build.less`;
33
- const jsDestination = `${getCleanedCWD()}/public/`;
31
+ const cssDestination = `${getCwd()}/public/styles/app.min.css`;
32
+ const cssOrigin = `${getCwd()}/assets/styles/less/admin_build.less`;
33
+ const jsDestination = `${getCwd()}/public/`;
34
34
 
35
35
  // -- Init
36
36
  grunt.initConfig({
37
37
  clean: {
38
- build: [`${getCleanedCWD()}/public/scripts/vanilla.min.js`],
38
+ build: [`${getCwd()}/public/scripts/vanilla.min.js`],
39
39
  minified: [
40
- `${getCleanedCWD()}/public/scripts/api`,
41
- `${getCleanedCWD()}/public/scripts/controllers`,
42
- `${getCleanedCWD()}/public/scripts/views`,
43
- `${getCleanedCWD()}/public/scripts/app.min.js`
40
+ `${getCwd()}/public/scripts/api`,
41
+ `${getCwd()}/public/scripts/controllers`,
42
+ `${getCwd()}/public/scripts/views`,
43
+ `${getCwd()}/public/scripts/app.min.js`
44
44
  ],
45
45
  //minified: ['public/scripts/**/*.min.js', 'public/scripts/*', '!public/scripts/vanilla.min.js']
46
46
  },
@@ -63,10 +63,10 @@ module.exports = function(grunt) {
63
63
  },
64
64
  styles: {
65
65
  files: [
66
- `${getCleanedCWD()}/assets/styles/less/*.less`,
67
- `${getCleanedCWD()}/assets/styles/less/**/*.less`,
68
- `${getCleanedCWD()}/assets/styles/less/**/**/*.less`,
69
- `${getCleanedCWD()}/!assets/styles/less/admin_build.less`
66
+ `${getCwd()}/assets/styles/less/*.less`,
67
+ `${getCwd()}/assets/styles/less/**/*.less`,
68
+ `${getCwd()}/assets/styles/less/**/**/*.less`,
69
+ `${getCwd()}/!assets/styles/less/admin_build.less`
70
70
  ],
71
71
  tasks: ['buildLess'],
72
72
  options: {
@@ -75,22 +75,22 @@ module.exports = function(grunt) {
75
75
  },
76
76
  scripts: {
77
77
  files: [
78
- `${getCleanedCWD()}/assets/pages/*.html`,
79
- `${getCleanedCWD()}/assets/templates/**/*.html`,
80
- `${getCleanedCWD()}/assets/templates/**/**/*.html`,
81
- `${getCleanedCWD()}/external/view/*.js`,
82
- `${getCleanedCWD()}/external/*.js`,
83
- `${getCleanedCWD()}/framework/*.js`
78
+ `${getCwd()}/assets/pages/*.html`,
79
+ `${getCwd()}/assets/templates/**/*.html`,
80
+ `${getCwd()}/assets/templates/**/**/*.html`,
81
+ `${getCwd()}/external/view/*.js`,
82
+ `${getCwd()}/external/*.js`,
83
+ `${getCwd()}/framework/*.js`
84
84
  ],
85
85
  tasks: ['shell:compileTemplates']
86
86
  },
87
87
  specificScripts: {
88
88
  files: [
89
- `${getCleanedCWD()}/assets/scripts/*.js`,
90
- `${getCleanedCWD()}/assets/scripts/**/*.js`,
91
- `${getCleanedCWD()}/assets/scripts/**/**/*.js`
89
+ `${getCwd()}/assets/scripts/*.js`,
90
+ `${getCwd()}/assets/scripts/**/*.js`,
91
+ `${getCwd()}/assets/scripts/**/**/*.js`
92
92
  ],
93
- tasks: ['uglify', 'clean:build', 'concat', 'clean:minified']
93
+ tasks: ['uglify', 'cleanForce:build', 'concat', 'cleanForce:minified']
94
94
  }
95
95
  },
96
96
  uglify: {
@@ -114,12 +114,12 @@ module.exports = function(grunt) {
114
114
  files: [{
115
115
  expand: true,
116
116
  src: [
117
- `${getCleanedCWD()}/assets/scripts/*.js`,
118
- `${getCleanedCWD()}/assets/scripts/**/*.js`,
119
- `${getCleanedCWD()}/assets/scripts/**/**/*.js`,
120
- `${getCleanedCWD()}/assets/scripts/**/**/**/*.js`
117
+ `${getCwd()}/assets/scripts/*.js`,
118
+ `${getCwd()}/assets/scripts/**/*.js`,
119
+ `${getCwd()}/assets/scripts/**/**/*.js`,
120
+ `${getCwd()}/assets/scripts/**/**/**/*.js`
121
121
  ],
122
- dest: getCleanedCWD() + '/public',
122
+ dest: getCwd() + '/public',
123
123
  rename : function (dest, src) {
124
124
 
125
125
  var folder = src.substring(0, src.lastIndexOf('/')),
@@ -137,17 +137,17 @@ module.exports = function(grunt) {
137
137
  build: {
138
138
  src: [
139
139
  // Order
140
- `${getCleanedCWD()}/public/scripts/controllers/**/*.min.js`,
141
- `${getCleanedCWD()}/public/scripts/views/**/*.min.js`,
142
- `${getCleanedCWD()}/public/scripts/api/**/*.min.js`,
143
- `${getCleanedCWD()}/public/scripts/*.min.js`,
140
+ `${getCwd()}/public/scripts/controllers/**/*.min.js`,
141
+ `${getCwd()}/public/scripts/views/**/*.min.js`,
142
+ `${getCwd()}/public/scripts/api/**/*.min.js`,
143
+ `${getCwd()}/public/scripts/*.min.js`,
144
144
 
145
145
  // Ignore files
146
- `!${getCleanedCWD()}/public/scripts/core/**`,
147
- `!${getCleanedCWD()}/public/scripts/plugins/**`,
148
- `!${getCleanedCWD()}/public/scripts/plugins/ui/**`
146
+ `!${getCwd()}/public/scripts/core/**`,
147
+ `!${getCwd()}/public/scripts/plugins/**`,
148
+ `!${getCwd()}/public/scripts/plugins/ui/**`
149
149
  ],
150
- dest: `${getCleanedCWD()}/public/scripts/vanilla.min.js`
150
+ dest: `${getCwd()}/public/scripts/vanilla.min.js`
151
151
  }
152
152
  },
153
153
  compress: {
@@ -157,7 +157,7 @@ module.exports = function(grunt) {
157
157
  },
158
158
  files: [{
159
159
  expand: true,
160
- src: [`${getCleanedCWD()}/public/scripts/vanilla.min.js`],
160
+ src: [`${getCwd()}/public/scripts/vanilla.min.js`],
161
161
  dest: '',
162
162
  ext: '.min.js.gz'
163
163
  }]
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.29",
3
+ "version": "1.0.31",
4
4
  "description": "VannilaJet framework",
5
5
  "main": "index.js",
6
6
  "bin": {