Socket
Socket
Sign inDemoInstall

buddy

Package Overview
Dependencies
171
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.0 to 0.7.1

13

lib/core/configuration.js

@@ -9,3 +9,4 @@ var fs = require('fs')

var DEFAULT = 'buddy.js'
, DEFAULT_JSON = 'buddy.json';
, DEFAULT_JSON = 'buddy.json'
, DEFAULT_PACKAGE_JSON = 'package.json';

@@ -29,2 +30,4 @@ exports.data = null;

data = require(exports.url);
// Package.json location
if (data.buddy) data = data.buddy;
} catch (e) {

@@ -51,3 +54,3 @@ return fn("parsing " + (strong(exports.url)) + "\n Run " + (strong('buddy -h')) + " for proper formatting");

var locate = exports.locate = function(url, fn) {
var dir, parent, urljs, urljson;
var dir, parent, urljs, urljson, urlpkgjson;
if (url) {

@@ -64,3 +67,4 @@ // Check that the supplied path is valid

urljson = path.join(url, DEFAULT_JSON);
if (existsSync(url = urljs) || existsSync(url = urljson)) {
urlpkgjson = path.join(url, DEFAULT_PACKAGE_JSON);
if (existsSync(url = urljs) || existsSync(url = urljson) || existsSync(url = urlpkgjson)) {
debug("config file found at: " + (strong(url)), 2);

@@ -101,3 +105,4 @@ exports.url = url;

urljson = path.join(dir, DEFAULT_JSON);
if (existsSync(url = urljs) || existsSync(url = urljson)) {
urlpkgjson = path.join(dir, DEFAULT_PACKAGE_JSON);
if (existsSync(url = urljs) || existsSync(url = urljson) || existsSync(url = urlpkgjson)) {
debug("config file found at: " + (strong(url)), 2);

@@ -104,0 +109,0 @@ exports.url = url;

var path = require('path')
, fs = require('fs')
, fstream = require('fstream')
, bower = require('bower')

@@ -204,3 +205,4 @@ , request = require('superagent')

// Download archive to temp
, req = request.get(this.url).buffer(false);
, req = request.get(this.url).buffer(false)
, extractor, writer;
debug("downloading zipball to temp: " + (strong(this.url)), 3);

@@ -212,18 +214,21 @@ req.end(function(err, res) {

} else {
extractor = unzip.Extract({path: self.temp});
writer = fstream.Writer(self.temp);
// Write to disk
res.pipe(fs.createWriteStream(filename));
res.pipe(fs.createWriteStream(filename))
res.on('end', function() {
// Unzip
var extractor = unzip.Extract({path: self.temp});
fs.createReadStream(filename).pipe(extractor);
// Error unzipping
extractor.on('error', function() {
fn('unzipping archive: ' + filename);
});
// Store path to unzipped package
extractor.on('close', function() {
self.location = filename.replace(path.extname(filename), '');
fn();
});
fs.createReadStream(filename)
.pipe(unzip.Parse())
// Store path to unzipped package
.on('entry', function(entry) {
if (!self.location && entry.type === 'Directory') self.location = path.resolve(self.temp, entry.path);
})
// Error unzipping
.on('error', function() {
fn('unzipping archive: ' + filename);
})
.pipe(writer);
});
writer.on('close', fn);
}

@@ -230,0 +235,0 @@ });

@@ -82,2 +82,7 @@ var fs = require('fs')

this.qualifiedName = path.relative(this.basepath, this.filepath).replace(path.extname(this.name), '');
// Rename index files
if (this.qualifiedName.slice(-5) == 'index') {
this.qualifiedName = this.qualifiedName.slice(0, -6);
if (this.qualifiedName == '') this.qualifiedName = path.basename(path.join(this.filepath, '..'));
}
this.moduleID = this.options.module.getModuleID(this.qualifiedName);

@@ -84,0 +89,0 @@ this.dependencies = [];

{
"name": "buddy",
"description": "A build tool for js/css projects. Manages third-party dependencies, compiles source code, automatically modularizes js sources, statically resolves module dependencies, and lints/concatenates/compresses output.",
"version": "0.7.0",
"version": "0.7.1",
"author": "popeindustries <alex@pope-industries.com>",

@@ -11,14 +11,15 @@ "keywords": ["build", "buildtool", "modules", "javascript", "coffeescript", "css", "styus", "less"],

"less": "1.3.3",
"uglify-js": "2.2.3",
"clean-css": "0.9.1",
"csslint": "0.9.9",
"uglify-js": "2.2.5",
"clean-css": "0.10.1",
"csslint": "0.9.10",
"jshint": "0.9.1",
"commander": "1.1.1",
"rimraf": "2.1.1",
"rimraf": "2.1.4",
"mkdirp": "0.3.4",
"bower": "0.6.8",
"bower": "0.7.0",
"superagent": "0.12.0",
"unzip": "0.1.0",
"semver": "1.1.2",
"async": "0.1.22",
"unzip": "0.1.3",
"fstream": "0.1.22",
"semver": "1.1.3",
"async": "0.2.5",
"livereload-protocol": "0.2.2",

@@ -49,3 +50,3 @@ "websocket.io": "0.2.1"

"readmeFilename": "README.md",
"readme": "# buddy(1)\n\n**buddy(1)** is a build tool for js/css projects. It helps you manage third-party dependencies, compiles source code from higher order js/css languages (CoffeeScript/Stylus/Less), 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.7.0\n*[the 0.5.x+ branch is not backwards compatible with earlier versions. See [Change Log](#a1) below 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 ___lazy___ runtime evaluation by storing js modules as strings\n- __Compiles__ _CoffeeScript_, _Stylus_, and _Less_ 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- __Refreshes__ connected browsers after each change\n- __Inlines__ css `@imports` automatically\n- Supports execution of a ___test___ script after each build\n- Copies __libraries__ from GitHub to your project\n- Copies __assets__ from a local destination to your project\n\n## Installation\n\nUse the *-g* global flag to make the **buddy(1)** command available system-wide:\n\n```bash\n$ npm -g install buddy\n```\n\nOr, optionally, add **buddy** as a dependency in your project's *package.json* file:\n\n```json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.0.1\",\n \"dependencies\": {\n \"buddy\": \"0.5.0\"\n },\n \"scripts\": {\n \"install\": \"./node_modules/buddy/bin/buddy install\",\n \"build\": \"./node_modules/buddy/bin/buddy build\",\n \"deploy\": \"./node_modules/buddy/bin/buddy deploy\"\n }\n}\n```\n\n...then install:\n\n```bash\n$ cd path/to/project\n$ npm install\n```\n\n## Usage\n\n```text\nUsage: buddy [options] <command> [path/to/buddy.json]>\n\nCommands:\n\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 -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### Configuration\n\nThe only requirement for adding **buddy** support to a project is the presence of a **buddy.js** file in your project root:\n\n```js\n// Project build configuration.\nexports.build = {\n js: {\n // Directories containing potential js source files for this project.\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 // 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 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' or 'scripts' 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 // Override the default plugins, and/or include custom plugins.\n plugins: {\n js: {\n // Append one or more js compilers to the default 'coffeescript'.\n compilers: ['a/file', 'another/file'],\n // Change the default 'uglifyjs' compressor to a custom specification.\n compressor: 'a/file',\n // Change the default 'jshint' linter to a custom specification.\n linter: 'a/file',\n // Change the default 'node' module type to 'amd' or a custom specification.\n module: 'amd'\n },\n css: {\n // Append one or more css compilers to the default 'stylus' and 'less'.\n compilers: ['a/file', 'another/file'],\n // Change the default 'cleancss' compressor to a custom specification.\n compressor: 'a/file',\n // Change the default 'csslint' linter to a custom specification.\n linter: 'a/file'\n }\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 *buddy.js* 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### MODULES\n\nEach js file is wrapped in a module declaration based on the file's location. Dependencies (and concatenation order) 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 *buddy.js > 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/docs/v0.8.0/api/modules.html) for more info on modules.\n\n***NOTE***: ```require``` boilerplate needs to be included on the page to enable module loading. It's recommended to ```install``` a library like *popeindustries/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'```\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## Examples\n\nCopy project boilerplate from a local directory:\n\n```js\nexports.dependencies = {\n '.': {\n sources: ['../../boilerplate/project']\n }\n}\n```\n\nGrab js dependencies to be installed and packaged for inclusion in html:\n\n```js\nexports.dependencies = {\n // install location\n 'libs/vendor': {\n sources: [\n // library for require boilerplate\n 'popeindustries/browser-require',\n // jquery at specific version\n 'jquery@1.8.2'\n ],\n // packaged and compressed\n output: 'www/assets/js/libs.js'\n }\n}\n```\n\nGrab sources to be referenced in your builds:\n\n```js\nexports.dependencies = {\n // install location\n 'libs/src/css': {\n sources: [\n // reference the lib/nib directory for installation\n 'visionmedia/nib#lib/nib'\n ]\n }\n}\n```\n\nCompile a library, then reference some library files in your project:\n\n```js\nexports.build = {\n js: {\n sources: ['libs/src/coffee', 'libs/js', 'src'],\n targets: [\n {\n // a folder of coffee files (including nested folders)\n input: 'libs/src/coffee',\n // a folder of compiled js files\n output: 'libs/js'\n },\n {\n // the application entry point referencing library dependencies\n input: 'src/main.js',\n // a concatenation of referenced dependencies\n output: 'js/main.js'\n }\n ]\n }\n}\n```\n\nCompile a site with an additional widget using shared sources:\n\n```js\nexports.build = {\n js: {\n sources: ['src/coffee'],\n targets: [\n {\n // the application entry point\n input: 'src/coffee/main.coffee',\n // output to main.js (includes all referenced dependencies)\n output: 'js',\n targets: [\n {\n // references some of the same sources as main.coffee\n input: 'src/coffee/widget.coffee',\n // includes only referenced dependencies not in main.js\n output: 'js'\n }\n ]\n }\n ]\n }\n}\n```\n\n<a name=\"a1\"/>\n## Changelog\n\n**0.7.0** - January 7, 2013\n* bye bye CoffeeScript - migrated to js only source\n* upgraded dependencies\n\n**0.6.11** - December 21, 2012\n* fix css comment removal deleting base64 content\n\n**0.6.10** - December 21, 2012\n* updated _Uglify-js_ compressor to 2.0\n\n**0.6.9** - December 14, 2012\n* fixed _watch_ not adding new file during renames\n\n**0.6.8** - December 13, 2012\n* fixed _install_ crash\n* _install_ now overwrites previously downloaded resources\n* properly handle duplicate `@import` rules while inlining\n\n**0.6.7** - December 11, 2012\n* added _--lazy_ option for generating js modules for lazy evaluation; module contents are encoded as strings to be passed to a Function constructor on first require()\n\n**0.6.6** - December 6, 2012\n* added live-reload support for _watch_ command with _--reload_\n* re-enabled linting support\n\n**0.6.5** - December 5, 2012\n* fix for *watch* command firing repeated change events\n* fix for *watch* command not properly building targets on change\n* fix for child target building shared resources\n\n**0.6.4** - December 4, 2012\n* fix for _--test_ not displaying both stdout and stderr\n* added wrapping of batch files in module definitions if _options.modular_ is not false\n* fix for building targets that contain no source\n\n**0.6.3** - December 4, 2012\n* fix for _watch_ command attempting to watch a source that doesn't exist\n* added support for default json config file type\n\n**0.6.2** - December 4, 2012\n* fix for css _@import_ inlining\n\n**0.6.1** - December 3, 2012\n* added _--test_ to watch command\n\n**0.6.0** - December 3, 2012\n* complete rewrite for async file operations\n* added _--test_ flag for executing a command after build\n* added _--verbose_ flag for outputting detailed notifications during build\n* added _ls_ command to list all generated files\n* added inlining of '@import' rules for all css source types\n* simplified dependency resource parsing on install; only parse 'main' field in component.json/package.json\n\n**0.5.4** - November 23, 2012\n* regression fix for _clean_ command\n* improved _.buddy-filelog_ force clean\n* improved notifications for _install_ and *clean* commands\n\n**0.5.3** - November 23, 2012\n* refactored _install_ command behaviour; no longer uses git operations, changed syntax for specifying version ('@') and resources ('#'), added ability to list several resources __[breaking change]__\n* _.buddy-filelog_ now stores relative paths for compatibility on different systems\n* file deletions limited to resources under the project root\n\n**0.5.2** - Novemver 20, 2012\n* added _watch_ command; handle add, remove, and change of source files\n\n**0.5.1** - Novemver 14, 2012\n* added _clean_ command to remove all generated files\n* added hidden _.buddy-filelog_ file for tracking files changes between sessions\n* fix for false-negative module wrapping test\n\n**0.5.0** - November 13, 2012\n* _compile_ command renamed to *build* __[breaking change]__\n* changed module naming for compatibility with recent versions of Node.js (camel case no longer converted to underscores) __[breaking change]__\n* changed configuration file type to 'js' from 'json'; added _dependencies_ and _settings_ __[breaking change]__\n* changed configuration _target_ parameters to _input/output_ from _in/out_ __[breaking change]__\n* changed configuration _target_ parameter to _modular_ from _nodejs_ __[breaking change]__\n* concatenated js modules no longer self-booting; need to ```require('main');``` manually __[breaking change]__\n* _require_ boilerplate no longer included in generated source; install _popeindustries/browser-require_ or equivalent __[breaking change]__\n* removed _watch_ command (temporarily) __[breaking change]__\n* added _install_ command and project dependency management\n* added plugin support for compilers, compressors, linters, and modules; added support for custom plugins\n* added code linting\n* all errors now throw\n* complete code base refactor\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Pope-Industries &lt;alex@pope-industries.com&gt;\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": "# buddy(1)\n\n**buddy(1)** is a build tool for js/css projects. It helps you manage third-party dependencies, compiles source code from higher order js/css languages (CoffeeScript/Stylus/Less), 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.7.1\n*[the 0.5.x+ branch is not backwards compatible with earlier versions. See [Change Log](#a1) below 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 ___lazy___ runtime evaluation by storing js modules as strings\n- __Compiles__ _CoffeeScript_, _Stylus_, and _Less_ 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- __Refreshes__ connected browsers after each change\n- __Inlines__ css `@imports` automatically\n- Supports execution of a ___test___ script after each build\n- Copies __libraries__ from GitHub to your project\n- Copies __assets__ from a local destination to your project\n\n## Installation\n\nUse the *-g* global flag to make the **buddy(1)** command available system-wide:\n\n```bash\n$ npm -g install buddy\n```\n\nOr, optionally, add **buddy** as a dependency in your project's *package.json* file:\n\n```json\n{\n \"name\": \"myproject\",\n \"description\": \"This is my web project\",\n \"version\": \"0.0.1\",\n \"dependencies\": {\n \"buddy\": \"0.5.0\"\n },\n \"scripts\": {\n \"install\": \"./node_modules/buddy/bin/buddy install\",\n \"build\": \"./node_modules/buddy/bin/buddy build\",\n \"deploy\": \"./node_modules/buddy/bin/buddy deploy\"\n }\n}\n```\n\n...then install:\n\n```bash\n$ cd path/to/project\n$ npm install\n```\n\n## Usage\n\n```text\nUsage: buddy [options] <command> [path/to/buddy.js or path/to/buddy.json or path/to/package.json]>\n\nCommands:\n\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 -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### Configuration\n\nThe only requirement for adding **buddy** support to a project is the presence of a **buddy.js/buddy.json/package.json(with `buddy` entry)** file in your project root:\n\n```js\n// Project build configuration.\nexports.build = {\n js: {\n // Directories containing potential js source files for this project.\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 // 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 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' or 'scripts' 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 // Override the default plugins, and/or include custom plugins.\n plugins: {\n js: {\n // Append one or more js compilers to the default 'coffeescript'.\n compilers: ['a/file', 'another/file'],\n // Change the default 'uglifyjs' compressor to a custom specification.\n compressor: 'a/file',\n // Change the default 'jshint' linter to a custom specification.\n linter: 'a/file',\n // Change the default 'node' module type to 'amd' or a custom specification.\n module: 'amd'\n },\n css: {\n // Append one or more css compilers to the default 'stylus' and 'less'.\n compilers: ['a/file', 'another/file'],\n // Change the default 'cleancss' compressor to a custom specification.\n compressor: 'a/file',\n // Change the default 'csslint' linter to a custom specification.\n linter: 'a/file'\n }\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 *buddy.js* 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### MODULES\n\nEach js file is wrapped in a module declaration based on the file's location. Dependencies (and concatenation order) 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 *buddy.js > 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/docs/v0.8.0/api/modules.html) for more info on modules.\n\n***NOTE***: ```require``` boilerplate needs to be included on the page to enable module loading. It's recommended to ```install``` a library like *popeindustries/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'```\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## Examples\n\nCopy project boilerplate from a local directory:\n\n```js\nexports.dependencies = {\n '.': {\n sources: ['../../boilerplate/project']\n }\n}\n```\n\nGrab js dependencies to be installed and packaged for inclusion in html:\n\n```js\nexports.dependencies = {\n // install location\n 'libs/vendor': {\n sources: [\n // library for require boilerplate\n 'popeindustries/browser-require',\n // jquery at specific version\n 'jquery@1.8.2'\n ],\n // packaged and compressed\n output: 'www/assets/js/libs.js'\n }\n}\n```\n\nGrab sources to be referenced in your builds:\n\n```js\nexports.dependencies = {\n // install location\n 'libs/src/css': {\n sources: [\n // reference the lib/nib directory for installation\n 'visionmedia/nib#lib/nib'\n ]\n }\n}\n```\n\nCompile a library, then reference some library files in your project:\n\n```js\nexports.build = {\n js: {\n sources: ['libs/src/coffee', 'libs/js', 'src'],\n targets: [\n {\n // a folder of coffee files (including nested folders)\n input: 'libs/src/coffee',\n // a folder of compiled js files\n output: 'libs/js'\n },\n {\n // the application entry point referencing library dependencies\n input: 'src/main.js',\n // a concatenation of referenced dependencies\n output: 'js/main.js'\n }\n ]\n }\n}\n```\n\nCompile a site with an additional widget using shared sources:\n\n```js\nexports.build = {\n js: {\n sources: ['src/coffee'],\n targets: [\n {\n // the application entry point\n input: 'src/coffee/main.coffee',\n // output to main.js (includes all referenced dependencies)\n output: 'js',\n targets: [\n {\n // references some of the same sources as main.coffee\n input: 'src/coffee/widget.coffee',\n // includes only referenced dependencies not in main.js\n output: 'js'\n }\n ]\n }\n ]\n }\n}\n```\n\n<a name=\"a1\"/>\n## Changelog\n\n**0.7.1** - February 16, 2013\n* added support for definining configuration in package.json under a `buddy` entry\n* fixed dependency install error for zipballs that don't match their unzipped folder names\n* upgraded dependencies\n\n**0.7.0** - January 7, 2013\n* bye bye CoffeeScript - migrated to js only source\n* upgraded dependencies\n\n**0.6.11** - December 21, 2012\n* fix css comment removal deleting base64 content\n\n**0.6.10** - December 21, 2012\n* updated _Uglify-js_ compressor to 2.0\n\n**0.6.9** - December 14, 2012\n* fixed _watch_ not adding new file during renames\n\n**0.6.8** - December 13, 2012\n* fixed _install_ crash\n* _install_ now overwrites previously downloaded resources\n* properly handle duplicate `@import` rules while inlining\n\n**0.6.7** - December 11, 2012\n* added _--lazy_ option for generating js modules for lazy evaluation; module contents are encoded as strings to be passed to a Function constructor on first require()\n\n**0.6.6** - December 6, 2012\n* added live-reload support for _watch_ command with _--reload_\n* re-enabled linting support\n\n**0.6.5** - December 5, 2012\n* fix for *watch* command firing repeated change events\n* fix for *watch* command not properly building targets on change\n* fix for child target building shared resources\n\n**0.6.4** - December 4, 2012\n* fix for _--test_ not displaying both stdout and stderr\n* added wrapping of batch files in module definitions if _options.modular_ is not false\n* fix for building targets that contain no source\n\n**0.6.3** - December 4, 2012\n* fix for _watch_ command attempting to watch a source that doesn't exist\n* added support for default json config file type\n\n**0.6.2** - December 4, 2012\n* fix for css _@import_ inlining\n\n**0.6.1** - December 3, 2012\n* added _--test_ to watch command\n\n**0.6.0** - December 3, 2012\n* complete rewrite for async file operations\n* added _--test_ flag for executing a command after build\n* added _--verbose_ flag for outputting detailed notifications during build\n* added _ls_ command to list all generated files\n* added inlining of '@import' rules for all css source types\n* simplified dependency resource parsing on install; only parse 'main' field in component.json/package.json\n\n**0.5.4** - November 23, 2012\n* regression fix for _clean_ command\n* improved _.buddy-filelog_ force clean\n* improved notifications for _install_ and *clean* commands\n\n**0.5.3** - November 23, 2012\n* refactored _install_ command behaviour; no longer uses git operations, changed syntax for specifying version ('@') and resources ('#'), added ability to list several resources __[breaking change]__\n* _.buddy-filelog_ now stores relative paths for compatibility on different systems\n* file deletions limited to resources under the project root\n\n**0.5.2** - Novemver 20, 2012\n* added _watch_ command; handle add, remove, and change of source files\n\n**0.5.1** - Novemver 14, 2012\n* added _clean_ command to remove all generated files\n* added hidden _.buddy-filelog_ file for tracking files changes between sessions\n* fix for false-negative module wrapping test\n\n**0.5.0** - November 13, 2012\n* _compile_ command renamed to *build* __[breaking change]__\n* changed module naming for compatibility with recent versions of Node.js (camel case no longer converted to underscores) __[breaking change]__\n* changed configuration file type to 'js' from 'json'; added _dependencies_ and _settings_ __[breaking change]__\n* changed configuration _target_ parameters to _input/output_ from _in/out_ __[breaking change]__\n* changed configuration _target_ parameter to _modular_ from _nodejs_ __[breaking change]__\n* concatenated js modules no longer self-booting; need to ```require('main');``` manually __[breaking change]__\n* _require_ boilerplate no longer included in generated source; install _popeindustries/browser-require_ or equivalent __[breaking change]__\n* removed _watch_ command (temporarily) __[breaking change]__\n* added _install_ command and project dependency management\n* added plugin support for compilers, compressors, linters, and modules; added support for custom plugins\n* added code linting\n* all errors now throw\n* complete code base refactor\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Pope-Industries &lt;alex@pope-industries.com&gt;\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."
}

@@ -5,3 +5,3 @@ # buddy(1)

**Current version:** 0.7.0
**Current version:** 0.7.1
*[the 0.5.x+ branch is not backwards compatible with earlier versions. See [Change Log](#a1) below for more details]*

@@ -60,3 +60,3 @@

```text
Usage: buddy [options] <command> [path/to/buddy.json]>
Usage: buddy [options] <command> [path/to/buddy.js or path/to/buddy.json or path/to/package.json]>

@@ -86,3 +86,3 @@ Commands:

The only requirement for adding **buddy** support to a project is the presence of a **buddy.js** file in your project root:
The only requirement for adding **buddy** support to a project is the presence of a **buddy.js/buddy.json/package.json(with `buddy` entry)** file in your project root:

@@ -392,2 +392,7 @@ ```js

**0.7.1** - February 16, 2013
* added support for definining configuration in package.json under a `buddy` entry
* fixed dependency install error for zipballs that don't match their unzipped folder names
* upgraded dependencies
**0.7.0** - January 7, 2013

@@ -394,0 +399,0 @@ * bye bye CoffeeScript - migrated to js only source

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc