{"id":17219974,"url":"https://github.com/silvae86/rlequire","last_synced_at":"2026-06-30T19:32:28.624Z","repository":{"id":150042993,"uuid":"132936292","full_name":"silvae86/rlequire","owner":"silvae86","description":"\"Relative Require\": No more relative require hell! A nodejs module for requiring files in paths relative to one where a specific package.json is located","archived":false,"fork":false,"pushed_at":"2019-04-09T16:15:38.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T11:28:56.166Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/silvae86.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-10T17:57:48.000Z","updated_at":"2019-04-09T16:15:40.000Z","dependencies_parsed_at":"2023-04-12T14:31:48.554Z","dependency_job_id":null,"html_url":"https://github.com/silvae86/rlequire","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/silvae86/rlequire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvae86%2Frlequire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvae86%2Frlequire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvae86%2Frlequire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvae86%2Frlequire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silvae86","download_url":"https://codeload.github.com/silvae86/rlequire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silvae86%2Frlequire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34981390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-15T03:51:15.203Z","updated_at":"2026-06-30T19:32:28.586Z","avatar_url":"https://github.com/silvae86.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/silvae86/rlequire.svg?branch=master)](https://travis-ci.org/silvae86/rlequire)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cff4cfde36144314adbdce30226737e6)](https://www.codacy.com/app/silvae86/rrequire?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=silvae86/rrequire\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/cff4cfde36144314adbdce30226737e6)](https://www.codacy.com/app/silvae86/rrequire?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=silvae86/rrequire\u0026utm_campaign=Badge_Coverage)\n[![npm version](https://badge.fury.io/js/rlequire.svg)](https://badge.fury.io/js/rlequire)\n\n# rlequire\nTired of require(\"../../../../../whatever\") ????\n\n\"Relative Require\": A nodejs module for requiring files in paths relative to one where a specific package.json is located. \n\n## Why is this needed?\n\nBecause NodeJS does not have a robust way of determining the root path of a running application. Sure, when your app is a couple of files you dont have problems, but as it starts growing, with modular parts and plugins, you want to be sure you can locate the actual root of your application. Also, mocha makes your `__basedir` stop working.\n\nhttps://stackoverflow.com/questions/10265798/determine-project-root-from-a-running-node-js-application\n\n\n## How to use?\n\n````bash\nnpm install rlequire --save\n````\n\n````node\nconst rlequire = require(\"rlequire\")\nconst Client = rlequire(\"your-app\", \"./src/model/client.js\", [optional, boolean] forceRecheck).Client;\n````\n\nrrequire will search the current folder of the file from which it is invoked and the entire upstream directory until the root of the filesystem. Whenever a `package.json` file is detected, it will attempt to parse it. \n\n - If the `name` field in the package.json matches `your-app`, it will detect that folder as the root of the app.\n - If the file path `\"./src/model/client.js\"` exists, relatively to the detected root folder, it will require the file for you.\n - The expensive directory traversal operation is done only the first time we need to determine the root of an app, unless the `forceRescan` optional argument is specified as `true`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilvae86%2Frlequire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilvae86%2Frlequire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilvae86%2Frlequire/lists"}