Skip to content

Commit d5db8e3

Browse files
authored
Merge pull request #11 from Pamblam/fine.-i-give-up.-let's-use-a-stupid-build-system
Fine. i give up. let's use a stupid build system
2 parents b8cb624 + e1a3cf6 commit d5db8e3

31 files changed

Lines changed: 2881 additions & 68 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/nbproject/
22
/tests/.jsqldatastore
3-
.jsqldatastore
3+
.jsqldatastore
4+
package-lock.json
5+
node_modules

Gruntfile.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.initConfig({
4+
pkg: grunt.file.readJSON('package.json'),
5+
concat: {
6+
options: {
7+
banner: '/**\n * <%= pkg.name %> - v<%= pkg.version %>' +
8+
'\n * <%= pkg.description %>' +
9+
'\n * @author <%= pkg.author %>' +
10+
'\n * @website <%= pkg.homepage %>' +
11+
'\n * @license <%= pkg.license %>' +
12+
'\n */\n\n'
13+
},
14+
dist: {
15+
src: [
16+
'src/wrapper/head.js.part',
17+
'src/error_handling/jSQL_Error.js',
18+
'src/error_handling/error_handling.js',
19+
'src/data_types/jSQLDataTypeList.js',
20+
'src/table/jSQLTable.js',
21+
'src/query_types/jSQLQuery.js',
22+
'src/query_types/jSQLDeleteQuery.js',
23+
'src/query_types/jSQLDropQuery.js',
24+
'src/query_types/jSQLInsertQuery.js',
25+
'src/query_types/jSQLSelectQuery.js',
26+
'src/query_types/jSQLUpdateQuery.js',
27+
'src/query_types/jSQLCreateQuery.js',
28+
'src/parser/jSQLParseQuery.js',
29+
'src/parser/jSQLWhereClause.js',
30+
'src/persistence/API.js',
31+
'src/persistence/persistenceManager.js',
32+
'src/sugar/createTable.js',
33+
'src/sugar/select.js',
34+
'src/sugar/update.js',
35+
'src/sugar/insertInto.js',
36+
'src/sugar/dropTable.js',
37+
'src/sugar/deleteFrom.js',
38+
'src/helpers/jSQLReset.js',
39+
'src/helpers/jSQLMinifier.js',
40+
'src/helpers/removeQuotes.js',
41+
'src/wrapper/foot.js.part'
42+
],
43+
dest: 'jSQL.js',
44+
},
45+
},
46+
'string-replace': {
47+
version: {
48+
files: {
49+
"jSQL.js": "jSQL.js"
50+
},
51+
options: {
52+
replacements: [{
53+
pattern: /{{ VERSION }}/g,
54+
replacement: '"<%= pkg.version %>"'
55+
}]
56+
}
57+
}
58+
},
59+
uglify: {
60+
options: {
61+
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> */'
62+
},
63+
build: {
64+
src: 'jSQL.js',
65+
dest: 'jSQL.min.js'
66+
}
67+
}
68+
});
69+
70+
grunt.loadNpmTasks('grunt-contrib-concat');
71+
grunt.loadNpmTasks('grunt-string-replace');
72+
grunt.loadNpmTasks('grunt-contrib-uglify');
73+
74+
grunt.registerTask('default', [
75+
'concat',
76+
'string-replace',
77+
'uglify'
78+
]);
79+
};

jSQL.js

100755100644
Lines changed: 30 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/**
2-
* jSQL.js v2.9.1
3-
* A Javascript Query Language Database Engine
4-
* @author Robert Parham
2+
* jsql-official - v2.9.1
3+
* A persistent SQL database.
4+
* @author Rob Parham
55
* @website http://pamblam.github.io/jSQL/
6-
* @license http://www.apache.org/licenses/LICENSE-2.0
6+
* @license Apache-2.0
77
*/
88

