{"id":13670963,"url":"https://github.com/sindresorhus/resolve-cwd","last_synced_at":"2025-04-04T22:05:47.924Z","repository":{"id":55409785,"uuid":"47504070","full_name":"sindresorhus/resolve-cwd","owner":"sindresorhus","description":"Resolve the path of a module like `require.resolve()` but from the current working directory","archived":false,"fork":false,"pushed_at":"2021-01-23T18:33:02.000Z","size":11,"stargazers_count":68,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-02T00:04:35.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-12-06T16:19:41.000Z","updated_at":"2024-04-27T06:31:46.000Z","dependencies_parsed_at":"2022-08-14T23:40:56.696Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/resolve-cwd","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fresolve-cwd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fresolve-cwd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fresolve-cwd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fresolve-cwd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/resolve-cwd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"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-08-02T09:00:54.421Z","updated_at":"2025-04-04T22:05:47.907Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate","https://tidelift.com/subscription/pkg/npm-resolve-cwd?utm_source=npm-resolve-cwd\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":["Uncategorized","JavaScript"],"sub_categories":["Uncategorized"],"readme":"# resolve-cwd\n\n\u003e Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory\n\n\n## Install\n\n```\n$ npm install resolve-cwd\n```\n\n\n## Usage\n\n```js\nconst resolveCwd = require('resolve-cwd');\n\nconsole.log(__dirname);\n//=\u003e '/Users/sindresorhus/rainbow'\n\nconsole.log(process.cwd());\n//=\u003e '/Users/sindresorhus/unicorn'\n\nconsole.log(resolveCwd('./foo'));\n//=\u003e '/Users/sindresorhus/unicorn/foo.js'\n```\n\n\n## API\n\n### resolveCwd(moduleId)\n\nLike `require()`, throws when the module can't be found.\n\n### resolveCwd.silent(moduleId)\n\nReturns `undefined` instead of throwing when the module can't be found.\n\n#### moduleId\n\nType: `string`\n\nWhat you would use in `require()`.\n\n\n## Related\n\n- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path\n- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path\n- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory\n- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point\n- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily\n- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module\n\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://tidelift.com/subscription/pkg/npm-resolve-cwd?utm_source=npm-resolve-cwd\u0026utm_medium=referral\u0026utm_campaign=readme\"\u003eGet professional support for this package with a Tidelift subscription\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tTidelift helps make open source sustainable for maintainers while giving companies\u003cbr\u003eassurances about security, maintenance, and licensing for their dependencies.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fresolve-cwd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fresolve-cwd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fresolve-cwd/lists"}