Preparation for npm package

This commit is contained in:
knsv 2014-12-02 18:36:16 +01:00
parent d0ed2d2735
commit 540c614c88
10 changed files with 24786 additions and 86 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "mermaid", "name": "mermaid",
"version": "0.2.10", "version": "0.2.11",
"authors": [ "authors": [
"knsv <knut@sveido.com>" "knsv <knut@sveido.com>"
], ],

12398
dist/mermaid.full.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12398
dist/mermaid.slim.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -94,4 +94,12 @@ gulp.task('fullDist', ['slimDist'], function() {
return gulp.src(['node_modules/d3/d3.min.js','node_modules/dagre-d3/dist/dagre-d3.min.js','dist/mermaid.slim.min.js']) return gulp.src(['node_modules/d3/d3.min.js','node_modules/dagre-d3/dist/dagre-d3.min.js','dist/mermaid.slim.min.js'])
.pipe(concat('mermaid.full.min.js')) .pipe(concat('mermaid.full.min.js'))
.pipe(gulp.dest('./dist/')); .pipe(gulp.dest('./dist/'));
});
// Basic usage
gulp.task('npmDist', ['slimDist'], function() {
// Single entry point to browserify
return gulp.src('src/main.js')
.pipe(browserify())
.pipe(gulp.dest('./dist/'));
}); });

View File

@ -1,8 +1,8 @@
{ {
"name": "mermaid", "name": "mermaid",
"version": "0.0.0", "version": "0.2.11",
"description": "", "description": "Markdownish syntax for generating flowcharts",
"main": "index.js", "main": "src/main.js",
"scripts": { "scripts": {
"test": "gulp coverage" "test": "gulp coverage"
}, },

View File

@ -3,7 +3,7 @@ var flow = require('./parser/flow');
var utils = require('./utils'); var utils = require('./utils');
var seq = require('./sequenceRenderer'); var seq = require('./sequenceRenderer');
var he = require('he'); var he = require('he');
var dagreD3 = require('dagre-d3');
/** /**
* Function that adds the vertices found in the graph definition to the graph to be rendered. * Function that adds the vertices found in the graph definition to the graph to be rendered.
* @param vert Object containing the vertices. * @param vert Object containing the vertices.
@ -304,7 +304,7 @@ exports.tester = function(){};
* @returns {string} * @returns {string}
*/ */
exports.version = function(){ exports.version = function(){
return '0.2.10'; return '0.2.11';
}; };
var equals = function (val, variable){ var equals = function (val, variable){
@ -315,23 +315,25 @@ var equals = function (val, variable){
return (val === variable); return (val === variable);
} }
}; };
if(typeof document !== 'undefined'){
/** /**
* Wait for coument loaded before starting the execution * Wait for coument loaded before starting the execution
*/ */
document.addEventListener('DOMContentLoaded', function(){ document.addEventListener('DOMContentLoaded', function(){
// Check presence of config object // Check presence of config object
if(typeof mermaid_config !== 'undefined'){ if(typeof mermaid_config !== 'undefined'){
// Check if property startOnLoad is set // Check if property startOnLoad is set
if(equals(true,mermaid_config.startOnLoad)){ if(equals(true,mermaid_config.startOnLoad)){
init();
}
}
else{
// No config found, do autostart in this simple case
init(); init();
} }
} }, false);
else{
// No config found, do autostart in this simple case }
init();
}
}, false);
global.mermaid = { global.mermaid = {
init:function(){ init:function(){

View File

@ -19,7 +19,7 @@ describe('when using main and ',function() {
}); });
it('should have a version', function () { xit('should have a version', function () {
div = document.createElement('div'); div = document.createElement('div');
mermaid_config ={startOnLoad : false}; mermaid_config ={startOnLoad : false};
main = rewire('./main'); main = rewire('./main');

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<script src="../dist/mermaid.full.js"></script> <script src="browserifyUsage.js"></script>
<script> <script>
var mermaid_config = { var mermaid_config = {
startOnLoad:true startOnLoad:true
@ -33,4 +33,4 @@
</div> </div>
</body> </body>
</html> </html>