Skip to content

Commit d96c905

Browse files
committed
use new yeoman generator structure
1 parent 661c961 commit d96c905

File tree

6 files changed

+211
-57
lines changed

6 files changed

+211
-57
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/node_modules/
33
/build/
44
/components/
5+
.tmp/

bower.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adf-widget-markdown",
3-
"version": "0.1.0-SNAPSHOT",
3+
"version": "0.1.0",
44
"main": "dist/adf-widget-markdown.js",
55
"ignore": [
66
"bower.json",
@@ -10,9 +10,22 @@
1010
"gulpfile.js",
1111
"node_modules",
1212
"package.json",
13+
"components",
1314
"src"
1415
],
16+
"keywords": [
17+
"dashboard",
18+
"widget",
19+
"adf",
20+
"adf-widget",
21+
"markdown"
22+
],
23+
"description": "Markdown widget for the angular-dashboard-framework",
1524
"dependencies": {
16-
"angular-markdown-directive": "~0.1.0"
25+
"angular-dashboard-framework": "0.7.0",
26+
"angular-markdown-directive": "^0.1.0"
27+
},
28+
"devDependencies": {
29+
"angular-local-storage": "0.1.5"
1730
}
1831
}

gulpfile.js

Lines changed: 70 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,104 @@
1-
/*
2-
* The MIT License
3-
*
4-
* Copyright (c) 2015, Sebastian Sdorra
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in
14-
* all copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
* SOFTWARE.
23-
*/
24-
25-
261
var gulp = require('gulp');
2+
var connect = require('gulp-connect');
3+
var wiredep = require('wiredep').stream;
274
var $ = require('gulp-load-plugins')();
28-
var rimraf = require('rimraf');
5+
var del = require('del');
296
var jsReporter = require('jshint-stylish');
7+
var annotateAdfPlugin = require('ng-annotate-adf-plugin');
308
var pkg = require('./package.json');
319

10+
var annotateOptions = {
11+
plugin: [
12+
annotateAdfPlugin
13+
]
14+
};
15+
3216
var templateOptions = {
3317
root: '{widgetsPath}/markdown/src',
3418
module: 'adf.widget.markdown'
3519
};
3620

21+
/** lint **/
22+
3723
gulp.task('csslint', function(){
38-
gulp.src('src/*.css')
24+
gulp.src('src/**/*.css')
3925
.pipe($.csslint())
4026
.pipe($.csslint.reporter());
4127
});
4228

4329
gulp.task('jslint', function(){
44-
gulp.src('src/*.js')
30+
gulp.src('src/**/*.js')
4531
.pipe($.jshint())
4632
.pipe($.jshint.reporter(jsReporter));
4733
});
4834

4935
gulp.task('lint', ['csslint', 'jslint']);
5036

