Skip to content

Commit

Permalink
Build: replaced Bower by NPM + moved config out of minimized file + u…
Browse files Browse the repository at this point in the history
…pgraded some UI dependencies.
  • Loading branch information
evoluteur committed Nov 5, 2020
1 parent 7a36b12 commit 101ba82
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 108 deletions.
56 changes: 23 additions & 33 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = function (grunt) {

function uiDependenciesList(){
var pkg=grunt.file.readJSON('bower.json'),
var pkg=grunt.file.readJSON('package.json'),
lst = [];
if(pkg){
var deps = pkg.dependencies;
for(var p in deps){
lst.push(p+' '+deps[p]);
lst.push(p+' '+deps[p].replace('^', ''));
}
}
return lst.join(' + ');
Expand All @@ -24,7 +24,7 @@ module.exports = function (grunt) {
' <%= pkg.copyright %> \n' +
' <%= pkg.homepage %> \n*/\n',

bannerDependencies: '/*!\n <%= pkg.name %> <%= pkg.version %> dependencies: ' +
bannerDependencies: '/*!\n <%= pkg.name %> <%= pkg.version %>\n\ndependencies: ' +
uiDependenciesList()+'\n*/\n',

// *************************************************************************************
Expand All @@ -39,33 +39,33 @@ module.exports = function (grunt) {
src: [

// D3.js
'bower_components/d3/d3.js',
'node_modules/d3/d3.js',

// PapaParse.js (CSV parser)
'bower_components/papaparse/papaparse.js',
'node_modules/papaparse/papaparse.js',

// jQuery
'bower_components/jquery/dist/jquery.js',
//'bower_components/jquery.csv.js',
'node_modules/jquery/dist/jquery.js',
//'node_modules/jquery.csv.js',

// Backbone & Underscore
'bower_components/underscore/underscore.js',
//'bower_components/underscore.string/lib/underscore.string.js',
'bower_components/backbone/backbone.js',
'bower_components/backbone.localStorage/backbone.localStorage.js',
'node_modules/underscore/underscore.js',
//'node_modules/underscore.string/lib/underscore.string.js',
'node_modules/backbone/backbone.js',
'node_modules/backbone.localStorage/backbone.localstorage.js',

// Twitter Bootstrap
'bower_components/bootstrap/js/modal.js',
'bower_components/bootstrap/js/dropdown.js',
'bower_components/bootstrap/js/button.js',
'bower_components/bootstrap/js/tooltip.js',
'bower_components/bootstrap/js/popover.js',
//'bower_components/bootstrap/js/carousel.js',
'node_modules/bootstrap/js/modal.js',
'node_modules/bootstrap/js/dropdown.js',
'node_modules/bootstrap/js/button.js',
'node_modules/bootstrap/js/tooltip.js',
'node_modules/bootstrap/js/popover.js',
//'node_modules/bootstrap/js/carousel.js',

// Widgets
'bower_components/bootstrap-datepicker/js/bootstrap-datepicker.js',
'bower_components/select2/select2.js',
'bower_components/toastr/toastr.js'
'node_modules/bootstrap-datepicker/js/bootstrap-datepicker.js',
'node_modules/select2/dist/js/select2.js',
'node_modules/toastr/toastr.js'
],
dest: '<%= pkg.target %>/dependencies.js'
},
Expand All @@ -75,7 +75,7 @@ module.exports = function (grunt) {
separator: ';\n'
},
src: [
'config.js',
//'config.js',
'js/i18n/EN.js',

'js/dico/def.js',
Expand Down Expand Up @@ -132,19 +132,9 @@ module.exports = function (grunt) {
expand: true,
flatten: true,
src: [
'bower_components/bootstrap/dist/fonts/*'
'node_modules/bootstrap/dist/fonts/*'
],
dest: '<%= pkg.target %>/fonts/bootstrap/'
},
{
expand: true,
flatten: true,
src: [
'bower_components/select2/select2-spinner.gif',
'bower_components/select2/select2.png',
'bower_components/select2/select2x2.png'
],
dest: '<%= pkg.target %>/css'
}
]
}
Expand All @@ -158,7 +148,6 @@ module.exports = function (grunt) {

'Gruntfile.js',
'package.json',
'bower.json',

'js/dico/*.js',
'js/i18n/EN.js',
Expand Down Expand Up @@ -264,6 +253,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-sass');
//var sass = require('node-sass');

grunt.registerTask('header', 'Evolutility version', function(arg1) {
var pkg=grunt.file.readJSON('package.json');
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ By default, Evolutility-UI-jQuery is configured use localStorage for storing dat
```bash
# To rebuild the project
cd evolutility-ui-jquery
bower install
npm install
grunt
```

Expand Down Expand Up @@ -371,7 +371,7 @@ The React alternative:

## Documentation

The (beginning of a) [documentation](http://evoluteur.github.io/evolutility-ui-jquery/doc/index.html) is in progress: [ui-models](http://evoluteur.github.io/evolutility-ui-jquery/doc/ui-model.html) and [views](http://evoluteur.github.io/evolutility-ui-jquery/doc/views.html).
[Documentation](http://evoluteur.github.io/evolutility-ui-jquery/doc/index.html): [ui-models](http://evoluteur.github.io/evolutility-ui-jquery/doc/ui-model.html) and [views](http://evoluteur.github.io/evolutility-ui-jquery/doc/views.html).

## License

Expand Down
32 changes: 0 additions & 32 deletions bower.json

This file was deleted.

4 changes: 1 addition & 3 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// default config for Evolutility-UI-jQuery

var Evol = Evol || {};

Evol.Config = {
var EvoConfig = {

// --- using localStorage
localStorage: true,
Expand Down
6 changes: 3 additions & 3 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var ViewDescriptions = {

function createSampleDataIfEmpty(entityName){
var M, MS;
if(Evol.Config.localStorage){
if(EvoConfig.localStorage){
var lc = new Backbone.LocalStorage('evol-'+entityName);
M = Backbone.Model.extend({
localStorage: lc
Expand All @@ -37,11 +37,11 @@ function createSampleDataIfEmpty(entityName){
});
}else{
M = Backbone.Model.extend({
urlRoot: Evol.Config.url+entityName
urlRoot: EvoConfig.url+entityName
});
Ms = Backbone.Collection.extend({
model: M,
url: Evol.Config.url+entityName/*,
url: EvoConfig.url+entityName/*,
sync : function(method, collection, options) {
//options.dataType = "jsonp";
return Backbone.sync(method, collection, options);
Expand Down
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link href="../dist/css/demo.css" rel="stylesheet" />
<link href="../dist/css/evolutility-ui-jquery.min.css" rel="stylesheet" />

<script src="../config.js" type="text/javascript"></script>
<script src="demo.js" type="text/javascript"></script>
<script src="demo-data.min.js" type="text/javascript"></script>
<script src="../models/contacts.js" type="text/javascript"></script>
Expand Down
1 change: 1 addition & 0 deletions demo/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<link href="../dist/css/demo.css" rel="stylesheet" />
<link href="../dist/css/evolutility-ui-jquery.min.css" rel="stylesheet" />

<script src="../config.js" type="text/javascript"></script>
<script src="../dist/dependencies.min.js" type="text/javascript"></script>
<script src="demo.js" type="text/javascript"></script>
<script src="../models/test.data.js" type="text/javascript"></script>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link href="dist/css/demo.css" rel="stylesheet" />
<link href="dist/css/evolutility-ui-jquery.min.css" rel="stylesheet" />

<script src="config.js" type="text/javascript"></script>
<script src="demo/demo.js" type="text/javascript"></script>
<script src="demo/demo-data.min.js" type="text/javascript"></script>
<script src="models/contacts.js" type="text/javascript"></script>
Expand Down
8 changes: 5 additions & 3 deletions js/dico/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*
*************************************************************************** */

EvoConfig = EvoConfig || {};

Evol.App = Backbone.View.extend({

//events: {
Expand Down Expand Up @@ -161,8 +163,8 @@ Evol.App = Backbone.View.extend({
createEntity: function($v, uiModel, data, defaultView, options, cb){
var that=this, url, M, Ms;

if(Evol.Config){
if(Evol.Config.localStorage){
if(EvoConfig){
if(EvoConfig.localStorage){
var lc = new Backbone.LocalStorage(this.prefix+(uiModel.table || uiModel.id));
M = Backbone.Model.extend({
localStorage: lc
Expand All @@ -172,7 +174,7 @@ Evol.App = Backbone.View.extend({
localStorage: lc
});
}else{
url = Evol.Config.url+uiModel.id;
url = EvoConfig.url+uiModel.id;
M = Backbone.Model.extend({
urlRoot: url
});
Expand Down
6 changes: 3 additions & 3 deletions js/view-action/action-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ return Backbone.View.extend({
// d3.csv.parse(csv);


if(Evol.Config.localStorage){
if(EvoConfig.localStorage){
var lc = new Backbone.LocalStorage('evol-'+entityId);
M = Backbone.Model.extend({
localStorage: lc
Expand All @@ -92,11 +92,11 @@ return Backbone.View.extend({
});
}else{
M = new Backbone.Model({
urlRoot: Evol.Config.url+entityId
urlRoot: EvoConfig.url+entityId
});
Ms = Backbone.Collection.extend({
model: M,
url: Evol.Config.url+entityId/*,
url: EvoConfig.url+entityId/*,
sync : function(method, collection, options) {
//options.dataType = "jsonp";
return Backbone.sync(method, collection, options);
Expand Down
8 changes: 4 additions & 4 deletions js/view-action/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ return Backbone.View.extend({
alert('Error: Invalid model ID.');
};

if(Evol.Config.localStorage){
if(EvoConfig.localStorage){
m = this.collection.get(id);
if(_.isUndefined(m)){
fnError();
Expand All @@ -592,7 +592,7 @@ return Backbone.View.extend({
}
}else{
var M = Backbone.Model.extend({
urlRoot: Evol.Config.url+that.uiModel.id
urlRoot: EvoConfig.url+that.uiModel.id
});
m = new M({id:id});
m.fetch({
Expand Down Expand Up @@ -724,7 +724,7 @@ return Backbone.View.extend({
if(id || this.curView.cardinality==='1'){
if(id){
//this.setModelById(id, true);
var mid=Evol.Config.localStorage?''+id:id; // using string or int
var mid=EvoConfig.localStorage?''+id:id; // using string or int
this.model=this.collection.findWhere({id: mid});
var t=this.uiModel.fnTitle;
if(t && this.model){
Expand Down Expand Up @@ -778,7 +778,7 @@ return Backbone.View.extend({
alert('error in "deleteItem"');
}
};
if(!(id || Evol.Config.localStorage)){
if(!(id || EvoConfig.localStorage)){
opts.url=that.model.url();
}
collec.remove(delModel);
Expand Down
44 changes: 26 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,23 @@
"homepage": "http://evoluteur.github.io/evolutility-ui-jquery/",
"author": "Olivier Giulieri (https://evoluteur.github.io/)",
"repository": {
"type": "git",
"url": "git://github.com/evoluteur/evolutility-ui-jquery.git"
"type": "git",
"url": "git://github.com/evoluteur/evolutility-ui-jquery.git"
},
"bugs": "https://github.com/evoluteur/evolutility-ui-jquery/issues",
"resolutions": {
"jquery": "3.4.1"
},
"dependencies": {
"bootstrap-sass": "^3.3.7"
"bootstrap-sass": "^3.3.7",
"jquery": "^3.5.1",
"backbone": "^1.4.0",
"backbone.localstorage": "^1.1.6",
"underscore": "^1.11.0",
"papaparse": "^5.3.0",
"d3": "^3.5.17",
"bootstrap": "^3.3.7",
"bootstrap-datepicker": "^1.6.4",
"select2": "^4.0.13",
"toastr": "^2.1.4",
"balloon-css": "^1.2.0"
},
"devDependencies": {
"grunt": "~1.0.1",
Expand All @@ -27,17 +35,17 @@
"grunt-sass": "^2.0.0"
},
"keywords": [
"low-code",
"model",
"metadata",
"UI",
"forms",
"CRUD",
"Backbone",
"MDA",
"javascript",
"forms",
"MVC",
"evolutility"
"low-code",
"model",
"metadata",
"UI",
"forms",
"CRUD",
"Backbone",
"MDA",
"javascript",
"forms",
"MVC",
"evolutility"
]
}
Loading

0 comments on commit 101ba82

Please sign in to comment.