Commit 77ce4d0b160d7002364bd8c3d681dd94c8f523e4
1 parent
59e9ab8ff4
Exists in
master
ulgify spec, quito inyecciones
Showing
3 changed files
with
30 additions
and
21 deletions
Show diff stats
gulpfile.js
| 1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
| 2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
| 3 | const clean = require('gulp-clean'); | 3 | const clean = require('gulp-clean'); |
| 4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
| 5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
| 6 | const uglify = require('gulp-uglify-es').default; | 6 | const uglify = require('gulp-uglify-es').default; |
| 7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
| 8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
| 9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
| 10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
| 11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
| 12 | const header = require('gulp-header'); | ||
| 13 | const footer = require('gulp-footer'); | ||
| 12 | 14 | ||
| 13 | var paths = { | 15 | var paths = { |
| 14 | srcJS: 'src/js/*.js', | 16 | srcJS: 'src/js/*.js', |
| 15 | srcViews: 'src/views/*.html', | 17 | srcViews: 'src/views/*.html', |
| 18 | specs: 'spec/*.js', | ||
| 16 | tmp: 'tmp', | 19 | tmp: 'tmp', |
| 17 | dist: 'dist/' | 20 | dist: 'dist/' |
| 18 | }; | 21 | }; |
| 19 | 22 | ||
| 20 | gulp.task('templates', function() { | 23 | gulp.task('templates', function() { |
| 21 | return pump( | 24 | return pump( |
| 22 | [ | 25 | [ |
| 23 | gulp.src(paths.srcViews), | 26 | gulp.src(paths.srcViews), |
| 24 | htmlmin(), | 27 | htmlmin(), |
| 25 | templateCache('views.js', { | 28 | templateCache('views.js', { |
| 26 | module: 'focaAbmPreciosCondiciones', | 29 | module: 'focaAbmPreciosCondiciones', |
| 27 | root: '' | 30 | root: '' |
| 28 | }), | 31 | }), |
| 29 | gulp.dest(paths.tmp) | 32 | gulp.dest(paths.tmp) |
| 30 | ] | 33 | ] |
| 31 | ); | 34 | ); |
| 32 | }); | 35 | }); |
| 33 | 36 | ||
| 34 | gulp.task('uglify', ['templates'], function() { | 37 | gulp.task('uglify', ['templates', 'uglify-spec'], function() { |
| 35 | return pump( | 38 | return pump( |
| 36 | [ | 39 | [ |
| 37 | gulp.src([ | 40 | gulp.src([ |
| 38 | paths.srcJS, | 41 | paths.srcJS, |
| 39 | 'tmp/views.js' | 42 | 'tmp/views.js' |
| 40 | ]), | 43 | ]), |
| 41 | concat('foca-abm-precios-condiciones.js'), | 44 | concat('foca-abm-precios-condiciones.js'), |
| 42 | replace('src/views/', ''), | 45 | replace('src/views/', ''), |
| 43 | replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), | ||
| 44 | gulp.dest(paths.tmp), | 46 | gulp.dest(paths.tmp), |
| 45 | rename('foca-abm-precios-condiciones.min.js'), | 47 | rename('foca-abm-precios-condiciones.min.js'), |
| 46 | uglify(), | 48 | uglify(), |
| 47 | gulp.dest(paths.dist) | 49 | gulp.dest(paths.dist) |
| 48 | ] | 50 | ] |
| 49 | ); | 51 | ); |
| 50 | }); | 52 | }); |
| 51 | 53 | ||
| 54 | gulp.task('uglify-spec', function() { | ||
| 55 | return pump([ | ||
| 56 | gulp.src(paths.specs), | ||
| 57 | concat('foca-abm-precios-condiciones.spec.js'), | ||
| 58 | replace("src/views/", ''), | ||
| 59 | header("describe('Módulo foca-abm-precios-condiciones', function() { \n"), | ||
| 60 | footer("});"), | ||
| 61 | gulp.dest(paths.dist) | ||
| 62 | ]); | ||
| 63 | }); | ||
| 64 | |||
| 52 | gulp.task('clean', function() { | 65 | gulp.task('clean', function() { |
| 53 | return gulp.src(['tmp', 'dist'], {read: false}) | 66 | return gulp.src(['tmp', 'dist'], {read: false}) |
| 54 | .pipe(clean()); | 67 | .pipe(clean()); |
| 55 | }); | 68 | }); |
| 56 | 69 | ||
| 57 | gulp.task('pre-commit', function() { | 70 | gulp.task('pre-commit', function() { |
| 58 | pump( | 71 | return pump( |
| 59 | [ | 72 | [ |
| 60 | gulp.src(paths.srcJS), | 73 | gulp.src([paths.srcJS, paths.specs]), |
| 61 | jshint('.jshintrc'), | 74 | jshint('.jshintrc'), |
| 62 | jshint.reporter('default'), | 75 | jshint.reporter('default'), |
| 63 | jshint.reporter('fail') | 76 | jshint.reporter('fail') |
| 64 | ] | 77 | ] |
| 65 | ); | 78 | ); |
| 66 | }); | 79 | }); |
| 67 | 80 | ||
| 68 | gulp.task('clean-post-install', function() { | 81 | gulp.task('clean-post-install', function() { |
| 69 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 82 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
| 70 | 'index.html'], {read: false}) | 83 | 'index.html', 'spec'], {read: false}) |
| 71 | .pipe(clean()); | 84 | .pipe(clean()); |
| 72 | }); | 85 | }); |
| 73 | 86 | ||
| 74 | gulp.task('webserver', function() { | 87 | gulp.task('webserver', function() { |
| 75 | pump [ | 88 | pump [ |
| 76 | connect.server({port: 3000}) | 89 | connect.server({port: 3000}) |
| 77 | ] | 90 | ] |
| 78 | }); | 91 | }); |
| 79 | 92 | ||
| 80 | gulp.task('default', ['webserver']); | 93 | gulp.task('default', ['webserver']); |
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-abm-precios-condiciones", | 2 | "name": "foca-abm-precios-condiciones", |
| 3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
| 4 | "description": "ABM de precios y condiciones", | 4 | "description": "ABM de precios y condiciones", |
| 5 | "main": "dist/foca-abm-precios-condiciones.js", | 5 | "main": "dist/foca-abm-precios-condiciones.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "test.html", |
| 8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
| 9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | "install-dev": "npm install -D jasmine-core pre-commit angular 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 gulp-replace jquery jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular 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 gulp-replace jquery jshint pump angular-mocks git+http://git.focasoftware.com/npm/foca-modal.git" |
| 12 | }, | 12 | }, |
| 13 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | 16 | "repository": { |
| 17 | "type": "git", | 17 | "type": "git", |
| 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git" | 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git" |
| 19 | }, | 19 | }, |
| 20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
| 21 | "license": "ISC", | 21 | "license": "ISC", |
| 22 | "peerDependencies": { | 22 | "peerDependencies": { |
| 23 | "angular": "^1.7.x", | 23 | "angular": "^1.7.x", |
| 24 | "bootstrap": "^4.1.x", | 24 | "bootstrap": "^4.1.x", |
| 25 | "jquery": "^3.3.x", | 25 | "jquery": "^3.3.x", |
| 26 | "font-awesome": "^4.7.x", | 26 | "font-awesome": "^4.7.x", |
| 27 | "gulp": "^3.9.x", | 27 | "gulp": "^3.9.x", |
| 28 | "gulp-concat": "2.6.x", | 28 | "gulp-concat": "2.6.x", |
| 29 | "gulp-jshint": "^2.1.x", | 29 | "gulp-jshint": "^2.1.x", |
| 30 | "gulp-rename": "^1.4.x", | 30 | "gulp-rename": "^1.4.x", |
| 31 | "gulp-replace": "^1.0.x", | 31 | "gulp-replace": "^1.0.x", |
| 32 | "gulp-uglify-es": "^1.0.x", | 32 | "gulp-uglify-es": "^1.0.x", |
| 33 | "jshint": "^2.9.x", | 33 | "jshint": "^2.9.x", |
| 34 | "pump": "^3.0.x" | 34 | "pump": "^3.0.x" |
| 35 | }, | 35 | }, |
| 36 | "devDependencies": { | 36 | "devDependencies": { |
| 37 | "angular": "^1.7.4", | 37 | "angular": "^1.7.7", |
| 38 | "angular-route": "^1.7.5", | 38 | "angular-mocks": "^1.7.7", |
| 39 | "bootstrap": "^4.1.3", | 39 | "angular-route": "^1.7.7", |
| 40 | "bootstrap": "^4.2.1", | ||
| 40 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
| 41 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
| 42 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
| 43 | "gulp-angular-templatecache": "^2.2.1", | 44 | "gulp-angular-templatecache": "^2.2.6", |
| 44 | "gulp-clean": "^0.4.0", | 45 | "gulp-clean": "^0.4.0", |
| 45 | "gulp-connect": "^5.6.1", | 46 | "gulp-connect": "^5.7.0", |
| 46 | "gulp-htmlmin": "^5.0.1", | 47 | "gulp-htmlmin": "^5.0.1", |
| 47 | "gulp-jshint": "^2.1.0", | 48 | "gulp-jshint": "^2.1.0", |
| 48 | "gulp-rename": "^1.4.0", | 49 | "gulp-rename": "^1.4.0", |
| 49 | "gulp-replace": "^1.0.0", | 50 | "gulp-replace": "^1.0.0", |
| 50 | "gulp-sequence": "^1.0.0", | 51 | "gulp-sequence": "^1.0.0", |
| 51 | "gulp-uglify": "^3.0.1", | 52 | "gulp-uglify": "^3.0.1", |
| 52 | "gulp-uglify-es": "^1.0.4", | 53 | "gulp-uglify-es": "^1.0.4", |
| 53 | "jasmine-core": "^3.2.1", | 54 | "jasmine-core": "^3.3.0", |
| 54 | "jquery": "^3.3.1", | 55 | "jquery": "^3.3.1", |
| 55 | "jshint": "^2.9.6", | 56 | "jshint": "^2.10.1", |
| 56 | "pre-commit": "^1.2.2", | 57 | "pre-commit": "^1.2.2", |
| 57 | "pump": "^3.0.0", | 58 | "pump": "^3.0.0", |
| 58 | "ui-bootstrap4": "^3.0.5" | 59 | "ui-bootstrap4": "^3.0.6" |
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| 61 | 62 |
src/js/app.js
| 1 | angular.module('focaAbmPreciosCondiciones', [ | 1 | angular.module('focaAbmPreciosCondiciones', ['ngRoute']); |
| 2 | 'ngRoute', | ||
| 3 | 'ui.bootstrap', | ||
| 4 | 'focaModal', | ||
| 5 | 'focaBotoneraLateral' | ||
| 6 | ]); | ||
| 7 | 2 |