51-
gulp.task('clean', function(cb){
52-
rimraf('dist', cb);
37+
/** serve **/
38+
39+
gulp.task('templates', function(){
40+
return gulp.src('src/**/*.html')
41+
.pipe($.angularTemplatecache('templates.tpl.js', templateOptions))
42+
.pipe(gulp.dest('.tmp/dist'));
43+
});
44+
45+
gulp.task('sample', ['templates'], function(){
46+
var files = gulp.src(['src/**/*.js', 'src/**/*.css', 'src/**/*.less', '.tmp/dist/*.js'])
47+
.pipe($.if('*.js', $.angularFilesort()));
48+
49+
gulp.src('sample/index.html')
50+
.pipe(wiredep({
51+
directory: './components/',
52+
bowerJson: require('./bower.json'),
53+
devDependencies: true,
54+
dependencies: true
55+
}))
56+
.pipe($.inject(files))
57+
.pipe(gulp.dest('.tmp/dist'))
58+
.pipe(connect.reload());
5359
});
5460

61+
gulp.task('watch', function(){
62+
gulp.watch(['src/**'], ['sample']);
63+
});
64+
65+
gulp.task('serve', ['watch', 'sample'], function(){
66+
connect.server({
67+
root: ['.tmp/dist', '.'],
68+
livereload: true,
69+
port: 9002
70+
});
71+
});
72+
73+
/** build **/
74+
5575
gulp.task('css', function(){
56-
gulp.src('src/*.css')
57-
.pipe($.concat(pkg.name + '.min.css'))
76+
gulp.src(['src/**/*.css', 'src/**/*.less'])
77+
.pipe($.if('*.less', $.less()))
78+
.pipe($.concat(pkg.name + '.css'))
79+
.pipe(gulp.dest('dist'))
80+
.pipe($.rename(pkg.name + '.min.css'))
5881
.pipe($.minifyCss())
59-
.pipe(gulp.dest('dist/'));
82+
.pipe(gulp.dest('dist'));
6083
});
6184

6285
gulp.task('js', function() {
63-
gulp.src(['src/*.js', 'src/*.html'])
86+
gulp.src(['src/**/*.js', 'src/**/*.html'])
6487
.pipe($.if('*.html', $.minifyHtml()))
6588
.pipe($.if('*.html', $.angularTemplatecache(pkg.name + '.tpl.js', templateOptions)))
66-
.pipe($.ngAnnotate())
67-
.pipe($.concat(pkg.name + '.min.js'))
68-
// https://github.com/olov/ng-annotate/issues/133
69-
//.pipe($.uglify())
70-
.pipe(gulp.dest('dist/'));
89+
.pipe($.angularFilesort())
90+
.pipe($.concat(pkg.name + '.js'))
91+
.pipe(gulp.dest('dist'))
92+
.pipe($.rename(pkg.name + '.min.js'))
93+
.pipe($.ngAnnotate(annotateOptions))
94+
.pipe($.uglify())
95+
.pipe(gulp.dest('dist'));
96+
});
97+
98+
/** clean **/
99+
100+
gulp.task('clean', function(cb){
101+
del(['dist', '.tmp'], cb);
71102
});
72103

73104
gulp.task('default', ['css', 'js']);

package.json

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
{
22
"name": "adf-widget-markdown",
3-
"version": "0.1.0-SNAPSHOT",
4-
"repository": {
5-
"type": "git",
6-
"url": "https://github.com/sdorra/adf-widget-markdown"
7-
},
3+
"version": "0.1.0",
4+
"keywords": [
5+
"dashboard",
6+
"widget",
7+
"adf",
8+
"adf-widget",
9+
"markdown"
10+
],
811
"description": "Markdown widget for the angular-dashboard-framework",
12+
"dependencies": {},
913
"devDependencies": {
10-
"gulp": "^3.8.10",
11-
"gulp-angular-templatecache": "^1.5.0",
12-
"gulp-concat": "^2.4.3",
14+
"gulp": "^3.8.11",
15+
"gulp-angular-filesort": "^1.1.1",
16+
"gulp-angular-templatecache": "^1.6.0",
17+
"gulp-concat": "^2.5.2",
18+
"gulp-connect": "~2.2.0",
1319
"gulp-csslint": "^0.1.5",
1420
"gulp-if": "^1.2.5",
15-
"gulp-jshint": "^1.9.0",
16-
"gulp-load-plugins": "^0.8.0",
17-
"gulp-minify-css": "^0.4.3",
18-
"gulp-minify-html": "^0.1.8",
21+
"gulp-inject": "^1.2.0",
22+
"gulp-jshint": "^1.9.4",
23+
"gulp-less": "^3.0.2",
24+
"gulp-load-plugins": "^0.9.0",
25+
"gulp-minify-css": "^1.0.0",
26+
"gulp-minify-html": "^1.0.1",
1927
"gulp-ng-annotate": "^0.5.2",
28+
"gulp-rename": "^1.2.0",
29+
"ng-annotate-adf-plugin": "^0.1.2",
2030
"gulp-uglify": "^1.1.0",
21-
"jshint-stylish": "^1.0.0",
22-
"rimraf": "^2.2.8",
23-
"ternary-stream": "^1.2.3",
24-
"through2": "^0.6.3"
31+
"jshint-stylish": "^1.0.1",
32+
"wiredep": "~2.2.2",
33+
"del": "^1.1.1"
2534
}
2635
}

sample/index.html

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="description" content="ADF Widget Sample">
8+
9+
<title>ADF Widget Sample</title>
10+
11+
<!-- bower:css -->
12+
<!-- endbower -->
13+
14+
<!-- inject:css -->
15+
<!-- endinject -->
16+
</head>
17+
18+
<body ng-app="adfWidgetSample">
19+
20+
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
21+
<div class="container">
22+
<div class="navbar-header">
23+
<button type="button" class="navbar-toggle">
24+
<span class="sr-only">Toggle navigation</span>
25+
<span class="icon-bar"></span>
26+
<span class="icon-bar"></span>
27+
<span class="icon-bar"></span>
28+
</button>
29+
<a class="navbar-brand" href="#">ADF Widget Sample</a>
30+
</div>
31+
</div>
32+
</div>
33+
34+
<div class="container" ng-controller="dashboardController">
35+
<adf-dashboard name="widgetSampleDashboard" structure="4-8" adf-model="dashboard.model" />
36+
</div>
37+
38+
<!-- bower:js -->
39+
<!-- endbower -->
40+
41+
<!-- inject:js -->
42+
<!-- endinject -->
43+
44+
<script type="text/javascript">
45+
angular
46+
.module('adfWidgetSample', ['adf', 'adf.widget.markdown', 'LocalStorageModule'])
47+
.config(function(dashboardProvider, localStorageServiceProvider){
48+
localStorageServiceProvider.setPrefix('adf.markdown');
49+
dashboardProvider.structure('4-8', {
50+
rows: [{
51+
columns: [{
52+
styleClass: 'col-md-4',
53+
widgets: []
54+
}, {
55+
styleClass: 'col-md-8',
56+
widgets: []
57+
}]
58+
}]
59+
})
60+
}).controller('dashboardController', function($scope, localStorageService){
61+
var model = localStorageService.get('widgetSampleDashboard');
62+
if (!model){
63+
model = {
64+
rows: [{
65+
columns: [{
66+
styleClass: 'col-md-4',
67+
widgets: []
68+
}, {
69+
styleClass: 'col-md-8',
70+
widgets: [{
71+
type: 'markdown',
72+
title: 'Markdown',
73+
config: {}
74+
}]
75+
}]
76+
}]
77+
};
78+
}
79+
$scope.dashboard = {
80+
model: model
81+
};
82+
$scope.$on('adfDashboardChanged', function (event, name, model) {
83+
localStorageService.set(name, model);
84+
});
85+
});
86+
</script>
87+
</body>
88+
</html>

0 commit comments

Comments
 (0)