From 8b16db8d677796f830962b31e0e16aaac906937a Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Wed, 17 Jul 2019 14:53:36 -0300 Subject: [PATCH] first commit --- .gitignore | 2 ++ .jshintrc | 64 +++++++++++++++++++++++++++++++++ README.md | 1 + gulpfile.js | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 42 ++++++++++++++++++++++ 5 files changed, 223 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 README.md create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49e0fc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/package-lock.json \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..2dfccda --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": false, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": false, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..deaf132 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +#FACTURADOR WEB-MOBILE diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..6c74f85 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,114 @@ +const templateCache = require('gulp-angular-templatecache'); +const clean = require('gulp-clean'); +const concat = require('gulp-concat'); +const htmlmin = require('gulp-htmlmin'); +const rename = require('gulp-rename'); +const uglify = require('gulp-uglify'); +const gulp = require('gulp'); +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); +const header = require('gulp-header'); +const footer = require('gulp-footer'); +const gulpSequence = require('gulp-sequence'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + specs: 'spec/*.js', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('uglify', function(callback) { + gulpSequence('clean', ['templates'], 'uglify-app')(callback); +}); + +gulp.task('templates', function() { + return pump( + [ + gulp.src(paths.srcViews), + htmlmin(), + templateCache('views.js', { + module: 'focaCrearFactura', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify-app', function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-crear-factura.js'), + replace('src/views/', ''), + gulp.dest(paths.tmp), + rename('foca-crear-factura.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('uglify-spec', function() { + return pump( + [ + gulp.src(paths.specs), + concat('foca-crear-factura.spec.js'), + replace('src/views/', ''), + header("describe('Módulo foca-crear-factura', function() { \n"), + footer("});"), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('clean', function() { + return gulp.src(['tmp', 'dist'], {read: false}).pipe(clean()); +}); + +gulp.task('pre-commit', function() { + return pump( + [ + gulp.src([paths.srcJS, paths.specs]), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + + gulp.start('uglify'); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3300, host: '0.0.0.0'}) + ] +}); + +gulp.task('clean-post-install', function() { + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', + 'index.html'], {read: false}) + .pipe(clean()); +}); + +gulp.task('default', ['webserver']); + +gulp.task('watch', function() { + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); +}); + +gulp.task('copy', ['uglify'], function() { + return gulp.src('dist/*.js') + .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); +}); + +gulp.task('watchAndCopy', function() { + return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..d0439e1 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "foca-crear-factura", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies 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" + }, + "repository": { + "type": "git", + "url": "http://git.focasoftware.com/npm/foca-crear-factura.git" + }, + "author": "Foca Software", + "license": "ISC", + "devDependencies": { + "angular": "^1.7.8", + "angular-cookies": "^1.7.8", + "angular-ladda": "^0.4.3", + "angular-route": "^1.7.8", + "bootstrap": "^4.3.1", + "font-awesome": "^4.7.0", + "gulp": "^4.0.2", + "gulp-angular-templatecache": "^3.0.0", + "gulp-clean": "^0.4.0", + "gulp-connect": "^5.7.0", + "gulp-htmlmin": "^5.0.1", + "gulp-jshint": "^2.1.0", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-sequence": "^1.0.0", + "gulp-uglify": "^3.0.2", + "gulp-uglify-es": "^1.0.4", + "jasmine-core": "^3.4.0", + "jquery": "^3.4.1", + "jshint": "^2.10.2", + "ladda": "^1.0.6", + "pre-commit": "^1.2.2", + "pump": "^3.0.0", + "ui-bootstrap4": "^3.0.6" + } +} -- 1.9.1