Commit 7efca250b04a0d250bff0f72daeafa4b2580ee86
0 parents
Exists in
master
Initial commit
Showing
5 changed files
with
191 additions
and
0 deletions
Show diff stats
.gitignore
.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 | +} |
README.md
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +foca-activar-hoja-ruta |
gulpfile.js
| ... | ... | @@ -0,0 +1,89 @@ |
| 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-es').default; | |
| 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 | +const clean = require('gulp-clean'); | |
| 12 | + | |
| 13 | +var paths = { | |
| 14 | + srcJS: 'src/js/*.js', | |
| 15 | + srcViews: 'src/views/*.html', | |
| 16 | + tmp: 'tmp', | |
| 17 | + dist: 'dist/' | |
| 18 | +}; | |
| 19 | + | |
| 20 | +gulp.task('templates', function() { | |
| 21 | + return pump( | |
| 22 | + [ | |
| 23 | + gulp.src(paths.srcViews), | |
| 24 | + replace('views/', ''), | |
| 25 | + htmlmin(), | |
| 26 | + templateCache('views.js', { | |
| 27 | + module: 'focaActivarHojaRuta', | |
| 28 | + root: '' | |
| 29 | + }), | |
| 30 | + gulp.dest(paths.tmp) | |
| 31 | + ] | |
| 32 | + ); | |
| 33 | +}); | |
| 34 | + | |
| 35 | +gulp.task('uglify', ['templates'], function() { | |
| 36 | + return pump( | |
| 37 | + [ | |
| 38 | + gulp.src([ | |
| 39 | + paths.srcJS, | |
| 40 | + 'tmp/views.js' | |
| 41 | + ]), | |
| 42 | + concat('foca-activar-hoja-ruta.js'), | |
| 43 | + replace("['ngRoute', 'focaModal', 'ui.bootstrap']", '[]'), | |
| 44 | + replace("src/views/", ''), | |
| 45 | + gulp.dest(paths.tmp), | |
| 46 | + rename('foca-activar-hoja-ruta.min.js'), | |
| 47 | + uglify(), | |
| 48 | + gulp.dest(paths.dist) | |
| 49 | + ] | |
| 50 | + ); | |
| 51 | +}); | |
| 52 | + | |
| 53 | +gulp.task('clean', function() { | |
| 54 | + return gulp.src(['tmp', 'dist'], {read: false}) | |
| 55 | + .pipe(clean()); | |
| 56 | +}); | |
| 57 | + | |
| 58 | +gulp.task('pre-commit', function() { | |
| 59 | + pump( | |
| 60 | + [ | |
| 61 | + gulp.src(paths.srcJS), | |
| 62 | + jshint('.jshintrc'), | |
| 63 | + jshint.reporter('default'), | |
| 64 | + jshint.reporter('fail') | |
| 65 | + ] | |
| 66 | + ); | |
| 67 | + | |
| 68 | + gulp.start('uglify'); | |
| 69 | +}); | |
| 70 | + | |
| 71 | +gulp.task('clean-post-install', function() { | |
| 72 | + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | |
| 73 | + 'index.html'], {read: false}) | |
| 74 | + .pipe(clean()); | |
| 75 | +}); | |
| 76 | + | |
| 77 | +gulp.task('compile', ['templates', 'uglify']); | |
| 78 | + | |
| 79 | +gulp.task('watch', function() { | |
| 80 | + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | |
| 81 | +}); | |
| 82 | + | |
| 83 | +gulp.task('webserver', function() { | |
| 84 | + pump [ | |
| 85 | + connect.server({port: 3000}) | |
| 86 | + ] | |
| 87 | +}); | |
| 88 | + | |
| 89 | +gulp.task('default', ['webserver']); |
package.json
| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | +{ | |
| 2 | + "name": "foca-activar-hoja-ruta", | |
| 3 | + "version": "0.0.1", | |
| 4 | + "description": "", | |
| 5 | + "main": "index.js", | |
| 6 | + "scripts": { | |
| 7 | + "test": "echo \"Error: no test specified\" && exit 1", | |
| 8 | + "compile": "gulp uglify", | |
| 9 | + "gulp-pre-commit": "gulp pre-commit", | |
| 10 | + "postinstall": "npm run compile && gulp clean-post-install", | |
| 11 | + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git git+ssh://git@debonline.dyndns.org:npm/foca-modal-remito.git" | |
| 12 | + }, | |
| 13 | + "pre-commit": [ | |
| 14 | + "gulp-pre-commit" | |
| 15 | + ], | |
| 16 | + "author": "", | |
| 17 | + "license": "ISC", | |
| 18 | + "devDependencies": { | |
| 19 | + "gulp": "^4.0.0", | |
| 20 | + "gulp-angular-templatecache": "^2.2.6", | |
| 21 | + "gulp-clean": "^0.4.0", | |
| 22 | + "gulp-connect": "^5.7.0", | |
| 23 | + "gulp-htmlmin": "^5.0.1", | |
| 24 | + "gulp-jshint": "^2.1.0", | |
| 25 | + "gulp-rename": "^1.4.0", | |
| 26 | + "gulp-replace": "^1.0.0", | |
| 27 | + "gulp-uglify": "^3.0.1", | |
| 28 | + "jshint": "^2.9.7", | |
| 29 | + "pre-commit": "^1.2.2", | |
| 30 | + "pump": "^3.0.0" | |
| 31 | + } | |
| 32 | +} |