Updated build structure

This commit is contained in:
Kristofer
2018-01-01 14:27:20 +01:00
parent 54457e8d7b
commit 1f7659ab1a
4 changed files with 22 additions and 143 deletions

View File

@@ -1,103 +0,0 @@
# litegraph.js
A library in Javascript to create graphs in the browser similar to [PureData](https://puredata.info/). Nodes can be programmed easily and it includes an editor to construct the graphs.
It can be integrated easily in any existing web applications and graphs can be run without the need of the editor.
![Node Graph](imgs/node_graph_example.PNG "WebGLStudio")
## Installation
```
npm install litegraph.js
```
## First project ##
```html
<html>
<head>
<script type="text/javascript" src="/litegraph.js"></script>
</head>
<body style='width:100%; height:100%'>
<canvas id='mycanvas' width='1024' height='720' style='border: 1px solid'></canvas>
<script>
var graph = new LGraph();
var canvas = new LGraphCanvas("#mycanvas", graph);
var node_const = LiteGraph.createNode("basic/const");
node_const.pos = [200,200];
graph.add(node_const);
node_const.setValue(4.5);
var node_watch = LiteGraph.createNode("basic/watch");
node_watch.pos = [700,200];
graph.add(node_watch);
node_const.connect(0, node_watch, 0 );
graph.start()
</script>
</body>
</html>
```
## How to code a new Node type
Here is an example of how to build a node that sums two inputs:
```javascript
//node constructor class
function MyAddNode()
{
this.addInput("A","number");
this.addInput("B","number");
this.addOutput("A+B","number");
}
//name to show
MyAddNode.title = "Sum";
//function to call when the node is executed
MyAddNode.prototype.onExecute = function()
{
var A = this.getInputData(0);
if( A === undefined )
A = 0;
var B = this.getInputData(1);
if( B === undefined )
B = 0;
this.setOutputData( 0, A + B );
}
//register in the system
LiteGraph.registerNodeType("basic/sum", MyAddNode );
```
## Projects using it
### [webglstudio.org](http://webglstudio.org)
![WebGLStudio](imgs/webglstudio.gif "WebGLStudio")
### [MOI Elephant](http://moiscript.weebly.com/elephant-systegraveme-nodal.html)
![MOI Elephant](imgs/elephant.gif "MOI Elephant")
### [Mynodes.NET](http://www.mynodes.net)
![MyNodes.NET](imgs/mynodes.png "MyNodes.NET")
## Utils
-----
It includes several commands in the utils folder to generate doc, check errors and build minifyed version.
## Feedback
--------
You can write any feedback to javi.agenjo@gmail.com

View File

@@ -1,9 +0,0 @@
{
"version": "0.2.1",
"name": "litegraph.js",
"main": "litegraph.js",
"description": "A graph node editor similar to PD or UDK Blueprints, it works in a HTML5 Canvas and allow to exported graphs to be included in applications.",
"author": "jagenjo",
"license": "MIT",
"scripts": {}
}

View File

@@ -20,19 +20,6 @@ module.exports = function (grunt) {
dest: 'build/litegraph.js'
}
},
copy: {
parts: {
files: [
{
expand: true,
flatten: true,
cwd: '',
src: ['README.md'],
dest: 'build/'
}
]
}
},
clean: {
build: {src: ['build/*']}
},
@@ -55,28 +42,28 @@ module.exports = function (grunt) {
}
})
grunt.registerTask('buildPackage', function () {
var pkg = grunt.config.data.pkg
var newPackage = {
version: pkg.version,
name: 'litegraph.js', //* Static name without ogranisation
main: 'litegraph.js',
description: pkg.description,
dependencies: pkg.dependencies,
author: pkg.author,
license: 'MIT',
scripts: {
// grunt.registerTask('buildPackage', function () {
// var pkg = grunt.config.data.pkg
// var newPackage = {
// version: pkg.version,
// name: 'litegraph.js', //* Static name without ogranisation
// main: 'litegraph.js',
// description: pkg.description,
// dependencies: pkg.dependencies,
// author: pkg.author,
// license: 'MIT',
// scripts: {
}
}
// }
// }
grunt.file.write('build/package.json', JSON.stringify(newPackage, undefined, 2))
})
// grunt.file.write('build/package.json', JSON.stringify(newPackage, undefined, 2))
// })
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-closure-tools')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.registerTask('build', ['buildPackage', 'copy:parts', 'concat:build', 'closureCompiler'])
grunt.registerTask('build', ['concat:build', 'closureCompiler'])
}

View File

@@ -1,6 +1,6 @@
{
"name": "@skymaker/litegraph.js",
"version": "0.2.1",
"name": "litegraph.js",
"version": "0.3.0-0",
"description": "A graph node editor similar to PD or UDK Blueprints, it works in a HTML5 Canvas and allow to exported graphs to be included in applications.",
"main": "build/litegraph.js",
"directories": {
@@ -18,6 +18,10 @@
},
"author": "jagenjo",
"license": "MIT",
"files": [
"build",
"css"
],
"bugs": {
"url": "https://github.com/jagenjo/litegraph.js/issues"
},