sqlaravel 1.0.20 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -16,3 +16,30 @@ Base to start projects in Laravel, simply and quickly
16
16
  npm i sqlaravel
17
17
  npm explore sisass -- npm run init -- --path ../../resources
18
18
  ```
19
+
20
+ ## Use
21
+
22
+ sqLaravel works with **Gulp**, to be able to use it, it is necessary to be located in the resources folder and execute gulp command
23
+
24
+ ```bash
25
+ cd resources
26
+ gulp
27
+ ```
28
+
29
+ ### Parameters for the gulp command
30
+
31
+ #### minjs (boolean: false)
32
+
33
+ True to minify the js files.
34
+
35
+ ```bash
36
+ gulp --minjs true
37
+ ```
38
+
39
+ or
40
+
41
+ ```bash
42
+ gulp --minjs
43
+ ```
44
+
45
+
@@ -0,0 +1,22 @@
1
+ exports.arg = (argList => {
2
+ let arg = {}, a, opt, thisOpt, curOpt;
3
+
4
+ for (a = 0; a < argList.length; a++) {
5
+
6
+ thisOpt = argList[a].trim();
7
+ opt = thisOpt.replace(/^\-+/, '');
8
+
9
+ if (opt === thisOpt) {
10
+
11
+ // argument value
12
+ if (curOpt) arg[curOpt] = opt;
13
+ curOpt = null;
14
+
15
+ } else {
16
+ // argument name
17
+ curOpt = opt;
18
+ arg[curOpt] = true;
19
+ }
20
+ }
21
+ return arg;
22
+ })(process.argv);
@@ -0,0 +1,25 @@
1
+ exports.stringToBoolean = ((string) => {
2
+ let result;
3
+
4
+ string = String(string);
5
+
6
+ switch (string.toLowerCase().trim()) {
7
+ case "true":
8
+ case "yes":
9
+ case "1":
10
+ result = true;
11
+ break;
12
+
13
+ case "false":
14
+ case "no":
15
+ case "0":
16
+ result = false;
17
+ break;
18
+
19
+ default:
20
+ result = false;
21
+ break;
22
+ }
23
+
24
+ return result;
25
+ });
File without changes
@@ -9,13 +9,17 @@ import { deleteAsync } from "del";
9
9
  import merge from "merge-stream";
10
10
  import eslint from "gulp-eslint";
11
11
  import uglify from "gulp-uglify";
12
+ import arg from "./config/arg.js";
13
+ import fn from "./config/fn.js";
12
14
 
13
15
  const
16
+ p = arg.arg,
17
+
14
18
  { series, parallel, src, dest, task, watch } = gulp,
15
- sass = gulpSass(dartSass);
16
- ;
19
+ sass = gulpSass(dartSass),
20
+
21
+ minjs = fn.stringToBoolean(p.minjs) || false,
17
22
 
18
- const
19
23
  /*
20
24
  svgmin = require("gulp-svgmin"),
21
25
  postcss = require("gulp-postcss"),
@@ -31,8 +35,12 @@ const
31
35
 
32
36
  ],
33
37
  dest: [
38
+ "../public/js/",
39
+ "../public/js/modules/",
40
+ ],
41
+ mindest: [
34
42
  "../public/js/min/",
35
- "../public/js/min/modules/",
43
+ "../public/js/modules/min",
36
44
  ]
37
45
  }
38
46
  },
@@ -65,6 +73,8 @@ const
65
73
  ]
66
74
  ;
67
75
 
76
+ console.dir(minjs);
77
+
68
78
  /*
69
79
  gulp.task("delete_svg", function () {
70
80
  console.log("");
@@ -170,24 +180,6 @@ task("watch", function () {
170
180
  });
171
181
  */
172
182
 
173
- /*
174
- task("js", function () {
175
- console.log("");
176
- console.log("---- JS ----");
177
-
178
- let task_array = [];
179
-
180
- for (let i = 0; i < paths.js.src.length; i++) {
181
- task_array[i] = src(paths.js.src[i])
182
- .pipe(uglify())
183
- .pipe(gulp.dest(paths.js.dest));
184
- }
185
-
186
- console.log("");
187
- return merge(...task_array);
188
- });
189
- */
190
-
191
183
  task("lint", function() {
192
184
  console.log("");
193
185
  console.log("---- ES-LINT ----");
@@ -211,11 +203,32 @@ task("lint", function() {
211
203
  return merge(...task_array);
212
204
  });
213
205
 
206
+ task("js", function () {
207
+ console.log("");
208
+ console.log("---- JS ----");
209
+
210
+ let task_array = [];
211
+
212
+ for (let i = 0; i < paths.js.src.length; i++) {
213
+ if (minjs) {
214
+ task_array[i] = src(paths.js.src[i])
215
+ .pipe(uglify())
216
+ .pipe(gulp.dest(paths.js.mindest[i]));
217
+ } else {
218
+ task_array[i] = src(paths.js.src[i])
219
+ .pipe(gulp.dest(paths.js.dest[i]));
220
+ }
221
+ }
222
+
223
+ console.log("");
224
+ return merge(...task_array);
225
+ });
226
+
214
227
  function watchFiles() {
215
228
  console.log("");
216
229
  console.log("---- INICIADO WATCH ----");
217
230
 
218
- watch(paths.js.src, series("lint"));
231
+ watch(paths.js.src, series("lint", "js"));
219
232
  // gulp.watch(paths.styles.src, styles);
220
233
  }
221
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlaravel",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Base to start projects in Laravel, simply and quickly",
5
5
  "main": "index.js",
6
6
  "repository": {