{"id":22059294,"url":"https://github.com/opentable/spur-common","last_synced_at":"2025-05-12T19:44:44.709Z","repository":{"id":26534098,"uuid":"29987334","full_name":"opentable/spur-common","owner":"opentable","description":"Common node library that is implemented through the use of spur-ioc and bluebird promises.","archived":false,"fork":false,"pushed_at":"2024-04-29T18:15:46.000Z","size":338,"stargazers_count":3,"open_issues_count":3,"forks_count":6,"subscribers_count":38,"default_branch":"main","last_synced_at":"2024-04-29T21:18:36.886Z","etag":null,"topics":["harness-framework","nodejs","npm-package","renovate","spur","spur-framework"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentable.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-28T20:43:28.000Z","updated_at":"2024-06-19T06:07:58.145Z","dependencies_parsed_at":"2023-11-17T23:05:54.462Z","dependency_job_id":"43b4e9bb-9e46-45b0-86f1-f9673f940b4f","html_url":"https://github.com/opentable/spur-common","commit_stats":{"total_commits":195,"total_committers":7,"mean_commits":"27.857142857142858","dds":"0.45641025641025645","last_synced_commit":"ce6f6596ae359c91ca291ff03c7f25f693e455ed"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fspur-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fspur-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fspur-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fspur-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentable","download_url":"https://codeload.github.com/opentable/spur-common/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227383437,"owners_count":17772236,"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":["harness-framework","nodejs","npm-package","renovate","spur","spur-framework"],"created_at":"2024-11-30T17:27:53.464Z","updated_at":"2024-11-30T17:27:54.080Z","avatar_url":"https://github.com/opentable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://opentable.github.io/spur/logos/Spur-Common.png?rand=1\" width=\"100%\" alt=\"Spur: Common\" /\u003e\n\nA [Node.js](http://nodejs.org/) library of common modules used to create common applications.\n\n  [![NPM Version][npm-version-image]][npm-url]\n  [![NPM Install Size][npm-install-size-image]][npm-install-size-url]\n  [![NPM Downloads][npm-downloads-image]][npm-downloads-url]\n\n# About the Spur Framework\n\nThe Spur Framework is a collection of commonly used Node.JS libraries used to create common application types with shared libraries.\n\n[Visit NPMJS.org for a full list of Spur Framework libraries](https://www.npmjs.com/browse/keyword/spur-framework) \u003e\u003e\n\n# Topics\n\n- [Quick start](#quick-start)\n    - [Usage](#usage)\n- [API Reference](API.md)\n- [Available dependencies in injector](#available-dependencies-in-injector)\n- [Contributing](#contributing)\n- [License](#license)\n\n# Quick start\n\n## Installing\n\n```bash\n$ npm install spur-ioc --save\n$ npm install spur-common --save\n```\n\n## Usage\n\n#### `src/injector.js`\n\n```javascript\nconst spur       = require('spur-ioc');\nconst spurCommon = require('spur-common');\n\nmodule.exports = function(){\n\n  // define a  new injector\n  const ioc = spur.create('demo');\n\n  // register already constructed objects such as globals\n  ioc.registerDependencies({\n  });\n\n  // register folders in your project to be autoinjected\n  ioc.registerFolders(__dirname, [\n    'demo/'\n  ]);\n\n  // THIS IS THE IMPORTANT PART: Merge the spur-common dependencies to your local container\n  ioc.merge(spurCommon())\n\n  return ioc;\n}\n```\n\n#### `start.js`\n\n```javascript\nconst injector = require('./src/injector');\n\ninjector().inject(function (UncaughtHandler, Logger) {\n\n  Logger.info('Starting app...');\n\n  // Here you would inject your dependencies like WebServer or runtime class and start it.\n\n  // Enabled the UncaughtHandler\n  UncaughtHandler.listen();\n\n});\n```\n\n# Available dependencies in injector\n\nTo see the latest list of the default dependencies that are injected, check out the [injector.js](src/injector.js) file. Here is a short list of of all of the dependencies available:\n\n### System dependencies\n\n| Name            | Original Module Name | Description             |\n| :----           | :----                | :----                   |\n| **fs**          | fs                   | Node file system        |\n| **path**        | path                 | Node path module        |\n| **nodeProcess** | process              | Node process module     |\n| **console**     | console              | JavaScript Console      |\n| **JSON**        | JSON                 | JavaScript JSON library |\n\n### Libraries\n\nList of external dependencies used and exposed by spur-common. They can be found at npmjs.org using their original names.\n\n| Name              | Original Module Name                                             |\n| :----             | :----                                                            |\n| **Promise**       | [bluebird](https://www.npmjs.org/package/bluebird)               |\n| **superagent**    | [superagent](https://www.npmjs.org/package/superagent)           |\n| **FormData**      | [form-data](https://www.npmjs.org/package/form-data)             |\n| **SpurErrors**    | [spur-errors](https://www.npmjs.org/package/spur-errors)         |\n\n### Local dependecies\n\nAll of the files under the `src/` directory are made available when this module is merged into another injector. The following list are the notable dependencies available.\n\n| Name                | Source                                  | Description                                                                                                                                                                                                  |\n| :----               | :----                                   | :----                                                                                                                                                                                                        |\n| **BaseDelegate**    | [code](src/core/BaseDelegate.js)    | A utility class used to create classes with delegates that can be allow us to replace implementations dynamically and allow for plugins. For an example, take a look at [Logger](src/logging/Logger.js). |\n| **UncaughtHandler** | [code](src/core/UncaughtHandler.js) | Simple module that catches uncaught errors when initialized.                                                                                                                                                 |\n| **FixtureUtil**     | [code](src/fixtures/FixtureUtil.js) | Fixtures util that allows you to read test files from a specific directory.                                                                                                                                  |\n| **HTTPService**     | [code](src/http/HTTPService.js)     | An extension of the superagent module to support promises and other nice enhancements to make HTTP requests simpler to process.                                                                              |\n| **Logger**          | [code](src/logging/Logger.js)       | An implementation of a logger that extends console.log and makes it so you can add plugins for logging to different sources.                                                                                 |\n| **fsPromise**       | [code](src/promisify/fsPromise.js)  | A wrapper for the Node fs module that adds promises to the module.                                                                                                                                           |\n| **Utils**           | [code](src/utils/Utils.js)          | A collection of random utilities.                                                                                                                                                                            |\n\n\n# Contributing\n\n## We accept pull requests\n\nPlease send in pull requests and they will be reviewed in a timely manner. Please review this [generic guide to submitting a good pull requests](https://github.com/blog/1943-how-to-write-the-perfect-pull-request). The only things we ask in addition are the following:\n\n * Please submit small pull requests\n * Provide a good description of the changes\n * Code changes must include tests\n * Be nice to each other in comments. :innocent:\n\n## Style guide\n\nThe majority of the settings are controlled using an [EditorConfig](.editorconfig) configuration file. To use it [please download a plugin](http://editorconfig.org/#download) the plugin for your editor of choice.\n\n## All tests should pass\n\nTo run the test suite, first install the dependancies, then run `npm test`\n\n```bash\n$ npm install\n$ npm test\n```\n\n# License\n\n[MIT](LICENSE)\n\n[npm-downloads-image]: https://badgen.net/npm/dm/spur-common\n[npm-downloads-url]: https://npmcharts.com/compare/spur-common?minimal=true\n[npm-install-size-image]: https://badgen.net/packagephobia/install/spur-common\n[npm-install-size-url]: https://packagephobia.com/result?p=spur-common\n[npm-url]: https://npmjs.org/package/spur-common\n[npm-version-image]: https://badgen.net/npm/v/spur-common\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fspur-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentable%2Fspur-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fspur-common/lists"}