progress on being able to use exact same code base for backend and standalone version, building optimized build needs a little more work

This commit is contained in:
Torkel Ödegaard 2014-12-31 14:18:34 +01:00
parent 53ff171436
commit f8ddfec98c
6 changed files with 107 additions and 9 deletions

View File

@ -1,10 +1,10 @@
require.config({
urlArgs: 'bust=' + (new Date().getTime()),
baseUrl: window.grafanaRequireJsBaseUrl,
baseUrl: 'public/app',
paths: {
config: window.grafanaConfigUrl,
config: 'components/config',
settings: 'components/settings',
kbn: 'components/kbn',
store: 'components/store',

View File

@ -0,0 +1,99 @@
require.config({
urlArgs: 'bust=' + (new Date().getTime()),
baseUrl: 'app',
paths: {
config: ['../config', '../config.sample'],
settings: 'components/settings',
kbn: 'components/kbn',
store: 'components/store',
css: '../vendor/require/css',
text: '../vendor/require/text',
moment: '../vendor/moment',
filesaver: '../vendor/filesaver',
angular: '../vendor/angular/angular',
'angular-route': '../vendor/angular/angular-route',
'angular-sanitize': '../vendor/angular/angular-sanitize',
'angular-dragdrop': '../vendor/angular/angular-dragdrop',
'angular-strap': '../vendor/angular/angular-strap',
timepicker: '../vendor/angular/timepicker',
datepicker: '../vendor/angular/datepicker',
bindonce: '../vendor/angular/bindonce',
crypto: '../vendor/crypto.min',
spectrum: '../vendor/spectrum',
lodash: 'components/lodash.extended',
'lodash-src': '../vendor/lodash',
bootstrap: '../vendor/bootstrap/bootstrap',
jquery: '../vendor/jquery/jquery-2.1.1.min',
'extend-jquery': 'components/extend-jquery',
'jquery.flot': '../vendor/jquery/jquery.flot',
'jquery.flot.pie': '../vendor/jquery/jquery.flot.pie',
'jquery.flot.events': '../vendor/jquery/jquery.flot.events',
'jquery.flot.selection': '../vendor/jquery/jquery.flot.selection',
'jquery.flot.stack': '../vendor/jquery/jquery.flot.stack',
'jquery.flot.stackpercent':'../vendor/jquery/jquery.flot.stackpercent',
'jquery.flot.time': '../vendor/jquery/jquery.flot.time',
'jquery.flot.crosshair': '../vendor/jquery/jquery.flot.crosshair',
'jquery.flot.fillbelow': '../vendor/jquery/jquery.flot.fillbelow',
modernizr: '../vendor/modernizr-2.6.1',
'bootstrap-tagsinput': '../vendor/tagsinput/bootstrap-tagsinput',
},
shim: {
spectrum: {
deps: ['jquery']
},
crypto: {
exports: 'Crypto'
},
angular: {
deps: ['jquery','config'],
exports: 'angular'
},
bootstrap: {
deps: ['jquery']
},
modernizr: {
exports: 'Modernizr'
},
jquery: {
exports: 'jQuery'
},
// simple dependency declaration
//
'jquery.flot': ['jquery'],
'jquery.flot.pie': ['jquery', 'jquery.flot'],
'jquery.flot.events': ['jquery', 'jquery.flot'],
'jquery.flot.selection':['jquery', 'jquery.flot'],
'jquery.flot.stack': ['jquery', 'jquery.flot'],
'jquery.flot.stackpercent':['jquery', 'jquery.flot'],
'jquery.flot.time': ['jquery', 'jquery.flot'],
'jquery.flot.crosshair':['jquery', 'jquery.flot'],
'jquery.flot.fillbelow':['jquery', 'jquery.flot'],
'angular-dragdrop': ['jquery', 'angular'],
'angular-mocks': ['angular'],
'angular-sanitize': ['angular'],
'angular-route': ['angular'],
'angular-strap': ['angular', 'bootstrap','timepicker', 'datepicker'],
'bindonce': ['angular'],
timepicker: ['jquery', 'bootstrap'],
datepicker: ['jquery', 'bootstrap'],
'bootstrap-tagsinput': ['jquery'],
},
waitSeconds: 60,
});

View File

@ -13,13 +13,11 @@
<script type="text/javascript">
window.grafanaBackend = false;
window.grafanaRequireJsBaseUrl = 'app';
window.grafanaConfigUrl = ['../config', '../config.sample'];
</script>
<!-- build:js app/app.js -->
<script src="vendor/require/require.js"></script>
<script src="app/components/require.config.js"></script>
<script src="app/components/require.standalone.js"></script>
<!-- endbuild -->
<script>require(['app'], function (app) { app.boot(); })</script>

View File

@ -20,7 +20,7 @@ module.exports = function(grunt) {
'filerev',
'usemin',
'clean:temp',
'uglify:dest'
// 'uglify:dest'
]);
grunt.registerTask('build:grafanaVersion', function() {

View File

@ -28,7 +28,7 @@ module.exports = function(config) {
js: {
src: [
'<%= destDir %>/vendor/require/require.js',
'<%= destDir %>/app/components/require.config.js',
'<%= destDir %>/app/components/require.standalone.js',
'<%= destDir %>/app/app.js',
],
dest: '<%= destDir %>/app/app.js'

View File

@ -8,7 +8,7 @@ module.exports = function(config,grunt) {
dir: '<%= destDir %>',
baseUrl: './app',
mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
mainConfigFile: '<%= tempDir %>/app/components/require.standalone.js',
modules: [], // populated below,
optimize: 'none',
@ -63,7 +63,8 @@ module.exports = function(config,grunt) {
'directives/all',
'filters/all',
'controllers/all',
'routes/standalone/default',
'routes/standalone/all',
'routes/backend/all',
'components/partials',
]
}