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
... | ... | @@ -9,10 +9,13 @@ const pump = require('pump'); |
9 | 9 | const jshint = require('gulp-jshint'); |
10 | 10 | const replace = require('gulp-replace'); |
11 | 11 | const connect = require('gulp-connect'); |
12 | +const header = require('gulp-header'); | |
13 | +const footer = require('gulp-footer'); | |
12 | 14 | |
13 | 15 | var paths = { |
14 | 16 | srcJS: 'src/js/*.js', |
15 | 17 | srcViews: 'src/views/*.html', |
18 | + specs: 'spec/*.js', | |
16 | 19 | tmp: 'tmp', |
17 | 20 | dist: 'dist/' |
18 | 21 | }; |
... | ... | @@ -31,7 +34,7 @@ gulp.task('templates', function() { |
31 | 34 | ); |
32 | 35 | }); |
33 | 36 | |
34 | -gulp.task('uglify', ['templates'], function() { | |
37 | +gulp.task('uglify', ['templates', 'uglify-spec'], function() { | |
35 | 38 | return pump( |
36 | 39 | [ |
37 | 40 | gulp.src([ |
... | ... | @@ -40,7 +43,6 @@ gulp.task('uglify', ['templates'], function() { |
40 | 43 | ]), |
41 | 44 | concat('foca-abm-precios-condiciones.js'), |
42 | 45 | replace('src/views/', ''), |
43 | - replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), | |
44 | 46 | gulp.dest(paths.tmp), |
45 | 47 | rename('foca-abm-precios-condiciones.min.js'), |
46 | 48 | uglify(), |
... | ... | @@ -49,15 +51,26 @@ gulp.task('uglify', ['templates'], function() { |
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 | 65 | gulp.task('clean', function() { |
53 | 66 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | 67 | .pipe(clean()); |
55 | 68 | }); |
56 | 69 | |
57 | 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 | 74 | jshint('.jshintrc'), |
62 | 75 | jshint.reporter('default'), |
63 | 76 | jshint.reporter('fail') |
... | ... | @@ -67,7 +80,7 @@ gulp.task('pre-commit', function() { |
67 | 80 | |
68 | 81 | gulp.task('clean-post-install', function() { |
69 | 82 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
70 | - 'index.html'], {read: false}) | |
83 | + 'index.html', 'spec'], {read: false}) | |
71 | 84 | .pipe(clean()); |
72 | 85 | }); |
73 | 86 |
package.json
... | ... | @@ -4,11 +4,11 @@ |
4 | 4 | "description": "ABM de precios y condiciones", |
5 | 5 | "main": "dist/foca-abm-precios-condiciones.js", |
6 | 6 | "scripts": { |
7 | - "test": "echo \"Error: no test specified\" && exit 1", | |
7 | + "test": "test.html", | |
8 | 8 | "compile": "gulp uglify", |
9 | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | 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 | 13 | "pre-commit": [ |
14 | 14 | "gulp-pre-commit" |
... | ... | @@ -34,15 +34,16 @@ |
34 | 34 | "pump": "^3.0.x" |
35 | 35 | }, |
36 | 36 | "devDependencies": { |
37 | - "angular": "^1.7.4", | |
38 | - "angular-route": "^1.7.5", | |
39 | - "bootstrap": "^4.1.3", | |
37 | + "angular": "^1.7.7", | |
38 | + "angular-mocks": "^1.7.7", | |
39 | + "angular-route": "^1.7.7", | |
40 | + "bootstrap": "^4.2.1", | |
40 | 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
41 | 42 | "font-awesome": "^4.7.0", |
42 | 43 | "gulp": "^3.9.1", |
43 | - "gulp-angular-templatecache": "^2.2.1", | |
44 | + "gulp-angular-templatecache": "^2.2.6", | |
44 | 45 | "gulp-clean": "^0.4.0", |
45 | - "gulp-connect": "^5.6.1", | |
46 | + "gulp-connect": "^5.7.0", | |
46 | 47 | "gulp-htmlmin": "^5.0.1", |
47 | 48 | "gulp-jshint": "^2.1.0", |
48 | 49 | "gulp-rename": "^1.4.0", |
... | ... | @@ -50,11 +51,11 @@ |
50 | 51 | "gulp-sequence": "^1.0.0", |
51 | 52 | "gulp-uglify": "^3.0.1", |
52 | 53 | "gulp-uglify-es": "^1.0.4", |
53 | - "jasmine-core": "^3.2.1", | |
54 | + "jasmine-core": "^3.3.0", | |
54 | 55 | "jquery": "^3.3.1", |
55 | - "jshint": "^2.9.6", | |
56 | + "jshint": "^2.10.1", | |
56 | 57 | "pre-commit": "^1.2.2", |
57 | 58 | "pump": "^3.0.0", |
58 | - "ui-bootstrap4": "^3.0.5" | |
59 | + "ui-bootstrap4": "^3.0.6" | |
59 | 60 | } |
60 | 61 | } |
src/js/app.js