leonardojs
Advanced tools
Comparing version 1.0.9 to 2.0.0
@@ -26,4 +26,3 @@ { | ||
"dependencies": { | ||
"angular": "~1.x.x", | ||
"angular-mocks": "~1.x.x" | ||
"angular": "~1.x.x" | ||
}, | ||
@@ -42,7 +41,3 @@ "ignore": [ | ||
"tests" | ||
], | ||
"devDependencies": { | ||
"tether-shepherd": "~1.1.3", | ||
"angular-deckgrid": "~0.5.0" | ||
} | ||
] | ||
} |
@@ -5,3 +5,4 @@ //<!-- if dev --> | ||
//angular.module('angular-il', ['ui.router']) | ||
.config(function ($compileProvider, $urlRouterProvider, $stateProvider, types, charactersList) { | ||
.config(['$compileProvider','$urlRouterProvider','$stateProvider','types','charactersList', | ||
function ($compileProvider, $urlRouterProvider, $stateProvider, types, charactersList) { | ||
$compileProvider.debugInfoEnabled(false); | ||
@@ -25,3 +26,3 @@ | ||
controllerAs: 'login', | ||
controller: function ($rootScope, $http, $state) { | ||
controller: ['$rootScope', '$http', '$state', function ($rootScope, $http, $state) { | ||
this.login = function () { | ||
@@ -42,3 +43,3 @@ $rootScope.loading = true; | ||
} | ||
} | ||
}] | ||
}) | ||
@@ -48,3 +49,3 @@ .state('characters', { | ||
controllerAs: 'characters', | ||
controller: function ($http, $rootScope, $scope, $state, characters) { | ||
controller: ['$rootScope', '$http', '$state', '$scope', 'characters', function($rootScope, $http, $state, $scope, characters) { | ||
this.type = 'turtles'; | ||
@@ -90,5 +91,5 @@ this.size = 'big'; | ||
}.bind(this)); | ||
}, | ||
}], | ||
resolve: { | ||
characters: function ($http) { | ||
characters: ['$http', function ($http) { | ||
return $http.get('/characters').then(function(res){ | ||
@@ -99,3 +100,3 @@ return res.data; | ||
}); | ||
} | ||
}] | ||
} | ||
@@ -105,9 +106,9 @@ }) | ||
templateUrl: 'complete.html', | ||
controller: function ($scope, $timeout) { | ||
controller: ['$scope', '$timeout', function ($scope, $timeout) { | ||
$timeout(function () { | ||
$scope.done = true; | ||
}, 20); | ||
} | ||
}] | ||
}); | ||
}) | ||
}]) | ||
.constant('types', { | ||
@@ -114,0 +115,0 @@ turtles: ['leonardo', 'donatelo', 'michelangelo', 'refael', 'splinter'], |
@@ -20,5 +20,4 @@ { | ||
"angular": "~1.4.8", | ||
"angular-ui-router": "~0.2.15", | ||
"leonardo": "git://github.com/outbrain/Leonardo#master" | ||
"angular-ui-router": "~0.2.15" | ||
} | ||
} |
@@ -34,3 +34,3 @@ | ||
"name": "Failure", | ||
"status": "401", | ||
"status": 401, | ||
"data": { | ||
@@ -185,6 +185,6 @@ "msg": "no no!" | ||
var debug = leoConfiguration.getState('debug'); | ||
var debug = leoConfiguration.getActiveStateOption('debug'); | ||
var isDebug = debug && debug.name === 'Enabled'; | ||
$rootScope.$on('leonardo:setStates', function () { | ||
var debug = leoConfiguration.getState('debug'); | ||
var debug = leoConfiguration.getActiveStateOption('debug'); | ||
if (!isDebug && debug) { | ||
@@ -191,0 +191,0 @@ angular.reloadWithDebugInfo(); |
107
gulpfile.js
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
var gulp = require('gulp'), | ||
@@ -11,3 +13,10 @@ path = require('path'), | ||
ngHtml2Js = require("gulp-ng-html2js"), | ||
concat = require('gulp-concat'); | ||
concat = require('gulp-concat'), | ||
ts = require('gulp-typescript'), | ||
source = require('vinyl-source-stream'), | ||
buffer = require('vinyl-buffer'), | ||
browserify = require('browserify'), | ||
tsify = require('tsify'), | ||
watchify = require('watchify'), | ||
css2js = require("gulp-css2js"); | ||
@@ -30,6 +39,4 @@ require("gulp-help")(gulp); | ||
}) | ||
.pipe(rename('leonardo.min.css')) | ||
.pipe(minifyCSS({ | ||
keepSpecialComments: 0 | ||
})) | ||
.pipe(css2js()) | ||
.pipe(rename('leonardo.css.js')) | ||
.pipe(gulp.dest('./tmp')); | ||
@@ -55,11 +62,7 @@ }); | ||
[ | ||
'./src/leonardo/module.js', | ||
'./src/leonardo/leonardo.prov.js', | ||
'./src/leonardo/configuration.srv.js', | ||
'./src/leonardo/httpInterceptor.srv.js', | ||
'./src/leonardo/storage.srv.js', | ||
'./src/leonardo/activator.drv.js', | ||
'./src/leonardo/window-body.drv.js', | ||
'./src/leonardo/request.drv.js', | ||
'./tmp/leonardo.templates.min.js' | ||
'./src/leonardo/sinon.js', | ||
'./tmp/leonardo-ts.js', | ||
'./src/leonardo/separator.js', | ||
'./tmp/leonardo.templates.min.js', | ||
'./tmp/leonardo.css.js' | ||
]) | ||
@@ -72,6 +75,5 @@ .pipe(concat('leonardo.js')) | ||
return gulp.src([ | ||
"./tmp/leonardo.js", | ||
"./tmp/leonardo.min.css" | ||
"./tmp/leonardo.js" | ||
]) | ||
.pipe(gulp.dest('./dist')); | ||
.pipe(gulp.dest('./dist')) | ||
}); | ||
@@ -83,2 +85,3 @@ | ||
'build:templates', | ||
'build:scripts', | ||
'build:js', | ||
@@ -90,3 +93,14 @@ 'clean:dist', | ||
}); | ||
function mockServerMiddleware(route) { | ||
return function (req, res, next) { | ||
if (req.url === '/' || req.url.length > 15) { | ||
return next(); | ||
} | ||
res.statusCode = 404; | ||
res.setHeader("Content-Type", "text/html"); | ||
return res.end(); | ||
}; | ||
} | ||
gulp.task('serve', "Serve files after build and watch", ['build', 'watch'], function () { | ||
@@ -97,3 +111,4 @@ gulp.src('') | ||
open: true, | ||
fallback: 'index.html' | ||
fallback: 'index.html', | ||
middleware: mockServerMiddleware('/') | ||
})); | ||
@@ -106,2 +121,58 @@ }); | ||
//gulp.task('build:scripts', 'transpile es whatever to es5', function () { | ||
// let tsProject = ts.createProject('tsconfig.json'); | ||
// | ||
// let tsResult = gulp.src('src/leonardo/leonardo.ts') | ||
// .pipe(ts(tsProject)); | ||
// | ||
// return tsResult.js | ||
// .pipe(gulp.dest('./dist')); | ||
//}); | ||
gulp.task('build:scripts', 'transpile es whatever to es5', function () { | ||
return typescript('./src/leonardo/', 'leonardo.ts', true); | ||
}); | ||
gulp.task("default", "Runs help task", ["help"], function() {}); | ||
function typescript(sourceFolder, sourceFile, watch) { | ||
let taskConfig = { | ||
client: { | ||
outDir: path.join('tmp'), | ||
out: 'leonardo-ts.js', | ||
options: { | ||
browserify: { | ||
entries: path.join(sourceFolder, sourceFile), | ||
extensions: ['.ts'], | ||
debug: true | ||
}, | ||
tsify: { | ||
"target": "ES5", | ||
"removeComments": true, | ||
"noImplicitAny": false | ||
} | ||
} | ||
} | ||
}; | ||
let opts = Object.assign({}, watchify.args, taskConfig.client.options.browserify); | ||
let b = browserify(opts); | ||
if (watch) { | ||
b = watchify(b); | ||
} | ||
b.plugin(tsify, taskConfig.client.options.tsify); | ||
b.on('update', bundle); // on any dep update, runs the bundler | ||
b.on('log', console.log); // output build logs to terminal | ||
function bundle() { | ||
return b.bundle() | ||
.on('error', console.log.bind(console.log, 'Browserify Error')) | ||
.pipe(source(taskConfig.client.out)) | ||
.pipe(buffer()) | ||
.pipe(gulp.dest(taskConfig.client.outDir)); | ||
} | ||
return bundle(); | ||
} |
{ | ||
"name": "leonardojs", | ||
"version": "1.0.9", | ||
"version": "2.0.0", | ||
"description": "Leonardo ========", | ||
"main": "dist/leonardo.js", | ||
"scripts": { | ||
"test": "test", | ||
"docs:example": "./node_modules/docco/bin/docco index.js --template=./build/docs/resources/example/docco.jst --output=./", | ||
"docs:main": "./node_modules/docco/bin/docco src/leonardo/*.js --template=./build/docs/resources/custom/docco.jst", | ||
"compile:docs": "npm run docs:main", | ||
"compile": "gulp && npm run compile:docs", | ||
"compile": "gulp build", | ||
"compile:watch": "gulp watch" | ||
@@ -30,8 +26,8 @@ }, | ||
"bower": "^1.3.12", | ||
"browserify": "^13.0.0", | ||
"canonical-path": "0.0.2", | ||
"del": "^1.2.0", | ||
"docco": "^0.7.0", | ||
"gulp": "^3.9.0", | ||
"gulp-concat": "^2.5.2", | ||
"gulp-docco": "0.0.4", | ||
"gulp-css2js": "^1.0.2", | ||
"gulp-help": "^1.3.4", | ||
@@ -43,6 +39,11 @@ "gulp-less": "^3.0.1", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-traceur-cmdline": "~1.3.8", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-typescript": "^2.12.0", | ||
"gulp-webserver": "^0.9.1", | ||
"run-sequence": "^1.0.1" | ||
"run-sequence": "^1.0.1", | ||
"tsify": "^0.13.2", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0", | ||
"watchify": "^3.7.0" | ||
} | ||
} |
@@ -8,7 +8,6 @@ ## Leonardo | ||
![Mocking and testing made simple and consistent. Developed by Outbrain.](extension/images/example.png) | ||
![Mocking and testing made simple and consistent. Developed by Outbrain.](https://raw.githubusercontent.com/outbrain/Leonardo/master/leonardo.png) | ||
## Examples | ||
## Example | ||
* [Simple Demo](http://outbrain.github.io/Leonardo/) | ||
* [Full Application Example](http://outbrain.github.io/Leonardo/examples/angularIL/) | ||
@@ -21,3 +20,2 @@ | ||
* __[Angular](https://github.com/angular/bower-angular)__ | ||
* __[Angular Mocks](https://github.com/angular/bower-angular-mocks)__ | ||
@@ -39,5 +37,4 @@ Installing via `npm` or `bower` will bring in the above dependencies as well. | ||
Angular (tested with v1.3) | ||
Angular Mocks module (tested with v1.3) | ||
#### Load Leonardo script | ||
#### Add Leonardo script | ||
@@ -50,3 +47,2 @@ ```html | ||
<script src="[bower_componenets|node_modules|other]/angular/angular.js"></script> | ||
<script src="[bower_componenets|node_modules|other]/angular-mocks/angular-mocks.js"></script> | ||
//..... | ||
@@ -58,14 +54,2 @@ <script src="[bower_componenets|node_modules|other]/leonardo/dist/leonardo.js"></script> | ||
#### Load Leonardo css | ||
```html | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
//..... | ||
<link rel="stylesheet" media="all" href="[bower_componenets|node_modules|other]/leonardo/dist/leonardo.min.css" /> | ||
</head> | ||
</html> | ||
``` | ||
#### Add Angular module dependency | ||
@@ -85,13 +69,3 @@ | ||
``` | ||
#### Add Attribute For UI Activation Via Icon | ||
```html | ||
<!DOCTYPE HTML> | ||
<html> | ||
<body ng-app="app" leo-activator> | ||
//..... | ||
</body> | ||
</html> | ||
``` | ||
## API | ||
@@ -153,50 +127,29 @@ #### Add States | ||
## Documentation | ||
http://outbrain.github.io/Leonardo/docs/configuration.srv.html | ||
## Running and contributing | ||
#### Compile | ||
#### Install dev dependencies | ||
`cd` into the project folder | ||
```bash | ||
npm run compile | ||
npm install | ||
``` | ||
This compiles the code as well as documentation. | ||
#### Build | ||
#### Auto Recompile | ||
To automatically recompile the files on each change run | ||
```bash | ||
npm run compile:watch | ||
gulp build | ||
``` | ||
Note that this does not recompile the documentation. | ||
#### Run (and watch) | ||
Note that this does not auto-refreshes the browser. | ||
#### Compile Documentation | ||
Running `npm run compile` compiles the documentation. But if you need to recompile it later also, | ||
(for example when running with `gulp watch`) run | ||
```bash | ||
npm run compile:docs | ||
gulp serve | ||
``` | ||
#### Running | ||
This will run the demo app (and auto-refresh the browser) | ||
Run local server and navigate to `index.html`. | ||
or `cd` into the project folder | ||
```bash | ||
gulp serve | ||
``` | ||
## License | ||
Copyright © 2015 MIT License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
14698
0
1
909387
21
64
1
149
6