first step of gruntifying/nodifying/bowerifying the whole thing

This commit is contained in:
Manuel Friedli 2015-01-12 18:49:30 +01:00
parent 589751be5f
commit 018367f1ce
20 changed files with 201 additions and 20 deletions

3
.bowerrc Normal file
View file

@ -0,0 +1,3 @@
{
"directory": "bower_components"
}

13
.editorconfig Normal file
View file

@ -0,0 +1,13 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

4
.gitignore vendored
View file

@ -2,4 +2,6 @@
.idea .idea
*.iml *.iml
atlassian-ide-plugin.xml atlassian-ide-plugin.xml
/node_modules/
/bower_components/
/dist/

View file

@ -6,12 +6,14 @@
// Predefined globals whom JSHint will ignore. // Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`. "browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : true,
"jquery" : true, "jquery" : true,
"predef" : [ "predef" : [
"suite", "suite",
"test" "test",
"define",
"require"
], ],

119
Gruntfile.js Normal file
View file

@ -0,0 +1,119 @@
module.exports = function (grunt) {
'use strict';
// Load all grunt tasks
require('load-grunt-tasks')(grunt);
// Show elapsed time at the end
require('time-grunt')(grunt);
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed MIT */\n',
// Task configuration.
clean: {
files: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['src/uhr.js', 'src/uhr-*.js'],
dest: 'dist/jquery.<%= pkg.name %>.complete.js'
},
mainonly: {
src: ['src/uhr.js'],
dest: ['dist/jquery.<%= pkg.name %>.js']
},
langonly: {
src: ['src/uhr-%.js'],
dest: ['dist/jquery.<%= pkg.name %>.langs.js']
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.complete.min.js'
},
mainonly: {
src: '<%= concat.mainonly.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.min.js'
},
langonly: {
src: '<%= concat.langonly.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.langs.min.js'
}
},
qunit: {
all: {
options: {
urls: ['http://localhost:9000/test/<%= pkg.name %>.html']
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish')
},
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
src: {
options: {
jshintrc: '.jshintrc'
},
src: ['src/**/*.js']
// },
// test: {
// options: {
// jshintrc: 'test/.jshintrc'
// },
// src: ['test/**/*.js']
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src: {
files: '<%= jshint.src.src %>',
tasks: ['jshint:src', 'qunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit']
}
},
connect: {
server: {
options: {
hostname: '*',
port: 9000
}
}
}
});
// Default task.
grunt.registerTask('default', ['jshint', 'connect', 'qunit', 'clean', 'concat', 'uglify']);
grunt.registerTask('buildonly', ['clean', 'concat', 'uglify']);
grunt.registerTask('server', function () {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});
grunt.registerTask('serve', ['connect', 'watch']);
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
};

12
bower.json Normal file
View file

@ -0,0 +1,12 @@
{
"name": "uhr",
"version": "0.0.1",
"dependencies": {
"jquery-ui": "~1.11.2",
"jquery-cookie": "~1.4.1"
},
"devDependencies": {
"qunit": "~1.12.0",
"jquery": "latest"
}
}

View file

@ -34,16 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<script type="text/javascript" src="lib/jquery-2.1.0.min.js"></script> <script type="text/javascript" src="lib/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="lib/jquery-ui-1.10.4.custom.min.js"></script> <script type="text/javascript" src="lib/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="lib/jquery-cookie-1.4.0.js"></script> <script type="text/javascript" src="lib/jquery-cookie-1.4.0.js"></script>
<script type="text/javascript" src="js/uhr.js"></script> <script type="text/javascript" src="dist/jquery.uhr.min.js"></script>
<script type="text/javascript" src="js/uhr-de_CH.js"></script>
<script type="text/javascript" src="js/uhr-de_CH_genau.js"></script>
<script type="text/javascript" src="js/uhr-de.js"></script>
<script type="text/javascript" src="js/uhr-en.js"></script>
<script type="text/javascript" src="js/uhr-fr.js"></script>
<script type="text/javascript" src="js/uhr-it.js"></script>
<script type="text/javascript" src="js/uhr-es.js"></script>
<script type="text/javascript" src="js/uhr-nl.js"></script>
<script type="text/javascript" src="js/uhr-dk.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function go(url) { function go(url) {
window.location = url; window.location = url;

View file

@ -26,8 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script> <script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script> <script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script> <script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
<script type="text/javascript" src="../js/uhr.js"></script> <script type="text/javascript" src="../src/uhr.js"></script>
<script type="text/javascript" src="../js/uhr-de_CH.js"></script> <script type="text/javascript" src="../src/uhr-de_CH.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function go(url) { function go(url) {
window.location = url; window.location = url;

39
package.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "uhr",
"version": "0.0.1",
"description": "jQuery QLOCKTWO plugin",
"keywords": [
"jquery-plugin", "qlocktwo"
],
"homepage": "http://bärneruhr.ch/",
"author": {
"name": "Manuel Friedli",
"email": "manuel@fritteli.ch",
"url": "http://www.fritteli.ch/"
},
"repository": {
"type": "git",
"url": "https://gittr.ch/manuel/uhr"
},
"licenses": [
{
"type": "GPL3"
}
],
"devDependencies": {
"bower": "^1.3.12",
"grunt": "~0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-qunit": "~0.5.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"jshint-stylish": "~0.2.0",
"load-grunt-tasks": "~0.6.0",
"time-grunt": "~0.3.2",
"yo": "^1.3.3"
}
}

View file

@ -755,7 +755,7 @@
if (typeof layout.seconds !== 'undefined' && layout.seconds !== null) { if (typeof layout.seconds !== 'undefined' && layout.seconds !== null) {
parseTimeDefinition(letters, 'second', layout.seconds); parseTimeDefinition(letters, 'second', layout.seconds);
} else { } else {
parseTimeDefinition(letters, 'second', seconds) parseTimeDefinition(letters, 'second', seconds);
} }
parseTimeDefinition(letters, 'minute', layout.minutes); parseTimeDefinition(letters, 'minute', layout.minutes);
parseTimeDefinition(letters, 'hour', layout.hours); parseTimeDefinition(letters, 'hour', layout.hours);

View file

@ -15,8 +15,8 @@
<script src="../lib/jquery-2.1.0.min.js"></script> <script src="../lib/jquery-2.1.0.min.js"></script>
<script src="../lib/jquery-ui-1.10.4.custom.min.js"></script> <script src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
<script src="../lib/jquery-cookie-1.4.0.js"></script> <script src="../lib/jquery-cookie-1.4.0.js"></script>
<script src="../js/uhr.js"></script> <script src="../src/uhr.js"></script>
<script src="../js/uhr-de_CH.js"></script> <script src="../src/uhr-de_CH.js"></script>
<script src="test.js"></script> <script src="test.js"></script>
<div id="u"></div> <div id="u"></div>
<script> <script>