99
;(function(){
1010
var isNode = !!(typeof module !== 'undefined' && module.exports);
1111
var jSQL = (function(){
1212
"use strict";
1313

14-
////////////////////////////////////////////////////////////////////////////
15-
// jSQL Error Handling /////////////////////////////////////////////////////
16-
////////////////////////////////////////////////////////////////////////////
17-
14+
/**
15+
* Error object constructor
16+
* @param {String} error_no
17+
*/
1818
function jSQL_Error(error_no) {
1919
this.error = error_no;
2020
this.stack = undefined;
@@ -97,6 +97,7 @@
9797
return "jSQL Error #"+this.error+" - "+this.message;
9898
};
9999
}
100+
100101

101102
var error_handler_function = function(){};
102103
var mute_jsql_errors = false;
@@ -108,12 +109,9 @@
108109
function onError(funct){
109110
if(typeof funct === "function") error_handler_function = funct;
110111
}
112+
111113

112-
////////////////////////////////////////////////////////////////////////////
113-
// jSQLDataTypeList ////////////////////////////////////////////////////////
114-
////////////////////////////////////////////////////////////////////////////
115-
116-
function jSQLDataTypeList(){
114+
function jSQLDataTypeList(){
117115
this.list = [{
118116
type: "NUMERIC",
119117
aliases: ["NUMBER", "DECIMAL", "FLOAT"],
@@ -333,10 +331,7 @@
333331
return _throw(new jSQL_Error("0007"));
334332
};
335333
}
336-
337-
////////////////////////////////////////////////////////////////////////////
338-
// jSQL Table constructor //////////////////////////////////////////////////
339-
////////////////////////////////////////////////////////////////////////////
334+
340335

341336
function jSQLTable(name, columns, data, types, keys, auto_increment){
342337
var self = this;
@@ -612,10 +607,7 @@
612607

613608
self.init(name, columns, data, types, keys, auto_increment);
614609
}
615-
616-
////////////////////////////////////////////////////////////////////////////
617-
// jSQL Query constructor //////////////////////////////////////////////////
618-
////////////////////////////////////////////////////////////////////////////
610+
619611

620612
function jSQLQuery(type){
621613
var self = this;
@@ -650,10 +642,7 @@
650642
};
651643
})(i);
652644
}
653-
654-
////////////////////////////////////////////////////////////////////////////
655-
// jSQL Query Type constructors ////////////////////////////////////////////
656-
////////////////////////////////////////////////////////////////////////////
645+
657646

658647
function jSQLDeleteQuery(){
659648
this.init = function(tablename){
@@ -734,6 +723,7 @@
734723
return this;
735724
};
736725
}
726+
737727

738728
function jSQLDropQuery(){
739729
this.init = function(tablename){
@@ -749,6 +739,7 @@
749739
this.fetch = function(){ return null; };
750740
this.fetchAll = function(){ return []; };
751741
}
742+
752743

753744
function jSQLInsertQuery(){
754745
this.init = function(table){
@@ -780,6 +771,7 @@
780771
this.fetch = function(){ return null; };
781772
this.fetchAll = function(){ return []; };
782773
}
774+
783775

784776
function jSQLSelectQuery(){
785777
this.init = function(columns){
@@ -864,6 +856,7 @@
864856
return this;
865857
};
866858
}
859+
867860

868861
function jSQLUpdateQuery(){
869862
this.init = function(table){
@@ -1021,10 +1014,6 @@
10211014
this.fetchAll = function(){ return []; };
10221015
}
10231016

1024-
////////////////////////////////////////////////////////////////////////////
1025-
// Parse String Query //////////////////////////////////////////////////////
1026-
////////////////////////////////////////////////////////////////////////////
1027-
10281017
function jSQLParseQuery(query){
10291018

10301019
// Predcit the correct casing for column and table names
@@ -1713,10 +1702,7 @@
17131702
return _throw(new jSQL_Error("0041"));
17141703
}
17151704
}
1716-
1717-
////////////////////////////////////////////////////////////////////////////
1718-
// Where caluse ////////////////////////////////////////////////////////////
1719-
////////////////////////////////////////////////////////////////////////////
1705+
17201706

17211707
function jSQLWhereClause(context){
17221708
var self = this;
@@ -1981,10 +1967,7 @@
19811967
return resultRowIndexes;
19821968
};
19831969
}
1984-
1985-
////////////////////////////////////////////////////////////////////////////
1986-
// Data Storage APIs ///////////////////////////////////////////////////////
1987-
////////////////////////////////////////////////////////////////////////////
1970+
19881971

19891972
var API = {
19901973

@@ -2387,10 +2370,7 @@
23872370

23882371
}
23892372
};
2390-
2391-
////////////////////////////////////////////////////////////////////////////
2392-
// Persistence Manager /////////////////////////////////////////////////////
2393-
////////////////////////////////////////////////////////////////////////////
2373+
23942374

23952375
var persistenceManager = new (function(){
23962376
var self = this;
@@ -2590,10 +2570,6 @@
25902570

25912571
})();
25922572

2593-
////////////////////////////////////////////////////////////////////////////
2594-
// Syntactic sugar /////////////////////////////////////////////////////////
2595-
////////////////////////////////////////////////////////////////////////////
2596-
25972573
function createTable(name, columnsOrData, types, keys, auto_increment){
25982574

25992575
// allow for all params to be passed in a single object
@@ -2654,15 +2630,18 @@
26542630
if(!Array.isArray(keys)) keys=[keys];
26552631
return new jSQLQuery("CREATE").init(name, columnsOrData, types, keys, auto_increment);
26562632
}
2633+
26572634

26582635
function select(cols){
26592636
if(!Array.isArray(cols)) cols=[cols];
26602637
return new jSQLQuery("SELECT").init(cols);
26612638
}
2639+
26622640

26632641
function update(table){
26642642
return new jSQLQuery("UPDATE").init(table);
26652643
}
2644+
26662645

26672646
function insertInto(tablename){
26682647
return new jSQLQuery("INSERT").init(tablename);
@@ -2671,20 +2650,19 @@
26712650
function dropTable(tablename){
26722651
return new jSQLQuery("DROP").init(tablename);
26732652
}
2653+
26742654

26752655
function deleteFrom(tablename){
26762656
return new jSQLQuery("DELETE").init(tablename);
26772657
}
2678-
2679-
////////////////////////////////////////////////////////////////////////////
2680-
// Helper/Misc Methods /////////////////////////////////////////////////////
2681-
////////////////////////////////////////////////////////////////////////////
2658+
26822659

26832660
function jSQLReset(){
26842661
jSQL.tables = {};
26852662
jSQL.commit();
26862663
}
2687-
2664+
2665+
26882666
function jSQLMinifier(sql){
26892667
var cleanSQL = "";
26902668
var lines = sql.split("\n");
@@ -2756,12 +2734,8 @@
27562734
return str;
27572735
}
27582736

2759-
////////////////////////////////////////////////////////////////////////////
2760-
// Exposed Methods /////////////////////////////////////////////////////////
2761-
////////////////////////////////////////////////////////////////////////////
2762-
27632737
return {
2764-
version: 2.91,
2738+
version: "2.9.1",
27652739
tables: {},
27662740
query: jSQLParseQuery,
27672741
createTable: createTable,
@@ -2790,4 +2764,4 @@
27902764
window.jSQL = jSQL;
27912765
}
27922766

2793-
})();
2767+
})();

jSQL.min.js

100755100644
Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jsql-official",
33
"version": "2.9.1",
4-
"description": "jSQL is a robust and persistent SQL engine written in Javascript for both Node and browser. See: pamblam.github.io/jSQL for details and usage.",
4+
"description": "A persistent SQL database.",
55
"main": "jSQL.min.js",
66
"directories": {
77
"example": "tests"
@@ -32,5 +32,11 @@
3232
"bugs": {
3333
"url": "https://github.com/Pamblam/jSQL/issues"
3434
},
35-
"homepage": "http://pamblam.github.io/jSQL/"
35+
"homepage": "http://pamblam.github.io/jSQL/",
36+
"devDependencies": {
37+
"grunt": "^1.0.1",
38+
"grunt-contrib-concat": "^1.0.1",
39+
"grunt-contrib-uglify": "^3.1.0",
40+
"grunt-string-replace": "^1.3.1"
41+
}
3642
}

0 commit comments

Comments
 (0)