{"id":19556342,"url":"https://github.com/fiverr/dont_look_up_package","last_synced_at":"2025-04-26T22:33:02.769Z","repository":{"id":57215141,"uuid":"125241062","full_name":"fiverr/dont_look_up_package","owner":"fiverr","description":"🙈 Stop requirejs from traversing at a certain point","archived":false,"fork":false,"pushed_at":"2023-03-21T22:56:46.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":61,"default_branch":"master","last_synced_at":"2025-04-04T18:11:47.856Z","etag":null,"topics":["modules","mono-repo","monorepo","requirejs","testing"],"latest_commit_sha":null,"homepage":"https://fiverr.github.io/dont_look_up_package/","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/fiverr.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-03-14T16:20:42.000Z","updated_at":"2020-09-19T04:27:50.000Z","dependencies_parsed_at":"2024-11-11T04:49:05.983Z","dependency_job_id":null,"html_url":"https://github.com/fiverr/dont_look_up_package","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.2857142857142857,"last_synced_commit":"656dc679d11da1e626de6c43191cf244077194ff"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fdont_look_up_package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fdont_look_up_package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fdont_look_up_package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fiverr%2Fdont_look_up_package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fiverr","download_url":"https://codeload.github.com/fiverr/dont_look_up_package/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251063667,"owners_count":21530837,"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":["modules","mono-repo","monorepo","requirejs","testing"],"created_at":"2024-11-11T04:37:37.122Z","updated_at":"2025-04-26T22:32:57.746Z","avatar_url":"https://github.com/fiverr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# don't look up [![](https://circleci.com/gh/fiverr/dont_look_up_package.svg?style=svg)](https://circleci.com/gh/fiverr/dont_look_up_package)\n\n[![NPM](https://nodei.co/npm/dont-look-up.png)](https://www.npmjs.com/package/dont-look-up)\n\n## Stop requirejs from traversing at a certain point\n\n\u003e Whatever you do — don't look up\n\nStop requirejs' search path from looking higher than a given directory. This behaviour is should prevent your application from finding modules installed globally, or on a higher level directory, like in a mono-repo containing many packages.\n\n```js\ndescribe('my-tests', () =\u003e {\n    require('dont-look-up')(__dirname);\n\n    it('Should only traverse up to current root directory', () =\u003e { ... });\n});\n```\n\n### Example\n\nConsider the following tree\n\n```\n└── repository\n    ├── package\n    │   ├── index.js\n    │   ├── package.json\n    │   └── node_modules\n    │       └── child-level-module\n    ├── index.js\n    ├── package.json\n    └── node_modules\n        └── parent-level-module\n```\n\n| package/index.js\n| ---\n\n```js\nrequire('parent-level-module'); // works\nrequire('child-level-module'); // works\n```\n\nWith \"don't look up\"\n\n```js\nrequire('dont-look-up')(__dirname);\nrequire('parent-level-module'); // throws error\nrequire('child-level-module'); // works\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiverr%2Fdont_look_up_package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiverr%2Fdont_look_up_package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiverr%2Fdont_look_up_package/lists"}