{"id":15598743,"url":"https://github.com/lukechilds/requirable","last_synced_at":"2025-10-24T05:55:04.465Z","repository":{"id":57158695,"uuid":"98335363","full_name":"lukechilds/requirable","owner":"lukechilds","description":"Enables a module to require itself by name","archived":false,"fork":false,"pushed_at":"2019-10-10T23:26:52.000Z","size":35,"stargazers_count":6,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T06:48:54.438Z","etag":null,"topics":["ava","requirable","require","test","testing"],"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/lukechilds.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":"2017-07-25T18:00:15.000Z","updated_at":"2023-09-08T17:27:52.000Z","dependencies_parsed_at":"2022-09-12T06:00:33.447Z","dependency_job_id":null,"html_url":"https://github.com/lukechilds/requirable","commit_stats":null,"previous_names":["lukechilds/requireable"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Frequirable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Frequirable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Frequirable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Frequirable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukechilds","download_url":"https://codeload.github.com/lukechilds/requirable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250580712,"owners_count":21453531,"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":["ava","requirable","require","test","testing"],"created_at":"2024-10-03T01:41:10.932Z","updated_at":"2025-10-24T05:54:59.440Z","avatar_url":"https://github.com/lukechilds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# requirable\n\n\u003e Enables a module to require itself by name\n\n[![Build Status](https://travis-ci.org/lukechilds/requirable.svg?branch=master)](https://travis-ci.org/lukechilds/requirable)\n[![Coverage Status](https://coveralls.io/repos/github/lukechilds/requirable/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/requirable?branch=master)\n[![npm](https://img.shields.io/npm/v/requirable.svg)](https://www.npmjs.com/package/requirable)\n\nMocks the require command to include the current package when the `name` from the current `package.json` is required.\n\nUses `process.cwd()` to find the current `package.json` so this is only meant to be used in scripts executed from the CLI. This will not work on a published package!\n\n## Install\n\n```shell\nnpm install --save-dev requirable\n```\n\n## Usage\n\n```js\nrequire('requirable');\n// That's it! `require` has now been patched\n\nconst myPackage = require('package-name')\n```\n\n## AVA Usage\n\nSome tests runners such as [AVA](https://github.com/avajs/ava) can require packages automatically for you. If you're using AVA add the following to your package.json:\n\n```json\n\"ava\": {\n  \"require\": [\n    \"requirable\"\n  ]\n},\n ```\n\n You can now `require` (or `import`) your package in your AVA tests by name.\n\n e.g instead of:\n\n ```js\n import test from 'ava';\n import myPackage from '../';\n ```\n\n You can now do:\n\n ```js\n import test from 'ava';\n import myPackage from 'package-name';\n ```\n\n## API\n\n### require('requirable')\n\nPatches the require function to be able to require the current module by name.\n\nReturns an object.\n\n#### obj.success\n\nType: `boolean`\n\nTrue or false depending on whether we could find `package.json`.\n\n#### obj.path\n\nType: `undefined`, `string`\n\nPath to the folder containing `package.json`.\n\n#### obj.name\n\nType: `undefined`, `string`\n\nName of the module in `package.json`.\n\n## License\n\nMIT © Luke Childs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukechilds%2Frequirable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukechilds%2Frequirable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukechilds%2Frequirable/lists"}