{"id":13798474,"url":"https://github.com/sindresorhus/import-local","last_synced_at":"2025-04-11T22:29:24.994Z","repository":{"id":45133257,"uuid":"90292430","full_name":"sindresorhus/import-local","owner":"sindresorhus","description":"Let a globally installed package use a locally installed version of itself if available","archived":false,"fork":false,"pushed_at":"2024-07-22T10:56:51.000Z","size":92,"stargazers_count":154,"open_issues_count":2,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-14T22:58:27.682Z","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":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2017-05-04T17:49:22.000Z","updated_at":"2025-01-07T20:11:28.000Z","dependencies_parsed_at":"2024-11-05T23:43:46.192Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/import-local","commit_stats":{"total_commits":30,"total_committers":9,"mean_commits":"3.3333333333333335","dds":0.2666666666666667,"last_synced_commit":"ff3fb1541a40b629a22d2d21a4e1cf4605c6bb5a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fimport-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fimport-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fimport-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fimport-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/import-local/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243848689,"owners_count":20357611,"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-04T00:00:44.506Z","updated_at":"2025-03-21T04:06:53.698Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Packages","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# import-local\n\n\u003e Let a globally installed package use a locally installed version of itself if available\n\nUseful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, [AVA](https://avajs.dev) and [XO](https://github.com/xojs/xo) uses this method.\n\n## Install\n\n```sh\nnpm install import-local\n```\n\n## Usage\n\n```js\nimport importLocal from 'import-local';\n\nif (importLocal(import.meta.url)) {\n\tconsole.log('Using local version of this package');\n} else {\n\t// Code for both global and local version here…\n}\n```\n\nYou can also pass in `__filename` when used in a CommonJS context.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fimport-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fimport-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fimport-local/lists"}