Comparing version 0.12.1 to 0.12.2
# Changelog | ||
**0.12.2** - April 17, 2013 | ||
* udpates for version 0.2.0 of [buddy-dependencies](https://github.com/popeindustries/buddy-dependencies) | ||
**0.12.1** - April 15, 2013 | ||
@@ -4,0 +7,0 @@ * fix dependency resolution for css `@import` calls |
@@ -52,3 +52,3 @@ var fs = require('fs') | ||
print('installing dependencies...', 2); | ||
dependencies.install(self.config.dependencies, function(err, files) { | ||
dependencies.install(self.config.dependencies, term, function(err, files) { | ||
// Persist file references created on install | ||
@@ -55,0 +55,0 @@ if (files) filelog.add(files); |
@@ -1,2 +0,2 @@ | ||
// TODO: lint, built header? | ||
// TODO: built header? | ||
@@ -3,0 +3,0 @@ var path = require('path') |
{ | ||
"name": "buddy", | ||
"description": "A build tool for js/css/html projects.", | ||
"version": "0.12.1", | ||
"version": "0.12.2", | ||
"author": "popeindustries <alex@pope-industries.com>", | ||
@@ -45,4 +45,4 @@ "keywords": ["build", "buildtool", "modules", "javascript", "coffeescript", "css", "styus", "less", "livescript", "handlebars", "jade"], | ||
"readmeFilename": "README.md", | ||
"readme": "[![Build Status](https://travis-ci.org/popeindustries/buddy.png)](https://travis-ci.org/popeindustries/buddy)\n\n# buddy(1)\n\n**buddy(1)** is a build tool for js/css/html projects. It helps you manage third-party dependencies (optional add-on), compiles source code from higher order js/css/html languages (CoffeeScript/LiveScript/Handlebars/Stylus/Less/Jade), automatically wraps js files in module definitions, statically resolves module dependencies, and concatenates (and optionally compresses) all souces into a single file for more efficient delivery to the browser.\n\n**Current version:** 0.12.1 *[See [Change Log](https://github.com/popeindustries/buddy/blob/master/CHANGELOG.md) for more details]*\n\n## Features\n\n- Allows you to write js __modules__ without the module boilerplate (similar to Node.js)\n- Resolves js module __dependencies__ automatically\n- Supports efficient ___lazy___ runtime evaluation by storing js modules as strings\n- Resolves all relative dependencies on __deploy__\n- __Compiles__ _CoffeeScript_, _LiveScript_, _Handlebars_, _Stylus_, _Less_, and _Jade_ source files\n- __Concatenates__ js modules into a single file\n- Runs js and css code through __linters__ to check for syntax errors\n- __Watches__ for source changes and builds automatically\n- __Serves__ static files from specified directory on specified port\n- __Refreshes__ connected browsers after each change\n- __Inlines__ css `@imports` automatically\n- Supports execution of a ___test___ script after each build\n- [Add-on] Copies __libraries__ from GitHub to your project\n- [Add-on] Copies __assets__ from a local destination to your project\n\n## Installation\n\nTo avoid running **buddy(1)** directly as a global command, and thus avoid versioning problems across different projects, it is highly recommended that you instead install the separate [buddy-cli](https://github.com/popeindustries/buddy-cli) command line interface system-wide:\n\n```bash\n$ npm -g install buddy-cli\n```\n\n...then create a *package.json* file for each project, locally installing **buddy** as a devDependency:\n\n```json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n }\n}\n```\n```bash\n$ cd path/to/project\n$ npm install\n```\n\n## Usage\n\n```text\nUsage: buddy [options] <command> [path/to/package.json or path/to/buddy.js or path/to/buddy.json]>\n\nCommands:\n\n init set up a basic buddy project\n install [config] install dependencies\n build [config] build js and css sources\n watch [config] watch js and css source files and build changes\n deploy [config] build compressed js and css sources\n ls list all previously created files and directories\n clean remove all previously created files and directories\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -c, --compress compress output for production deployment\n -l, --lint check output for syntax and logic errors\n -r, --reload reload all connected live-reload clients on file change during watch\n -s, --serve create a webserver to serve static files during watch\n -t, --test run test command on build completion\n -L, --lazy convert js modules for lazy evaluation\n -v, --verbose print all messages for debugging\n```\n\n### Examples\n\nGenerate `www/main.js` by concatenating and modularizing all dependencies in `src` or `libs/js` referenced in `src/main.js`:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nGenerate `www/main.js` with references to dependencies installed via npm:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n \"underscore\": \"1.4.4\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nFirst compile all CoffeeScript files in `libs/src/coffee`, then generate `www/main.js` by concatenating and modularizing all dependencies referenced in 'src/main.js':\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\", \"libs/src/coffee\"],\n \"targets\": [\n {\n \"input\": \"libs/src/coffee\",\n \"output\": \"libs/js\"\n },\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nGenerate `www/main.js` and an additional widget `www/widget.js` using shared sources (avoid duplicating dependencies):\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\",\n \"targets\": [\n {\n \"input\": \"src/widget.js\",\n \"output\": \"www/widget.js\"\n }\n ]\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nCompile a CoffeeScript project for Node.js, skipping module wrapping and concatenation:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my server project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src/coffee\"],\n \"targets\": [\n {\n \"input\": \"src/coffee\",\n \"output\": \"js\",\n \"modular\": false\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nCopy project boilerplate from a local directory into the project root:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\",\n \"buddy-dependencies\": \"0.1.4\"\n },\n \"buddy\": {\n \"dependencies\": {\n \".\": {\n \"sources\": [\"../../boilerplate/project\"]\n }\n }\n }\n```\n```bash\n$ buddy install\n```\n\nDownload js dependencies `browser-require` and `jQuery`, then concatenate and compress to `www/libs.js` for inclusion in html:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\",\n \"buddy-dependencies\": \"0.1.4\"\n },\n \"buddy\": {\n \"dependencies\": {\n \"libs/vendor\": {\n \"sources\": [\n \"popeindustries/browser-require\",\n \"jquery@1.9.1\"\n ],\n \"output\": \"www/libs.js\"\n }\n }\n }\n```\n```bash\n$ buddy install\n```\n\nDownload `visionmedia/nib` Stylus sources, specifying a specific directory to be referenced in your builds:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\",\n \"buddy-dependencies\": \"0.1.4\"\n },\n \"buddy\": {\n \"dependencies\": {\n \"libs/src/css\": {\n \"sources\": [\n \"visionmedia/nib#lib/nib\"\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy install\n```\n\nStart a basic web server and refresh the browser (using the Live-Reload browser plugin) after each build triggered by source file changes:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"settings\": {\n \"server\": {\n \"directory\": \"www\",\n \"port\": 8080\n }\n }\n }\n}\n```\n```bash\n$ buddy watch -rs\n```\n\n### Configuration\n\nComplete annotated `buddy.js` configuration file:\n\n```js\n// Project build configuration.\nexports.build = {\n js: {\n // Directories containing potential js source files for this project ('node_modules' are added by default).\n sources: ['a/coffeescript/source/directory', 'a/js/source/directory'],\n // One or more js build targets.\n targets: [\n {\n // An entrypoint js (or equivalent) file to be wrapped in a module definition,\n // concatenated with all it's resolved dependencies.\n input: 'a/coffeescript/or/js/file',\n // A destination in which to save the processed input.\n // If a directory is specified, the input file name will be used.\n output: 'a/js/file/or/directory',\n // An alternate destination in which to save the compressed output.\n output_compressed: 'a/js/file/or/directory',\n // Targets can have children.\n // Any sources included in the parent target will NOT be included in the child.\n targets: [\n {\n input: 'a/coffeescript/or/js/file',\n output: 'a/js/file/or/directory'\n }\n ]\n },\n {\n // Files are batch processed when a directory is used as input.\n input: 'a/coffeescript/or/js/directory',\n output: 'a/js/directory',\n // Skips module wrapping (ex: for use in server environments).\n modular: false\n }\n ]\n },\n css: {\n // Directories containing potential css source files for this project.\n sources: ['a/stylus/directory', 'a/less/directory', 'a/css/directory'],\n // One or more css build targets\n targets: [\n {\n // An entrypoint css (or equivalent) file to be processed,\n // concatenated with all it's resolved dependencies.\n input: 'a/stylus/less/or/css/file',\n // A destination in which to save the processed input.\n // If a directory is specified, the input file name will be used.\n output: 'a/css/file/or/directory'\n },\n {\n // Files are batch processed when a directory is used as input,\n // though @import'ed dependencies are still resolved and inlined.\n input: 'a/stylus/less/or/css/directory',\n output: 'a/css/directory'\n }\n ]\n }\n}\n\n// Project dependency configuration.\nexports.dependencies = {\n // A destination directory in which to place third-party library dependencies.\n 'a/vendor/directory': {\n // An ordered list of dependencies\n sources: [\n // A github user/repo.\n // Install the 'browser-require' source when using Node-style modules.\n 'popeindustries/browser-require',\n // A named library with or without version (ex: jquery@latest, backbone, backbone@1.0.0).\n // Version identifiers follow the npm semantic versioning rules.\n 'library@version'\n ],\n // Dependencies can be packaged and minified to a destination file\n output: 'a/js/file'\n },\n // A destination directory in which to place source library dependencies.\n 'a/source/directory': {\n sources: [\n // A github user/repo.\n // Will use the 'main' properties of\n // components.json or package.json to identify the file to install.\n 'username/repo',\n // A github user/repo with specific file or directory locations.\n 'username/repo#a/file/or/directory|another/file/or/directory',\n // A local file or directory to copy and install.\n '../a/file/or/directory'\n ]\n }\n}\n\n// Project settings configuration.\nexports.settings = {\n // Run a command after build\n test: 'command --flags',\n // Configure webserver\n server: {\n // Defaults to project root\n directory: 'a/project/directory',\n // Defaults to 8080\n port: 8000\n }\n}\n```\n\n## Concepts\n\n### BUILD\n\n**Project Root**: The directory from which all paths resolve to. Determined by location of the configuration file.\n\n**Sources**: An array of directories from which all referenced files are retrieved from. ***Note:*** A *js* module's id is derived from it's relative path to it's source directory.\n\n**Targets**: Objects that specify the *input* and *output* files or directories for each build. Targets are built in sequence, allowing builds to be chained together. ***Note:*** A *js* target can also have nested child targets, ensuring that dependencies are not duplicated across related builds.\n\n**Target parameters**:\n\n- *input*: file or directory to build. If js (or equivalent) file, all dependencies referenced will be concatenated together for output.\nIf directory, all compileable files will be compiled, wrapped in module definitions (js), and output to individual js/css files.\n\n- *output*: file or directory to output to.\n\n- *targets*: a nested target that prevents the duplication of source code with it's parent target.\n\n- *modular*: a flag to prevent js files from being wrapped with a module definition.\n\n- *output_compressed*: an alternate file or directory to use for compressed output.\n\n### MODULES\n\nEach js file is wrapped in a module declaration based on the file's location. Dependencies are determined by the use of ```require()``` statements:\n\n```javascript\nvar lib = require('./my/lib'); // in current package\nvar SomeClass = require('../someclass'); // in parent package\nvar util = require('utils/util'); // from root package\n\nlib.doSomething();\nvar something = new SomeClass();\nutil.log('hey');\n```\n\nSpecifying a module's public behaviour is achieved by decorating an ```exports``` object:\n\n```javascript\nvar myModuleVar = 'my module';\n\nexports.myModuleMethod = function() {\n return myModuleVar;\n};\n```\n\n...or overwriting the ```exports``` object completely:\n\n```javascript\nfunction MyModule() {\n this.myVar = 'my instance var';\n};\n\nMyModule.prototype.myMethod = function() {\n return this.myVar;\n};\n\nmodule.exports = MyModule;\n```\n\nEach module is provided with a ```module```, ```exports```, and ```require``` reference.\n\nWhen ```require()```-ing a module, keep in mind that the module id is resolved based on the following rules:\n\n * packages begin at the root folder specified in *build > js > sources*:\n```\n'Users/alex/project/src/package/main.js' > 'package/main'\n```\n * uppercase filenames are converted to lowercase module ids:\n```\n'my/package/Class.js' > 'my/package/class'\n```\n\nSee [node.js modules](http://nodejs.org/api/modules.html) for more info on modules.\n\n***NOTE***: ```require``` boilerplate needs to be included in the browser to enable module loading. It's recommended to ```install``` a library like *popeindustries/browser-require* (npm: simple-browser-require).\n\n### DEPENDENCIES\n\nDependency resources are installed from local locations or remotely from Github.\n\n**Sources**: An array of local or remote resource locations.\n\n- **destination**: each group of sources will be installed to the project relative location specified.\n\n- **identifier**: github ```username/repo``` identifiers are preferred, but it is also possible to use identifiers from the [bower](https://github.com/twitter/bower) package manager: ```'jquery', 'backbone', 'underscore'```, etc.\n\n- **versioning**: github sources can specify a version by appending ```@``` and a npm-style symantic version: ```'*', '1.2.3', '1.x', '~1.2.0', '>=1.2.3'```\n\n- **resources**: specific resources can be specified by appending ```#``` and a list of ```|``` separated relative file or directory locations: ```'username/repo#a/file/or/directory|another/file/or/directory'```\n\n**Output**: A file destination to concatenate and compress the source contents. The order of *sources* determines the content order.\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Pope-Industries <alex@pope-industries.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", | ||
"readme": "[![Build Status](https://travis-ci.org/popeindustries/buddy.png)](https://travis-ci.org/popeindustries/buddy)\n\n# buddy(1)\n\n**buddy(1)** is a build tool for js/css/html projects. It helps you manage third-party dependencies (optional add-on), compiles source code from higher order js/css/html languages (CoffeeScript/LiveScript/Handlebars/Stylus/Less/Jade), automatically wraps js files in module definitions, statically resolves module dependencies, and concatenates (and optionally compresses) all souces into a single file for more efficient delivery to the browser.\n\n**Current version:** 0.12.2 *[See [Change Log](https://github.com/popeindustries/buddy/blob/master/CHANGELOG.md) for more details]*\n\n## Features\n\n- Allows you to write js __modules__ without the module boilerplate (similar to Node.js)\n- Resolves js module __dependencies__ automatically\n- Supports efficient ___lazy___ runtime evaluation by storing js modules as strings\n- Resolves all relative dependencies on __deploy__\n- __Compiles__ _CoffeeScript_, _LiveScript_, _Handlebars_, _Stylus_, _Less_, and _Jade_ source files\n- __Concatenates__ js modules into a single file\n- Runs js and css code through __linters__ to check for syntax errors\n- __Watches__ for source changes and builds automatically\n- __Serves__ static files from specified directory on specified port\n- __Refreshes__ connected browsers after each change\n- __Inlines__ css `@imports` automatically\n- Supports execution of a ___test___ script after each build\n- [Add-on] Copies __packages__ from GitHub to your project\n- [Add-on] Copies __assets__ from a local destination to your project\n\n## Installation\n\nTo avoid running **buddy(1)** directly as a global command, and thus avoid versioning problems across different projects, it is highly recommended that you instead install the separate [buddy-cli](https://github.com/popeindustries/buddy-cli) command line interface system-wide:\n\n```bash\n$ npm -g install buddy-cli\n```\n\n...then create a *package.json* file for each project, locally installing **buddy** as a devDependency:\n\n```json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n }\n}\n```\n```bash\n$ cd path/to/project\n$ npm install\n```\n\n## Usage\n\n```text\nUsage: buddy [options] <command> [path/to/package.json or path/to/buddy.js or path/to/buddy.json]>\n\nCommands:\n\n init set up a basic buddy project\n install [config] install dependencies\n build [config] build js and css sources\n watch [config] watch js and css source files and build changes\n deploy [config] build compressed js and css sources\n ls list all previously created files and directories\n clean remove all previously created files and directories\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -c, --compress compress output for production deployment\n -l, --lint check output for syntax and logic errors\n -r, --reload reload all connected live-reload clients on file change during watch\n -s, --serve create a webserver to serve static files during watch\n -t, --test run test command on build completion\n -L, --lazy convert js modules for lazy evaluation\n -v, --verbose print all messages for debugging\n```\n\n### Examples\n\n*See [buddy-dependencies](https://github.com/popeindustries/buddy-dependencies) for `install` command examples.*\n\nGenerate `www/main.js` by concatenating and modularizing all dependencies in `src` or `libs/js` referenced in `src/main.js`:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nGenerate `www/main.js` with references to dependencies installed via npm:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n \"underscore\": \"1.4.4\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nFirst compile all CoffeeScript files in `libs/src/coffee`, then generate `www/main.js` by concatenating and modularizing all dependencies referenced in 'src/main.js':\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\", \"libs/src/coffee\"],\n \"targets\": [\n {\n \"input\": \"libs/src/coffee\",\n \"output\": \"libs/js\"\n },\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\"\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nGenerate `www/main.js` and an additional widget `www/widget.js` using shared sources (avoid duplicating dependencies):\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"simple-browser-require\": \"*\"\n },\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src\", \"libs/js\"],\n \"targets\": [\n {\n \"input\": \"src/main.js\",\n \"output\": \"www/main.js\",\n \"targets\": [\n {\n \"input\": \"src/widget.js\",\n \"output\": \"www/widget.js\"\n }\n ]\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nCompile a CoffeeScript project for Node.js, skipping module wrapping and concatenation:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my server project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"build\": {\n \"js\": {\n \"sources\": [\"src/coffee\"],\n \"targets\": [\n {\n \"input\": \"src/coffee\",\n \"output\": \"js\",\n \"modular\": false\n }\n ]\n }\n }\n }\n}\n```\n```bash\n$ buddy build\n```\n\nStart a basic web server and refresh the browser (using the Live-Reload browser plugin) after each build triggered by source file changes:\n\n```json\npackage.json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.1.0\",\n \"devDependencies\": {\n \"buddy\": \"0.12.0\"\n },\n \"buddy\": {\n \"settings\": {\n \"server\": {\n \"directory\": \"www\",\n \"port\": 8080\n }\n }\n }\n}\n```\n```bash\n$ buddy watch -rs\n```\n\n### Configuration\n\nComplete annotated `buddy.js` configuration file:\n\n```js\n// Project build configuration.\nexports.build = {\n js: {\n // Directories containing potential js source files for this project ('node_modules' are added by default).\n sources: ['a/coffeescript/source/directory', 'a/js/source/directory'],\n // One or more js build targets.\n targets: [\n {\n // An entrypoint js (or equivalent) file to be wrapped in a module definition,\n // concatenated with all it's resolved dependencies.\n input: 'a/coffeescript/or/js/file',\n // A destination in which to save the processed input.\n // If a directory is specified, the input file name will be used.\n output: 'a/js/file/or/directory',\n // An alternate destination in which to save the compressed output.\n output_compressed: 'a/js/file/or/directory',\n // Targets can have children.\n // Any sources included in the parent target will NOT be included in the child.\n targets: [\n {\n input: 'a/coffeescript/or/js/file',\n output: 'a/js/file/or/directory'\n }\n ]\n },\n {\n // Files are batch processed when a directory is used as input.\n input: 'a/coffeescript/or/js/directory',\n output: 'a/js/directory',\n // Skips module wrapping (ex: for use in server environments).\n modular: false\n }\n ]\n },\n css: {\n // Directories containing potential css source files for this project.\n sources: ['a/stylus/directory', 'a/less/directory', 'a/css/directory'],\n // One or more css build targets\n targets: [\n {\n // An entrypoint css (or equivalent) file to be processed,\n // concatenated with all it's resolved dependencies.\n input: 'a/stylus/less/or/css/file',\n // A destination in which to save the processed input.\n // If a directory is specified, the input file name will be used.\n output: 'a/css/file/or/directory'\n },\n {\n // Files are batch processed when a directory is used as input,\n // though @import'ed dependencies are still resolved and inlined.\n input: 'a/stylus/less/or/css/directory',\n output: 'a/css/directory'\n }\n ]\n }\n}\n\n// Project dependency configuration.\nexports.dependencies = {\n // A destination directory in which to place third-party library dependencies.\n // Alternatively, a destination file for packaging/minification\n 'a/vendor/directory': {\n // An ordered list of dependencies\n sources: [\n // A github user/repo.\n // Install the 'browser-require' source when using Node-style modules.\n 'popeindustries/browser-require',\n // A named library with or without version (ex: jquery@latest, backbone, backbone@1.0.0).\n // Version identifiers follow the npm semantic versioning rules.\n 'library@version'\n ],\n // Dependencies can be packaged and minified to a destination file\n output: 'a/js/file'\n },\n // A destination directory in which to place source library dependencies.\n 'a/source/directory': {\n sources: [\n // A github user/repo.\n // Will use the 'main' properties of\n // components.json or package.json to identify the file to install.\n 'username/repo',\n // A github user/repo with specific file or directory locations.\n 'username/repo#a/file/or/directory|another/file/or/directory',\n // A local file or directory to copy and install.\n '../a/file/or/directory'\n ]\n }\n}\n\n// Project settings configuration.\nexports.settings = {\n // Run a command after build\n test: 'command --flags',\n // Configure webserver\n server: {\n // Defaults to project root\n directory: 'a/project/directory',\n // Defaults to 8080\n port: 8000\n }\n}\n```\n\n## Concepts\n\n### BUILD\n\n**Project Root**: The directory from which all paths resolve to. Determined by location of the configuration file.\n\n**Sources**: An array of directories from which all referenced files are retrieved from. ***Note:*** A *js* module's id is derived from it's relative path to it's source directory.\n\n**Targets**: Objects that specify the *input* and *output* files or directories for each build. Targets are built in sequence, allowing builds to be chained together. ***Note:*** A *js* target can also have nested child targets, ensuring that dependencies are not duplicated across related builds.\n\n**Target parameters**:\n\n- *input*: file or directory to build. If js (or equivalent) file, all dependencies referenced will be concatenated together for output.\nIf directory, all compileable files will be compiled, wrapped in module definitions (js), and output to individual js/css files.\n\n- *output*: file or directory to output to.\n\n- *targets*: a nested target that prevents the duplication of source code with it's parent target.\n\n- *modular*: a flag to prevent js files from being wrapped with a module definition.\n\n- *output_compressed*: an alternate file or directory to use for compressed output.\n\n### MODULES\n\nEach js file is wrapped in a module declaration based on the file's location. Dependencies are determined by the use of ```require()``` statements:\n\n```javascript\nvar lib = require('./my/lib'); // in current package\nvar SomeClass = require('../someclass'); // in parent package\nvar util = require('utils/util'); // from root package\n\nlib.doSomething();\nvar something = new SomeClass();\nutil.log('hey');\n```\n\nSpecifying a module's public behaviour is achieved by decorating an ```exports``` object:\n\n```javascript\nvar myModuleVar = 'my module';\n\nexports.myModuleMethod = function() {\n return myModuleVar;\n};\n```\n\n...or overwriting the ```exports``` object completely:\n\n```javascript\nfunction MyModule() {\n this.myVar = 'my instance var';\n};\n\nMyModule.prototype.myMethod = function() {\n return this.myVar;\n};\n\nmodule.exports = MyModule;\n```\n\nEach module is provided with a ```module```, ```exports```, and ```require``` reference.\n\nWhen ```require()```-ing a module, keep in mind that the module id is resolved based on the following rules:\n\n * packages begin at the root folder specified in *build > js > sources*:\n```\n'Users/alex/project/src/package/main.js' > 'package/main'\n```\n * uppercase filenames are converted to lowercase module ids:\n```\n'my/package/Class.js' > 'my/package/class'\n```\n\nSee [node.js modules](http://nodejs.org/api/modules.html) for more info on modules.\n\n***NOTE***: ```require``` boilerplate needs to be included in the browser to enable module loading. It's recommended to ```install``` a library like *popeindustries/browser-require* (npm: simple-browser-require).\n\n### DEPENDENCIES\n\n*See [buddy-dependencies](https://github.com/popeindustries/buddy-dependencies).*\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011-2013 Pope-Industries <alex@pope-industries.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", | ||
"license": "MIT" | ||
} |
100
README.md
@@ -23,3 +23,3 @@ [![Build Status](https://travis-ci.org/popeindustries/buddy.png)](https://travis-ci.org/popeindustries/buddy) | ||
- Supports execution of a ___test___ script after each build | ||
- [Add-on] Copies __libraries__ from GitHub to your project | ||
- [Add-on] Copies __packages__ from GitHub to your project | ||
- [Add-on] Copies __assets__ from a local destination to your project | ||
@@ -82,2 +82,4 @@ | ||
*See [buddy-dependencies](https://github.com/popeindustries/buddy-dependencies) for `install` command examples.* | ||
Generate `www/main.js` by concatenating and modularizing all dependencies in `src` or `libs/js` referenced in `src/main.js`: | ||
@@ -257,81 +259,2 @@ | ||
Copy project boilerplate from a local directory into the project root: | ||
```json | ||
package.json | ||
{ | ||
"name": "myproject", | ||
"description": "This is my web project", | ||
"version": "0.1.0", | ||
"devDependencies": { | ||
"buddy": "0.12.0", | ||
"buddy-dependencies": "0.1.4" | ||
}, | ||
"buddy": { | ||
"dependencies": { | ||
".": { | ||
"sources": ["../../boilerplate/project"] | ||
} | ||
} | ||
} | ||
``` | ||
```bash | ||
$ buddy install | ||
``` | ||
Download js dependencies `browser-require` and `jQuery`, then concatenate and compress to `www/libs.js` for inclusion in html: | ||
```json | ||
package.json | ||
{ | ||
"name": "myproject", | ||
"description": "This is my web project", | ||
"version": "0.1.0", | ||
"devDependencies": { | ||
"buddy": "0.12.0", | ||
"buddy-dependencies": "0.1.4" | ||
}, | ||
"buddy": { | ||
"dependencies": { | ||
"libs/vendor": { | ||
"sources": [ | ||
"popeindustries/browser-require", | ||
"jquery@1.9.1" | ||
], | ||
"output": "www/libs.js" | ||
} | ||
} | ||
} | ||
``` | ||
```bash | ||
$ buddy install | ||
``` | ||
Download `visionmedia/nib` Stylus sources, specifying a specific directory to be referenced in your builds: | ||
```json | ||
package.json | ||
{ | ||
"name": "myproject", | ||
"description": "This is my web project", | ||
"version": "0.1.0", | ||
"devDependencies": { | ||
"buddy": "0.12.0", | ||
"buddy-dependencies": "0.1.4" | ||
}, | ||
"buddy": { | ||
"dependencies": { | ||
"libs/src/css": { | ||
"sources": [ | ||
"visionmedia/nib#lib/nib" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
```bash | ||
$ buddy install | ||
``` | ||
Start a basic web server and refresh the browser (using the Live-Reload browser plugin) after each build triggered by source file changes: | ||
@@ -427,2 +350,3 @@ | ||
// A destination directory in which to place third-party library dependencies. | ||
// Alternatively, a destination file for packaging/minification | ||
'a/vendor/directory': { | ||
@@ -550,16 +474,4 @@ // An ordered list of dependencies | ||
Dependency resources are installed from local locations or remotely from Github. | ||
*See [buddy-dependencies](https://github.com/popeindustries/buddy-dependencies).* | ||
**Sources**: An array of local or remote resource locations. | ||
- **destination**: each group of sources will be installed to the project relative location specified. | ||
- **identifier**: github ```username/repo``` identifiers are preferred, but it is also possible to use identifiers from the [bower](https://github.com/twitter/bower) package manager: ```'jquery', 'backbone', 'underscore'```, etc. | ||
- **versioning**: github sources can specify a version by appending ```@``` and a npm-style symantic version: ```'*', '1.2.3', '1.x', '~1.2.0', '>=1.2.3'``` | ||
- **resources**: specific resources can be specified by appending ```#``` and a list of ```|``` separated relative file or directory locations: ```'username/repo#a/file/or/directory|another/file/or/directory'``` | ||
**Output**: A file destination to concatenate and compress the source contents. The order of *sources* determines the content order. | ||
## License | ||
@@ -569,3 +481,3 @@ | ||
Copyright (c) 2011 Pope-Industries <alex@pope-industries.com> | ||
Copyright (c) 2011-2013 Pope-Industries <alex@pope-industries.com> | ||
@@ -572,0 +484,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82883
482