{"id":21401450,"url":"https://github.com/spoonx/useuses","last_synced_at":"2025-07-13T21:31:52.735Z","repository":{"id":13141749,"uuid":"15824085","full_name":"SpoonX/useuses","owner":"SpoonX","description":"A module allowing you to use `@uses` annotations to load dependencies for your javascript files.","archived":false,"fork":false,"pushed_at":"2015-06-03T10:29:27.000Z","size":636,"stargazers_count":43,"open_issues_count":2,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-12T21:10:32.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpoonX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-11T14:45:36.000Z","updated_at":"2019-07-10T05:14:41.000Z","dependencies_parsed_at":"2022-09-04T22:23:05.954Z","dependency_job_id":null,"html_url":"https://github.com/SpoonX/useuses","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fuseuses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fuseuses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fuseuses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpoonX%2Fuseuses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpoonX","download_url":"https://codeload.github.com/SpoonX/useuses/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225919521,"owners_count":17545275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T15:27:51.865Z","updated_at":"2024-11-22T15:27:52.613Z","avatar_url":"https://github.com/SpoonX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Useuses\nA module that allows you to build your project, resolving dependencies based on the `@uses` annotation.\n\n[![Build Status](https://travis-ci.org/SpoonX/useuses.png)](https://travis-ci.org/SpoonX/useuses)\n[![Dependency Status](https://david-dm.org/spoonx/useuses.svg)](https://david-dm.org/spoonx/useuses)\n[![NPM version](https://badge.fury.io/js/useuses.png)](http://badge.fury.io/js/useuses)\n\n## What?\nBefore I dive into the technical specifics, I'll explain what this module is all about.\n\nIn short, it allows you to annotate your files with the `@uses` annotation to specify your dependencies;\nwhich is convenient for the developer reading your code as he or she now knows what dependencies a file has.\nIt looks like this:\n\n```javascript\n/**\n * My file\n *\n * Some info about My file\n *\n * @author  RWOverdijk\n * @version 0.1.0\n * @license MIT\n *\n * @uses ./my-dependency.js\n * @uses ./my/other/dependency.js\n */\n // Code here...\n```\n\nIt's also convenient because this module will bundle all dependencies together for you.\nIf you'd like a more detailed explanation of this module and its benefits, you can read about it in this [blog post](http://blog.spoonx.nl/javascript-dependency-management/).\n\n## Features\nThis module allows you to:\n\n* Build combined dist file based on used dependencies.\n* Wrap the output to prevent pollution of the global scope.\n* Include external (third party) resources. __*New__\n* Aliases. __*New__\n* Configure custom search (include) paths. __*New__\n\n## Installation\nYou can install useuses using npm:\n\n**Save as dependency:**\n`npm install useuses --save`\n\n**Global (for the cli):**\n`npm install -g useuses`\n\n## Usage\nThis module can be used in a programmatic manner, or via the command line.\n\n### CLI\nThis example assumes you have useuses installed globally.\nIf that's not the case, simply replace `useuses` with `./node_modules/useuses/bin/useuses.js`.\n\n`useuses -i example/main.js -o example/dist/built.js -w`\n\nAll available options can be found further down this document.\n\n### Programmatic\nBelow is an example on how to use Useuses.\n\n```javascript\nvar Useuses = require('useuses'),\n    useuses,\n    options;\n\noptions = {\n  in     : 'example/main.js',\n  out    : 'example/dist/built.js',\n  wrap   : true,\n  verbose: true,\n  aliases: {foo: 'bar/baz/bat'},\n  search : ['bower_components']\n};\n\nuseuses = new Useuses(options);\n\nuseuses.compile(function (error, assembled) {\n  if (error) {\n    return console.error(error);\n  }\n\n  console.log('Yay! The build succeeded. The files included in the build are:', assembled);\n});\n```\n\nAll available options can be found further down this document.\n\n## Options\nThe following options are currently available for useuses.\n\n### In (--in, -i)\nUse this option to tell useuses where the main project file is located.\n\n### Out (--out, -o)\nUsing this option you can tell useuses where to write the built file to.\n\n### Verbose (--verbose, -v)\nWhen supplied, useuses will output the files written to the build.\n\n### Tolerant (--tolerant, -t)\nWhen supplied, useuses will not stop on missing dependencies.\n\n### DryRun (--dry-run, -d)\nWhen supplied, useuses won't write the actual build.\nIn stead, it will output a list of files that _would_ have been written if this weren't a dry-run.\n\n**Note:** Programmatically, the key for this option is `dryRun`.\n\n### Aliases (--alias, -a)\nWith this option you can set up aliases for your dependencies.\nThis is particularly useful with external resources or vendor (lib) files.\n\nExample:\n\n`-a angular=https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular.min.js`\n\nNow you can just use `@uses angular` to specify you're using angular, and it will be downloaded and added to the build.\n\nUsing aliases can also be useful to specify alias paths.\n\nFor instance, creating alias `-a namespace/core=library/namespace/src/core` would allow you to get rid of the lengthy @uses.\nYou can now just specify `namespace/core/array-utilities.js` as a dependency.\n\nYou can supply multiple `-a` options, or an array separated string of assignments.\n\nExample:\n\n`-a vendor=vendor/bower_components,angular=library/angular/angular.js`\n\n**Note:** Programmatically, the key for this option is `aliases`.\nAn object where the key is the alias, and the value is what the alias links to.\n\n### Search (--search, -s)\nThis option allows you to specify custom search paths; places for the module to look for your dependencies.\n\nExample:\n\n`useuses -i simple/main.js -o examples/simple/dist/built.js -s examples -w`\n\nWill now find `simple/main.js` in `examples/simple/main.js` and will also use the path `examples` for nested dependencies.\n\n**Note:** Programmatically, the value for this option should be an array of paths.\n\n### Wrap (--wrap, -w)\nSetting this to true, will instruct useuses to wrap the built code in a self-invoking function.\nThe advantage here, is that your code will not pollute the global scope; but will still run.\n\nFor example, this:\n\n```javascript\nvar name = 'World';\n\nconsole.log('Hello ' + name);\n```\n\nWould become this:\n\n```javascript\n(function () {\n  var name = 'World';\n\n  console.log('Hello ' + name);\n})();\n```\n\n## Support\nIf you have any questions / suggestions feel free to use one of the following resources:\n\n* Take a look at the [wiki](https://github.com/SpoonX/useuses/wiki)\n* Take a look at the [issues](https://github.com/SpoonX/useuses/issues)\n* Join us on gitter [![Gitter chat](https://badges.gitter.im/SpoonX/Dev.png)](https://gitter.im/SpoonX/Dev)\n* [RWOverdijk at irc.freenode.net in #spoonx](http://webchat.freenode.net/?channels=spoonx\u0026uio=MTE9MTAz8d)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fuseuses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoonx%2Fuseuses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoonx%2Fuseuses/lists"}