Commit c471375bbce220082a1438ece49e5024b939a521

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-login!2
1 /node_modules 1 /node_modules
2 /dist 2 /dist
3 /tmp 3 /tmp
4 package-lock\.json 4 package-lock\.json
5 /src/etc/develop.js
5 6
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 11
11 var paths = { 12 var paths = {
12 srcJS: 'src/js/*.js', 13 srcJS: 'src/js/*.js',
13 srcViews: 'src/views/*.html', 14 srcViews: 'src/views/*.html',
14 tmp: 'tmp', 15 tmp: 'tmp',
15 dist: 'dist/' 16 dist: 'dist/'
16 }; 17 };
17 18
18 gulp.task('templates', function() { 19 gulp.task('templates', function() {
19 return pump( 20 return pump(
20 [ 21 [
21 gulp.src(paths.srcViews), 22 gulp.src(paths.srcViews),
22 htmlmin(), 23 htmlmin(),
23 templateCache('views.js', { 24 templateCache('views.js', {
24 module: 'focaLogin', 25 module: 'focaLogin',
25 root: '' 26 root: ''
26 }), 27 }),
27 gulp.dest(paths.tmp) 28 gulp.dest(paths.tmp)
28 ] 29 ]
29 ); 30 );
30 }); 31 });
31 32
32 gulp.task('uglify', ['templates'], function() { 33 gulp.task('uglify', ['templates'], function() {
33 return pump( 34 return pump(
34 [ 35 [
35 gulp.src([ 36 gulp.src([
36 paths.srcJS, 37 paths.srcJS,
37 'tmp/views.js' 38 'tmp/views.js'
38 ]), 39 ]),
39 concat('foca-login.js'), 40 concat('foca-login.js'),
41 replace("['ngRoute', 'ngCookies']",'[]'),
42 replace('src/views/', ''),
40 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
41 rename('foca-login.min.js'), 44 rename('foca-login.min.js'),
42 uglify(), 45 uglify(),
43 gulp.dest(paths.dist) 46 gulp.dest(paths.dist)
44 ] 47 ]
45 ); 48 );
46 }); 49 });
47 50
48 gulp.task('clean', function() { 51 gulp.task('clean', function() {
49 return gulp.src(['tmp', 'dist'], {read: false}) 52 return gulp.src(['tmp', 'dist'], {read: false})
50 .pipe(clean()); 53 .pipe(clean());
51 }); 54 });
52 55
53 gulp.task('pre-commit', function() { 56 gulp.task('pre-commit', function() {
54 pump( 57 pump(
55 [ 58 [
56 gulp.src(paths.srcJS), 59 gulp.src(paths.srcJS),
57 jshint('.jshintrc'), 60 jshint('.jshintrc'),
58 jshint.reporter('default'), 61 jshint.reporter('default'),
59 jshint.reporter('fail') 62 jshint.reporter('fail')
60 ] 63 ]
61 ); 64 );
62 }); 65 });
63 66
64 gulp.task('clean-post-install', function() { 67 gulp.task('clean-post-install', function() {
65 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 68 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
66 'index.html'], {read: false}) 69 'index.html'], {read: false})
67 .pipe(clean()); 70 .pipe(clean());
68 }); 71 });
69 72
70 gulp.task('compile', ['templates', 'uglify']); 73 gulp.task('compile', ['templates', 'uglify']);
71 74
72 gulp.task('webserver', function() { 75 gulp.task('webserver', function() {
73 pump [ 76 pump [
74 connect.server({port: 3000}) 77 connect.server({port: 3000})
75 ] 78 ]
76 }); 79 });
77 80
78 gulp.task('default', ['webserver']); 81 gulp.task('default', ['webserver']);
79 82
File was created 1 <html ng-app="focaLogin">
2 <head>
3 <meta charset="UTF-8"/>
4 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
5
6 <!--CSS-->
7 <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
8 <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
9
10 <!--VENDOR JS-->
11 <script src="node_modules/jquery/dist/jquery.min.js"></script>
12 <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
13 <script src="node_modules/angular/angular.min.js"></script>
14 <script src="node_modules/angular-route/angular-route.min.js"></script>
15 <script src="node_modules/angular-cookies/angular-cookies.min.js"></script>
16
17 <script src="src/js/app.js"></script>
18 <script src="src/js/route.js"></script>
19 <script src="src/js/controller.js"></script>
20 <script src="src/js/service.js"></script>
21 <script src="src/etc/develop.js"></script>
22 </head>
23 <body ng-view>
24
25 </body>
26 </html>
27
1 { 1 {
2 "name": "foca-login", 2 "name": "foca-login",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "Login", 4 "description": "Login",
5 "main": "dist/foca-login.js", 5 "main": "dist/foca-login.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp compile", 8 "compile": "gulp compile",
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 gulp gulp-connect jasmine-core pre-commit angular bootstrap font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es jquery jshint pump" 11 "install-dev": "npm install -D gulp gulp-connect jasmine-core pre-commit angular angular-route angular-cookies bootstrap font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-replace jquery jshint pump"
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-login.git" 18 "url": "https://192.168.0.11/modulos-npm/foca-login.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.5",
38 "angular-cookies": "^1.7.5",
39 "angular-route": "^1.7.5",
38 "bootstrap": "^4.1.3", 40 "bootstrap": "^4.1.3",
39 "font-awesome": "^4.7.0", 41 "font-awesome": "^4.7.0",
40 "gulp": "^3.9.1", 42 "gulp": "^3.9.1",
41 "gulp-angular-templatecache": "^2.2.1", 43 "gulp-angular-templatecache": "^2.2.1",
42 "gulp-clean": "^0.4.0", 44 "gulp-clean": "^0.4.0",
43 "gulp-connect": "^5.6.1", 45 "gulp-connect": "^5.6.1",
44 "gulp-htmlmin": "^5.0.1", 46 "gulp-htmlmin": "^5.0.1",
45 "gulp-jshint": "^2.1.0", 47 "gulp-jshint": "^2.1.0",
46 "gulp-rename": "^1.4.0", 48 "gulp-rename": "^1.4.0",
47 "gulp-replace": "^1.0.0", 49 "gulp-replace": "^1.0.0",
48 "gulp-sequence": "^1.0.0", 50 "gulp-sequence": "^1.0.0",
49 "gulp-uglify-es": "^1.0.4", 51 "gulp-uglify-es": "^1.0.4",
50 "jasmine-core": "^3.2.1", 52 "jasmine-core": "^3.2.1",
51 "jquery": "^3.3.1", 53 "jquery": "^3.3.1",
52 "jshint": "^2.9.6", 54 "jshint": "^2.9.6",
53 "pre-commit": "^1.2.2", 55 "pre-commit": "^1.2.2",
54 "pump": "^3.0.0" 56 "pump": "^3.0.0"
55 } 57 }
56 } 58 }
57 59
src/etc/develop.js.ejemplo
File was created 1 angular.module('focaLogin')
2 .constant("API_ENDPOINT", {
3 'URL': 'http://192.168.0.23:9900'
4 });
5
1 angular.module('focaLogin', []) 1 angular.module('focaLogin', ['ngRoute', 'ngCookies'])
2 .run(['$rootScope', '$cookies', '$location', function($rootScope, $cookies, $location) { 2 .run(['$rootScope', '$cookies', '$location', function($rootScope, $cookies, $location) {
3 $rootScope.$on('$locationChangeStart', function() { 3 $rootScope.$on('$locationChangeStart', function() {
4 var idUsuario = $cookies.get('idUsuario'); 4 var idUsuario = $cookies.get('idUsuario');
5 if(!idUsuario) { 5 if(!idUsuario) {
6 if($location.path() !== '/login') { 6 if($location.path() !== '/login') {
7 $location.path('/login'); 7 $location.path('/login');
8 } 8 }
9 } 9 }
10 }); 10 });
11 }]); 11 }]);
12 12
1 angular.module('focaLogin') 1 angular.module('focaLogin')
2 .config([ 2 .config([
3 '$routeProvider', 3 '$routeProvider',
4 function($routeProvider) { 4 function($routeProvider) {
5 $routeProvider 5 $routeProvider
6 .when('/login', { 6 .when('/login', {
7 controller: 'focaLoginController', 7 controller: 'focaLoginController',
8 templateUrl: 'foca-login.html' 8 templateUrl: 'src/views/foca-login.html'
9 }) 9 })
10 .when('/logout', { 10 .when('/logout', {
11 controller: 'focaLogoutController', 11 controller: 'focaLogoutController',
12 template: '' 12 template: ''
13 }); 13 });
14 } 14 }
15 ]); 15 ]);
16 16