Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

[WIP] Checks for dependencies #134

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
13 changes: 3 additions & 10 deletions demo/mobile/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

var browserifyNgannotate = require('browserify-ngannotate');
var uglifyify = require('uglifyify');
var _ = require('lodash');

module.exports = function(grunt) {

Expand All @@ -17,7 +15,7 @@ module.exports = function(grunt) {

},
external: [
'lodash', 'q', 'rx', 'async', 'angular', 'angular-ui-router', 'angular-material'
'angular', 'angular-ui-router', 'angular-material'
]
};

Expand All @@ -26,7 +24,7 @@ module.exports = function(grunt) {
alias[lib] = null;
}
return alias;
}, _.clone(browserifyConfg.alias));
}, {});

// Define the configuration for all the tasks
grunt.initConfig({
Expand Down Expand Up @@ -78,12 +76,7 @@ module.exports = function(grunt) {
},
options: {
watch: true,
alias: browserifyConfg.alias,
external: browserifyConfg.external,
transform: [
// [browserifyNgannotate, {global: true}]
// , [uglifyify, {global: true}]
]
external: browserifyConfg.external
}
},
vendor: {
Expand Down
17 changes: 2 additions & 15 deletions demo/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"angular-aria": "1.6.6",
"angular-material": "1.1.5",
"angular-ui-router": "0.4.3",
"async": "2.6.0",
"bluebird": "3.5.1",
"browserify-shim": "3.8.14",
"cordova-android": "6.3.0",
"cordova-browser": "5.0.1",
"cordova-plugin-camera": "3.0.0",
Expand All @@ -46,30 +46,17 @@
"cordova-plugin-network-information": "1.3.4",
"cordova-plugin-splashscreen": "4.1.0",
"cordova-plugin-whitelist": "1.3.3",
"debug": "3.1.0",
"fh-js-sdk": "2.18.6",
"grunt-cli": "1.2.0",
"keycloak-js": "3.4.0",
"lodash": "4.17.4",
"moment": "~2.19.2",
"q": "1.5.1",
"rx": "~4.1.0",
"shortid": "~2.2.8",
"underscore": "~1.8.3"
"lodash": "4.17.4"
},
"devDependencies": {
"browserify": "14.5.0",
"browserify-ngannotate": "~2.0.0",
"browserify-shim": "3.8.14",
"grunt": "1.0.1",
"grunt-browserify": "5.2.0",
"grunt-contrib-clean": "1.1.0",
"grunt-contrib-connect": "1.0.2",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "~20.1.0",
"grunt-newer": "1.3.0",
"grunt-rev": "0.1.0",
"grunt-sass": "2.0.0",
"load-grunt-tasks": "3.5.2",
"time-grunt": "1.4.0",
Expand Down
2 changes: 0 additions & 2 deletions demo/mobile/src/app/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

var angular = require('angular');
window.async = require('async');
window._ = require('underscore');
var logger = require('@raincatcher/logger');
var $fh = require('fh-js-sdk');

Expand Down
28 changes: 8 additions & 20 deletions demo/portal/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var uglifyify = require('uglifyify');
var _ = require('lodash');

module.exports = function(grunt) {

Expand All @@ -12,19 +11,17 @@ module.exports = function(grunt) {
require('time-grunt')(grunt);

var browserifyConfg = {
alias: {
},
external: [
'lodash', 'q', 'rx', 'async', 'c3', 'd3', 'angular', 'angular-ui-router', 'angular-material', 'ng-sortable'
'angular', 'angular-ui-router', 'angular-material'
]
};

browserifyConfg.vendor = browserifyConfg.external.reduce(function(alias, lib) {
if (! alias[lib]) {
if (!alias[lib]) {
alias[lib] = null;
}
return alias;
}, _.clone(browserifyConfg.alias));
}, {});

// Define the configuration for all the tasks
grunt.initConfig({
Expand Down Expand Up @@ -56,7 +53,7 @@ module.exports = function(grunt) {
},
css: {
files: [
{cwd: 'node_modules/', src: ['angular-material/angular-material.css', 'c3/c3.css'], dest: '<%= app.dist %>/css/', expand: true, flatten: true }
{ cwd: 'node_modules/', src: ['angular-material/angular-material.css'], dest: '<%= app.dist %>/css/', expand: true, flatten: true }
]
}
},
Expand Down Expand Up @@ -84,7 +81,7 @@ module.exports = function(grunt) {
},
options: {
watch: true,
alias: browserifyConfg.alias,
alias: {},
external: browserifyConfg.external
}
},
Expand All @@ -95,7 +92,7 @@ module.exports = function(grunt) {
debug: false,
alias: browserifyConfg.vendor,
transform: [
[uglifyify, {global: true}]
[uglifyify, { global: true }]
]
}
}
Expand Down Expand Up @@ -161,22 +158,13 @@ module.exports = function(grunt) {

eslint: {
src: ['application.js', 'src/**/*.js']
},

mochify: {
options: {
reporter: 'spec'
},
unit: {
src: ['src/app/**/*-spec.js']
}
}
});

grunt.registerTask('serve', function(target) {
if (target === 'local') {
var conn = 'http://' + grunt.config.get('connect.options.hostname') + ':' +
grunt.config.get('connect.options.port');
grunt.config.get('connect.options.port');
var url = grunt.option('url') || grunt.config.get('app.default_local_server_url');
grunt.config.set('app.url', conn + '/?url=' + url);
} else {
Expand All @@ -189,7 +177,7 @@ module.exports = function(grunt) {
]);
});

grunt.registerTask('test', ['eslint', 'mochify:unit']);
grunt.registerTask('test', ['eslint']);

grunt.registerTask('build', ['clean:dist', 'sass', 'copy', 'clean:server', 'browserify']);

Expand Down
22 changes: 2 additions & 20 deletions demo/portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"start": "grunt",
"build": "grunt build",
"test": "grunt eslint"
"test": "grunt test"
},
"keywords": [
"wfm"
Expand All @@ -32,27 +32,15 @@
"angular-aria": "1.6.6",
"angular-material": "1.1.5",
"angular-ui-router": "0.4.3",
"async": "2.6.0",
"bluebird": "3.5.1",
"c3": "0.4.18",
"cors": "2.8.4",
"d3": "4.12.0",
"debug": "3.1.0",
"express": "4.16.2",
"fh-js-sdk": "2.18.6",
"grunt-cli": "1.2.0",
"lodash": "4.17.4",
"moment": "2.19.2",
"ng-sortable": "1.3.8",
"q": "1.5.1",
"rx": "4.1.0",
"shortid": "2.2.8",
"underscore": "1.8.3"
"shortid": "2.2.8"
},
"devDependencies": {
"angular-mocks": "1.6.6",
"browserify": "14.5.0",
"browserify-ngannotate": "2.0.0",
"browserify-shim": "3.8.14",
"grunt": "1.0.1",
"grunt-browserify": "5.2.0",
Expand All @@ -61,14 +49,8 @@
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "20.1.0",
"grunt-mochify": "0.3.0",
"grunt-newer": "1.3.0",
"grunt-rev": "0.1.0",
"grunt-sass": "2.0.0",
"load-grunt-tasks": "3.5.2",
"should": "13.1.3",
"sinon": "4.1.2",
"sinon-as-promised": "4.0.3",
"time-grunt": "1.4.0",
"uglifyify": "4.0.5"
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"publish:demo-mobile": "rm -rf core/node_modules && lerna bootstrap && lerna run build --scope='@raincatcher/demo-mobile' --include-filtered-dependencies && NODE_DEBUG=gh-pages NODE_PATH=./node_modules node ./core/scripts/publish-app mobile --push true",
"publish:demo-portal": "rm -rf core/node_modules && lerna bootstrap && lerna run build --scope='@raincatcher/demo-portal' --include-filtered-dependencies && NODE_DEBUG=gh-pages NODE_PATH=./node_modules node ./core/scripts/publish-app portal --push true",
"update:check": "lerna exec --concurrency 1 -- ncu",
"depcheck": "lerna exec --parallel --stream -- depcheck --dev --specials='mocha,bin' --ignores='ts-node,@types/*' --ignore-dirs='example'",
"update:run": "lerna exec -- ncu -a --removeRange -x 'fh-js-sdk'"
},
"repository": {
Expand All @@ -31,6 +32,7 @@
"homepage": "https://github.com/feedhenry-raincatcher/raincatcher#readme",
"devDependencies": {
"@types/yargs": "8.0.2",
"depcheck": "^0.6.8",
"eslint": "4.11.0",
"gh-pages": "1.1.0",
"lerna": "2.5.1",
Expand Down
26 changes: 10 additions & 16 deletions packages/angularjs-auth-keycloak/lib/authInterceptor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

var q = require('q');

// Global this
var self;
var Promise = require('bluebird');

/**
* Keycloak angular auth interceptor.
Expand All @@ -11,28 +8,25 @@ var self;
*/
function AuthInterceptor(keycloakApi) {
this.keycloakApi = keycloakApi;
self = this;
}

/**
* Refreshes the Keycloak tokens upon every request
*/
AuthInterceptor.prototype.request = function request(config) {
var deferred = q.defer();
if (self.keycloakApi.token) {
self.keycloakApi.updateToken().success(function() {
if (!this.keycloakApi || !this.keycloakApi.token) {
return Promise.resolve(config);
}
return new Promise(function(resolve) {
this.keycloakApi.updateToken().success(function() {
config.headers = config.headers || {};
config.headers.Authorization = 'Bearer ' + self.keycloakApi.token;
deferred.resolve(config);
config.headers.Authorization = 'Bearer ' + this.keycloakApi.token;
return resolve(config);
}).error(function() {
// Intentionally do not fail on tokens when offline
deferred.resolve(config);
resolve(config);
});
} else {
deferred.resolve(config);
}

return deferred.promise;
});
};

module.exports = function(angularModule, keycloakApi) {
Expand Down
6 changes: 0 additions & 6 deletions packages/angularjs-auth-keycloak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
},
"dependencies": {
"@raincatcher/logger": "1.1.0",
"angular": "1.6.6",
"bluebird": "3.5.1",
"fh-js-sdk": "2.18.6",
"keycloak-js": "3.4.0"
},
"devDependencies": {
"browserify": "14.5.0",
"browserify-shim": "3.8.14"
}
}
7 changes: 3 additions & 4 deletions packages/angularjs-auth-passport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
},
"dependencies": {
"@raincatcher/logger": "1.1.0",
"angular": "1.6.6",
"bluebird": "3.5.1",
"browserify-shim": "3.8.14",
"fh-js-sdk": "2.18.6"
},
"devDependencies": {
"browserify": "14.5.0",
"browserify-shim": "3.8.14"
"peerDependencies": {
"angular": "^1.6.7"
}
}
18 changes: 2 additions & 16 deletions packages/angularjs-auth/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@

module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var appConfig = require('./lib/constants')
var appConfig = require('./lib/constants');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
src: ["lib/**/*.js"]
},

mochaTest: {
test: {
src: ['lib/**/*-spec.js'],
options: {
reporter: 'Spec',
logErrors: true,
timeout: 10000,
run: true
}
}
},
wfmTemplate: {
module: appConfig.AUTH_DIRECTIVE_MODULE,
templateDir: "lib/template",
Expand All @@ -29,10 +17,8 @@ module.exports = function(grunt) {
});

grunt.loadNpmTasks('fh-wfm-template-build');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks("grunt-eslint");
grunt.registerTask('mocha', ['mochaTest']);
grunt.registerTask('unit', ['eslint', 'mocha']);
grunt.registerTask('unit', ['eslint']);
grunt.registerTask('default', ['unit']);

};
13 changes: 2 additions & 11 deletions packages/angularjs-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,10 @@
"publishConfig": {
"access": "public"
},
"dependencies": {
"q": "1.5.1",
"shortid": "2.2.8"
},
"devDependencies": {
"chai": "4.1.2",
"fh-wfm-template-build": "0.2.1",
"grunt": "1.0.1",
"grunt-eslint": "20.1.0",
"grunt-mocha-test": "0.13.3",
"load-grunt-tasks": "3.5.2",
"mocha": "4.0.1",
"sinon": "4.1.2",
"sinon-as-promised": "4.0.3"
"grunt": "1.0.1",
"load-grunt-tasks": "3.5.2"
}
}
Loading