├── .gitignore ├── waves.js ├── package.json ├── README.md ├── LICENSE └── bin └── scripts.js /.gitignore: -------------------------------------------------------------------------------- 1 | .sass-cache 2 | _site 3 | .DS_Store 4 | npm-debug.log 5 | node_modules 6 | assets -------------------------------------------------------------------------------- /waves.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var waves = { 4 | ui: require('waves-ui'), 5 | audio: require('waves-audio'), 6 | lfo: require('waves-lfo'), 7 | loaders: require('waves-loaders') 8 | }; 9 | 10 | module.exports = waves; 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "waves", 3 | "version": "0.1.3", 4 | "description": "namespaced wrapper for the waves components", 5 | "main": "waves.js", 6 | "standalone": "waves", 7 | "scripts": { 8 | "prebundle": "npm update -d", 9 | "bundle": "node ./bin/scripts.js --bundle", 10 | "postbundle": "npm run uglify", 11 | "uglify": "node ./bin/scripts.js --uglify" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/wavesjs/waves.git" 16 | }, 17 | "license": "BSD-3", 18 | "bugs": { 19 | "url": "https://github.com/wavesjs/waves/issues" 20 | }, 21 | "homepage": "https://github.com/wavesjs/waves", 22 | "dependencies": { 23 | "babel-runtime": "4.7.6", 24 | "waves-audio": "wavesjs/audio", 25 | "waves-lfo": "wavesjs/lfo", 26 | "waves-loaders": "wavesjs/loaders", 27 | "waves-ui": "wavesjs/ui" 28 | }, 29 | "devDependencies": { 30 | "browserify": "^9.0.3", 31 | "fs-extra": "^0.16.3", 32 | "uglify-js": "^2.4.16" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # waves 2 | 3 | WAVES library repository 4 | 5 | ## Documentation 6 | 7 | [https://waves.github.io/](https://wavesjs.github.io/) 8 | 9 | this bundle is basically a wrapper for the `waves-ui`, `waves-audio`, `waves-loader` and `waves-lfo` libraries 10 | 11 | ## Use 12 | 13 | #### CommonJS (browserify) 14 | 15 | install with npm 16 | 17 | ```bash 18 | npm install --save wavesjs/waves 19 | ``` 20 | 21 | consume in your modules 22 | 23 | ```javascript 24 | var waves = require('waves'); 25 | ``` 26 | 27 | #### AMD (requireJS) 28 | 29 | add the waves library to your config 30 | 31 | ```javascript 32 | requirejs.config({ 33 | paths: { 34 | waves: 'path/to/waves.umd' 35 | } 36 | }); 37 | ``` 38 | 39 | consume in your modules 40 | 41 | ```javascript 42 | define(['waves'], function(waves) { 43 | var timeline = waves.ui.timeline(); 44 | 45 | // ... 46 | }); 47 | ``` 48 | 49 | #### Global 50 | 51 | add the script tag in your at the bottom of the `` 52 | 53 | ```html 54 | 55 | ``` 56 | 57 | the library is exposed in `window.waves` 58 | 59 | 60 | ## Custom build 61 | 62 | to create your own custom build, you need to remove/comment all the component you don't need in `waves.js`, then run 63 | 64 | ```bash 65 | npm run bundle 66 | ``` 67 | 68 | ## License 69 | 70 | This module is released under the BSD-3-Clause license. 71 | 72 | Acknowledgments 73 | 74 | This code is part of the WAVE project, funded by ANR (The French National Research Agency). 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, IRCAM (France, Paris) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, this 11 | list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | * Neither the name of the IRCAM nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /bin/scripts.js: -------------------------------------------------------------------------------- 1 | var pkg = require('../package.json'); 2 | var childProcess = require('child_process'); 3 | var util = require('util'); 4 | // devDependencies 5 | var browserify = require('browserify'); 6 | var fse = require('fs-extra'); 7 | // var nodeWatch = require('node-watch'); 8 | var uglifyJS = require('uglify-js'); 9 | 10 | // CONFIG 11 | // ----------------------------------------------- 12 | var srcDir = 'es6'; 13 | var distDir = 'dist'; 14 | 15 | // options for babel 16 | var babelOptions = { 17 | sourceMap: 'inline', 18 | modules: 'common', 19 | optional: ['runtime'] 20 | }; 21 | 22 | // options for browserify 23 | var browserifyOptions = { 24 | standalone: pkg.standalone, 25 | debug: true 26 | }; 27 | 28 | // colors for shell - for a more complete list 29 | // cf. http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux 30 | var red = '\033[0;31m'; 31 | var green = '\033[0;32m'; 32 | var NC = '\033[0m'; // No Color 33 | 34 | // COMMAND INTERPRETER 35 | // ----------------------------------------------- 36 | var command = process.argv[2]; 37 | // execute the correct function given the script 38 | switch (command) { 39 | case '--watch': 40 | watch(); 41 | break; 42 | case '--bundle': 43 | bundle(); 44 | break; 45 | case '--uglify': 46 | uglify(); 47 | break; 48 | case '--transpile': 49 | transpileAll(); 50 | break; 51 | } 52 | 53 | // HELPERS 54 | // ----------------------------------------------- 55 | 56 | // create filename from src to dist 57 | function createTargetName(filename) { 58 | // replace source dir with target dir and '.es6.js' to '.js' 59 | return filename.replace(new RegExp('^' + srcDir), distDir).replace('.es6.js', '.js'); 60 | } 61 | 62 | // create filename from `pck.main` to `umd` version 63 | function getUmdName() { 64 | return pkg.main.replace('.js', '.umd.js'); 65 | } 66 | 67 | // create filename from `umd` to `min` version 68 | function getMinName() { 69 | return getUmdName().replace('.umd.js', '.min.js'); 70 | } 71 | 72 | // SCRIPTS 73 | // ----------------------------------------------- 74 | 75 | // watch source dir 76 | // function watch() { 77 | // nodeWatch(srcDir, function(filename) { 78 | // transpile(filename); 79 | // }); 80 | // } 81 | 82 | // create the `.umd.js` version 83 | function bundle() { 84 | var src = './' + pkg.main; 85 | var target = getUmdName(); 86 | var b = browserify(src, browserifyOptions); 87 | 88 | try { 89 | b.bundle().pipe(fse.createWriteStream(target)); 90 | // is not called at the right place - streams are async 91 | console.log(util.format(green + '=> "%s" successfully created' + NC, target)); 92 | } catch(e) { 93 | return console.log(err.message); 94 | } 95 | 96 | } 97 | 98 | // create the `.min.js` version 99 | function uglify() { 100 | var src = getUmdName(); 101 | var target = getMinName(); 102 | var res = uglifyJS.minify(src); 103 | 104 | fse.outputFile(target, res.code, function(err, res) { 105 | if (err) { return console.log(err.message); } 106 | 107 | console.log(util.format(green + '=> "%s" successfully created' + NC, target)); 108 | // reminder 109 | console.log(util.format(red + '==> THINK ABOUT UPDATING VERSION [npm --help version] <==' + NC)); 110 | }); 111 | } 112 | 113 | // transpile all files in `srcDir` 114 | // function transpileAll() { 115 | // var cmd = 'find '+ srcDir +' -type f'; 116 | 117 | // childProcess.exec(cmd , function(err, stdout, stderr) { 118 | // var fileList = stdout.split('\n'); 119 | 120 | // fileList.forEach(function(file) { 121 | // if (!file) { return; } 122 | // transpile(file); 123 | // }); 124 | // }); 125 | // } 126 | 127 | // // transpile one file 128 | // function transpile(src) { 129 | // var target = createTargetName(src); 130 | 131 | // babel.transformFile(src, babelOptions, function(err, res) { 132 | // if (err) { return console.log(err.message); } 133 | 134 | // fse.outputFile(target, res.code, function(err, res) { 135 | // if (err) { return console.log(err.message); } 136 | 137 | // console.log(util.format(green + '=> "%s" successfully transpiled to "%s"' + NC, src, target)); 138 | // }); 139 | // }); 140 | // } 141 | --------------------------------------------------------------------------------