Commit 0fa3808740a307440d8308e232ae8f80bbbedbc4
1 parent
8330867cf3
Exists in
master
Update package.json, gulpfile.js, .jshintrc files
Showing
3 changed files
with
134 additions
and
1 deletions
Show diff stats
.jshintrc
... | ... | @@ -0,0 +1,64 @@ |
1 | +{ | |
2 | + /* | |
3 | + * ENVIRONMENTS | |
4 | + * ================= | |
5 | + */ | |
6 | + | |
7 | + // Define globals exposed by modern browsers. | |
8 | + "browser": true, | |
9 | + | |
10 | + // Define globals exposed by jQuery. | |
11 | + "jquery": true, | |
12 | + | |
13 | + // Define globals exposed by Node.js. | |
14 | + "node": true, | |
15 | + | |
16 | + // Allow ES6. | |
17 | + "esversion": 6, | |
18 | + | |
19 | + /* | |
20 | + * ENFORCING OPTIONS | |
21 | + * ================= | |
22 | + */ | |
23 | + | |
24 | + // Force all variable names to use either camelCase style or UPPER_CASE | |
25 | + // with underscores. | |
26 | + "camelcase": true, | |
27 | + | |
28 | + // Prohibit use of == and != in favor of === and !==. | |
29 | + "eqeqeq": true, | |
30 | + | |
31 | + // Enforce tab width of 2 spaces. | |
32 | + "indent": 4, | |
33 | + | |
34 | + // Prohibit use of a variable before it is defined. | |
35 | + "latedef": false, | |
36 | + | |
37 | + // Enforce line length to 100 characters | |
38 | + "maxlen": 100, | |
39 | + | |
40 | + // Require capitalized names for constructor functions. | |
41 | + "newcap": true, | |
42 | + | |
43 | + // Enforce use of single quotation marks for strings. | |
44 | + "quotmark": "single", | |
45 | + | |
46 | + // Enforce placing 'use strict' at the top function scope | |
47 | + "strict": false, | |
48 | + | |
49 | + // Prohibit use of explicitly undeclared variables. | |
50 | + "undef": true, | |
51 | + | |
52 | + // Warn when variables are defined but never used. | |
53 | + "unused": true, | |
54 | + | |
55 | + // Para que funcione en angular | |
56 | + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | |
57 | + /* | |
58 | + * RELAXING OPTIONS | |
59 | + * ================= | |
60 | + */ | |
61 | + | |
62 | + // Suppress warnings about == null comparisons. | |
63 | + "eqnull": true | |
64 | +} |
gulpfile.js
... | ... | @@ -0,0 +1,69 @@ |
1 | +const templateCache = require('gulp-angular-templatecache'); | |
2 | +const concat = require('gulp-concat'); | |
3 | +const htmlmin = require('gulp-htmlmin'); | |
4 | +const rename = require('gulp-rename'); | |
5 | +const uglify = require('gulp-uglify'); | |
6 | +const gulp = require('gulp'); | |
7 | +const pump = require('pump'); | |
8 | +const jshint = require('gulp-jshint'); | |
9 | +const replace = require('gulp-replace'); | |
10 | +const connect = require('gulp-connect'); | |
11 | + | |
12 | +var paths = { | |
13 | + srcJS: 'src/js/*.js', | |
14 | + srcViews: 'src/views/*.html', | |
15 | + tmp: 'tmp', | |
16 | + dist: 'dist/' | |
17 | +}; | |
18 | + | |
19 | +gulp.task('templates', function() { | |
20 | + return pump( | |
21 | + [ | |
22 | + gulp.src(paths.srcViews), | |
23 | + replace('views/', ''), | |
24 | + htmlmin(), | |
25 | + templateCache('views.js', { | |
26 | + module: 'focaBusquedaProductos', | |
27 | + root: '' | |
28 | + }), | |
29 | + gulp.dest(paths.tmp) | |
30 | + ] | |
31 | + ); | |
32 | +}); | |
33 | + | |
34 | +gulp.task('uglify', ['templates'], function() { | |
35 | + return pump( | |
36 | + [ | |
37 | + gulp.src([ | |
38 | + paths.srcJS, | |
39 | + 'tmp/views.js' | |
40 | + ]), | |
41 | + concat('foca-busqueda-productos.js'), | |
42 | + gulp.dest(paths.tmp), | |
43 | + rename('foca-busqueda-productos.min.js'), | |
44 | + uglify(), | |
45 | + gulp.dest(paths.dist) | |
46 | + ] | |
47 | + ); | |
48 | +}); | |
49 | + | |
50 | +gulp.task('pre-commit', function() { | |
51 | + return pump( | |
52 | + [ | |
53 | + gulp.src(paths.srcJS), | |
54 | + jshint('.jshintrc'), | |
55 | + jshint.reporter('default'), | |
56 | + jshint.reporter('fail') | |
57 | + ] | |
58 | + ); | |
59 | + | |
60 | + gulp.start('uglify'); | |
61 | +}); | |
62 | + | |
63 | +gulp.task('webserver', function() { | |
64 | + pump [ | |
65 | + connect.server({port: 3000}) | |
66 | + ] | |
67 | +}); | |
68 | + | |
69 | +gulp.task('default', ['webserver']); | |
0 | 70 | \ No newline at end of file |
package.json
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
7 | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | - "compile": "gulp uglify && gulp html", | |
8 | + "compile": "gulp uglify", | |
9 | 9 | "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js" |
10 | 10 | }, |
11 | 11 | "repository": { |