{"id":16292477,"url":"https://github.com/exogen/npm-extends","last_synced_at":"2025-08-31T14:41:03.806Z","repository":{"id":66194748,"uuid":"145066838","full_name":"exogen/npm-extends","owner":"exogen","description":"Don’t use this.","archived":false,"fork":false,"pushed_at":"2018-08-17T03:49:30.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T11:15:42.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/exogen.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},"funding":{"github":"exogen","buy_me_a_coffee":"mosswood"}},"created_at":"2018-08-17T03:23:37.000Z","updated_at":"2020-10-28T10:36:59.000Z","dependencies_parsed_at":"2023-05-23T00:00:31.324Z","dependency_job_id":null,"html_url":"https://github.com/exogen/npm-extends","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.07692307692307687,"last_synced_commit":"5aa82a6d3a32a96682308bebdbe830e820289d12"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exogen%2Fnpm-extends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exogen%2Fnpm-extends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exogen%2Fnpm-extends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exogen%2Fnpm-extends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exogen","download_url":"https://codeload.github.com/exogen/npm-extends/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008616,"owners_count":21032554,"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-10-10T20:07:00.160Z","updated_at":"2025-04-09T08:47:07.418Z","avatar_url":"https://github.com/exogen.png","language":"JavaScript","funding_links":["https://github.com/sponsors/exogen","https://buymeacoffee.com/mosswood"],"categories":[],"sub_categories":[],"readme":"# npm-extends 😈\n\n## What?\n\nThis abuses npm’s `onload-script` option, which can be set on a per-project\nbasis, to poison the `require.cache` entry for npm’s `run-script` command with a\ncooler version that runs a custom CLI of your choosing if the specified script\nisn’t in `package.json`.\n\n## Should I use this?\n\nNo.\n\n## But how would I use it, in theory?\n\nInstall `npm-extends` in your project, then add an `.npmrc` file to your project\nwith this line:\n\n```\nonload-script=\"${PWD}/node_modules/npm-extends\"\n```\n\n(Yes, unfortunately this will not work when you run `npm` from directories below\nyour `package.json`. You could probably make it work by installing `npm-extends`\nglobally.)\n\nAdd an `npm:extends` script to `scripts` in your `package.json` file that runs\nthe command you’d like to use instead of `npm run` when a script isn’t found.\nIt will be passed the script name and arguments.\n\n```json\n{\n  \"scripts\": {\n    \"npm:extends\": \"your-cli\",\n    \"boring-script\": \"echo This is boring!\"\n  }\n}\n```\n\nNow you can run scripts that aren’t in there, but are supported by your tool!\n\n```console\n$ npm run boring-script\n\n\u003e echo BooOoOOOriing\n\nBooOoOOOriing\n\n$ npm run cool-script\n\n\u003e your-cli \"cool-script\"\n\nWaaAAaay cooler!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexogen%2Fnpm-extends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexogen%2Fnpm-extends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexogen%2Fnpm-extends/lists"}