Comparing version 0.0.3 to 0.0.4
var gulp = require('gulp') | ||
// Protractor | ||
var path = require('path') | ||
@@ -7,3 +9,2 @@ var child_process = require('child_process') | ||
var server = http.createServer(express().use(express.static(__dirname))) | ||
gulp.task('protractor-run', ['serve-files'], (done) => { | ||
@@ -23,2 +24,27 @@ var argv = process.argv.slice(3) // forward args to protractor | ||
return path.join(protractorDir, '/' + binaryName + winExt) | ||
} | ||
} | ||
// TypeScript | ||
var ts = require('gulp-typescript') | ||
var sourcemaps = require('gulp-sourcemaps') | ||
var tsProject = ts.createProject('src/tsconfig.json') | ||
gulp.task('typescript', function () { | ||
var tsResult = gulp.src('src/**/*.ts') | ||
.pipe(sourcemaps.init()) | ||
.pipe(ts(tsProject)) | ||
return tsResult.js | ||
.pipe(sourcemaps.write('.')) // no arg would make inline maps | ||
.pipe(gulp.dest('./src')) | ||
}) | ||
gulp.task('typescript:watch', ['typescript'], function () { | ||
gulp.watch('src/**/*.ts', ['typescript']) | ||
}) | ||
// SASS (for example-themed) | ||
var sass = require('gulp-sass') | ||
gulp.task('sass', function () { | ||
gulp.src('./node_modules/bootstrap/scss/bootstrap.scss') | ||
.pipe(sass().on('error', sass.logError)) | ||
.pipe(gulp.dest('./src/example-themed/css')) | ||
}) |
{ | ||
"name": "co-auther", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -8,11 +8,11 @@ "main": "src/co-auther/co-auther.js", | ||
"start": "node server", | ||
"build": "npm run tsc", | ||
"build": "npm run gulp-ts && npm run tsc-e2e && npm run gulp-sass", | ||
"prepublish": "npm run build", | ||
"tsc": "tsc -p src", | ||
"watch": "tsc -p src -w", | ||
"afterinstall": "jspm install && npm run webdriver", | ||
"afterinstall": "npm run webdriver", | ||
"webdriver": "node_modules/protractor/bin/webdriver-manager update", | ||
"tsc-e2e": "tsc -p test/e2e", | ||
"watch-tsc-e2e": "tsc -p test/e2e -w", | ||
"test-e2e": "npm run tsc-e2e && gulp test-e2e" | ||
"test-e2e": "npm run build && gulp test-e2e", | ||
"gulp-ts": "gulp typescript", | ||
"gulp-ts:watch": "gulp typescript:watch", | ||
"gulp-sass": "gulp sass", | ||
"tsc-e2e": "tsc -p test/e2e" | ||
}, | ||
@@ -27,25 +27,20 @@ "config": { | ||
"devDependencies": { | ||
"angular2": "^2.0.0-beta.0", | ||
"es6-promise": "^3.0.2", | ||
"es6-shim": "^0.33.13", | ||
"express": "^4.13.3", | ||
"ghooks": "^1.0.1", | ||
"gulp": "^3.9.0", | ||
"jspm": "^0.16.15", | ||
"protractor": "^3.0.0", | ||
"reflect-metadata": "^0.1.2", | ||
"rxjs": "^5.0.0-beta.0", | ||
"typescript": "^1.7.3", | ||
"zone.js": "^0.5.10" | ||
"angular2": "2.0.0-beta.1", | ||
"bootstrap": "git+https://git@github.com/twbs/bootstrap.git#v4-dev", | ||
"es6-promise": "3.0.2", | ||
"es6-shim": "0.33.13", | ||
"express": "4.13.3", | ||
"ghooks": "1.0.1", | ||
"gulp": "3.9.0", | ||
"gulp-sass": "^2.1.1", | ||
"gulp-sourcemaps": "1.6.0", | ||
"gulp-typescript": "2.10.0", | ||
"protractor": "3.0.0", | ||
"reflect-metadata": "0.1.2", | ||
"rxjs": "5.0.0-beta.0", | ||
"systemjs": "0.19.17", | ||
"typescript": "1.7.3", | ||
"zone.js": "0.5.10" | ||
}, | ||
"jspm": { | ||
"configFile": "jspm.config.js", | ||
"dependencies": { | ||
"angular2": "npm:angular2@^2.0.0-beta.0", | ||
"reflect-metadata": "npm:reflect-metadata@^0.1.2" | ||
}, | ||
"devDependencies": { | ||
"typescript": "npm:typescript@^1.6.2" | ||
} | ||
} | ||
"dependencies": {} | ||
} |
var dontTouchLocalStorage = false; | ||
var coAuther; | ||
var routeFunction = function (afterHash) { | ||
var loc = window.location; | ||
window.location.href = loc.protocol + "//" + loc.host + loc.pathname + "#/" + afterHash; | ||
}; | ||
var getCoAuther = function () { | ||
@@ -19,2 +23,3 @@ if (!coAuther) { | ||
// Determine if a route canActivate or not | ||
var initialRequestPending = false; | ||
function activationHelper(currentPage) { | ||
@@ -37,9 +42,13 @@ var canActivate = false; | ||
canActivate = currentPage === destinationRoute; | ||
getCoAuther().makeInitialRequestWrap().then(function () { | ||
// initialRequest done, move on to logged in | ||
routeTo(config.LOGGED_IN); | ||
}); | ||
if (!initialRequestPending) { | ||
initialRequestPending = true; | ||
getCoAuther().makeInitialRequestWrap().then(function () { | ||
initialRequestPending = false; | ||
// initialRequest done, move on to logged in | ||
return routeFunction(config.LOGGED_IN); | ||
}); | ||
} | ||
} | ||
if (!canActivate) { | ||
routeTo(destinationRoute); | ||
return routeFunction(destinationRoute); | ||
} | ||
@@ -49,7 +58,2 @@ return canActivate; | ||
exports.activationHelper = activationHelper; | ||
// TODO this should be replaced with the "correct" routing strategy | ||
function routeTo(afterHash) { | ||
var loc = window.location; | ||
window.location.href = loc.protocol + "//" + loc.host + loc.pathname + "#/" + afterHash; | ||
} | ||
function CoAuther(apiService) { | ||
@@ -70,3 +74,3 @@ var initialDataLoaded = false; | ||
setAuthData(res); | ||
routeTo(config.INITIAL_REQUEST); | ||
routeFunction(config.INITIAL_REQUEST); | ||
}) | ||
@@ -86,4 +90,4 @@ .catch(function (err) { | ||
clearAuthData(); | ||
// Logged out, go to authenticate page | ||
routeTo(config.AUTHENTICATE); | ||
// Logged out, reload page | ||
window.location.reload(); | ||
}); | ||
@@ -114,3 +118,3 @@ } | ||
} | ||
function initialize(apiService, newConfig) { | ||
function initialize(apiService, newConfig, newRouteFunction) { | ||
coAuther = CoAuther(apiService); | ||
@@ -134,2 +138,5 @@ if (newConfig.authData) { | ||
} | ||
if (newRouteFunction) { | ||
routeFunction = newRouteFunction; | ||
} | ||
} | ||
@@ -152,2 +159,3 @@ exports.initialize = initialize; | ||
} | ||
//# sourceMappingURL=co-auther.js.map | ||
//# sourceMappingURL=co-auther.js.map |
let dontTouchLocalStorage = false | ||
let coAuther | ||
let routeFunction = (afterHash) => { | ||
let loc = window.location | ||
window.location.href = `${loc.protocol}//${loc.host}${loc.pathname}#/${afterHash}` | ||
} | ||
let getCoAuther = function () { | ||
@@ -19,3 +23,4 @@ if (!coAuther) { | ||
// Determine if a route canActivate or not | ||
function activationHelper (currentPage) { | ||
var initialRequestPending = false | ||
function activationHelper (currentPage): any { | ||
let canActivate = false | ||
@@ -35,9 +40,13 @@ let destinationRoute = null | ||
canActivate = currentPage === destinationRoute | ||
getCoAuther().makeInitialRequestWrap().then(() => { | ||
// initialRequest done, move on to logged in | ||
routeTo(config.LOGGED_IN) | ||
}) | ||
if (!initialRequestPending) { | ||
initialRequestPending = true | ||
getCoAuther().makeInitialRequestWrap().then(() => { | ||
initialRequestPending = false | ||
// initialRequest done, move on to logged in | ||
return routeFunction(config.LOGGED_IN) | ||
}) | ||
} | ||
} | ||
if (!canActivate) { | ||
routeTo(destinationRoute) | ||
return routeFunction(destinationRoute) | ||
} | ||
@@ -47,8 +56,2 @@ return canActivate | ||
// TODO this should be replaced with the "correct" routing strategy | ||
function routeTo (afterHash) { | ||
let loc = window.location | ||
window.location.href = `${loc.protocol}//${loc.host}${loc.pathname}#/${afterHash}` | ||
} | ||
function CoAuther (apiService) { | ||
@@ -66,3 +69,3 @@ let initialDataLoaded = false | ||
setAuthData(res) | ||
routeTo(config.INITIAL_REQUEST) | ||
routeFunction(config.INITIAL_REQUEST) | ||
}) | ||
@@ -79,4 +82,4 @@ .catch((err) => { | ||
clearAuthData() | ||
// Logged out, go to authenticate page | ||
routeTo(config.AUTHENTICATE) | ||
// Logged out, reload page | ||
window.location.reload() | ||
}) | ||
@@ -110,3 +113,3 @@ } | ||
function initialize (apiService, newConfig) { | ||
function initialize (apiService, newConfig, newRouteFunction) { | ||
coAuther = CoAuther(apiService) | ||
@@ -130,2 +133,5 @@ if (newConfig.authData) { | ||
} | ||
if (newRouteFunction) { | ||
routeFunction = newRouteFunction | ||
} | ||
} | ||
@@ -132,0 +138,0 @@ |
{ | ||
"compilerOptions": { | ||
"target": "ES5", | ||
"target": "es5", | ||
"module": "commonjs", | ||
@@ -5,0 +5,0 @@ "sourceMap": true, |
var app_cmp_page_object_1 = require('./app-cmp.page-object'); | ||
describe('MyComponentPageObject', function () { | ||
beforeEach(function () { | ||
browser.get('/src/'); | ||
browser.get('/src/example-basic/'); | ||
}); | ||
@@ -6,0 +6,0 @@ var appCmpObj = new app_cmp_page_object_1.AppCmpPageObject(); |
@@ -15,3 +15,3 @@ // globals from protractor | ||
beforeEach(() => { | ||
browser.get('/src/') | ||
browser.get('/src/example-basic/') | ||
}) | ||
@@ -18,0 +18,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193540
72
5101
16
2
3