{"id":15673723,"url":"https://github.com/jaydenseric/install-from","last_synced_at":"2025-05-06T22:43:42.009Z","repository":{"id":57274850,"uuid":"215967662","full_name":"jaydenseric/install-from","owner":"jaydenseric","description":"Reliably installs a local package into another, for testing.","archived":false,"fork":false,"pushed_at":"2021-05-28T08:48:54.000Z","size":46,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-02T05:19:32.496Z","etag":null,"topics":["esm","mjs","node","npm","npx"],"latest_commit_sha":null,"homepage":"https://npm.im/install-from","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaydenseric.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"jaydenseric"}},"created_at":"2019-10-18T07:38:15.000Z","updated_at":"2022-05-24T18:22:29.000Z","dependencies_parsed_at":"2022-09-18T03:31:59.140Z","dependency_job_id":null,"html_url":"https://github.com/jaydenseric/install-from","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Finstall-from","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Finstall-from/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Finstall-from/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Finstall-from/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaydenseric","download_url":"https://codeload.github.com/jaydenseric/install-from/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782441,"owners_count":21803378,"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":["esm","mjs","node","npm","npx"],"created_at":"2024-10-03T15:41:51.346Z","updated_at":"2025-05-06T22:43:41.969Z","avatar_url":"https://github.com/jaydenseric.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jaydenseric"],"categories":[],"sub_categories":[],"readme":"# install-from\n\n[![npm version](https://badgen.net/npm/v/install-from)](https://npm.im/install-from) [![CI status](https://github.com/jaydenseric/install-from/workflows/CI/badge.svg)](https://github.com/jaydenseric/install-from/actions)\n\nReliably installs a local package into another, for testing.\n\nIt’s very similar to installing a published package; [`npm pack`](https://docs.npmjs.com/cli/v7/commands/npm-pack) is used to generate a tarball that only includes published files, which are extracted into `node_modules` for a similar result to a regular [`npm install --no-save`](https://docs.npmjs.com/cli/v7/commands/npm-install).\n\n[`npm link`](https://docs.npmjs.com/cli/v7/commands/npm-link) is a notoriously unreliable way to locally test a package in another package, as it uses symlinks:\n\n- It will not reveal if the [`package.json` `files` field](https://docs.npmjs.com/files/package.json#files) or [`.npmignore`](https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package) is correct, as [`npm link`](https://docs.npmjs.com/cli/v7/commands/npm-link) doesn’t use [`npm pack`](https://docs.npmjs.com/cli/v7/commands/npm-pack) like [`npm publish`](https://docs.npmjs.com/cli/v7/commands/npm-publish) does.\n- As the package being tested is not actually installed inside the `node_modules` of the package it’s being tested in, peer dependencies installed in the host package can’t be reached. For example, this makes it difficult to test a package that has a [`react`](https://npm.im/react) peer dependency inside a [Next.js](https://nextjs.org) project.\n- How it works is not intuitive. It messes with the global `node_modules` and `bin` directories, and you have to remember to use `npm unlink` to tidy up, which inconveniently strips the dependency from your `package.json`.\n\n## Setup\n\nInstallation isn’t required to use the [CLI](#cli) command [`install-from`](#command-install-from) with [`npx`](https://docs.npmjs.com/cli/v7/commands/npx).\n\nTo install with [npm](https://npmjs.com/get-npm), run:\n\n```sh\nnpm install install-from --save-dev\n```\n\nThen, use either the [CLI](#cli) command [`install-from`](#command-install-from) or the JS [API](#api) function [`installFrom`](#function-installfrom).\n\n## CLI\n\n### Command `install-from`\n\nReliably installs a local package into another at the [CWD](https://en.wikipedia.org/wiki/Working_directory), for testing.\n\n#### Arguments\n\n| Argument | Description |\n| :-- | :-- |\n| 1 | Absolute or [CWD](https://en.wikipedia.org/wiki/Working_directory) relative filesystem path to the package to install from. |\n\n#### Examples\n\n_Installing a local package into another using [`npx`](https://docs.npmjs.com/cli/v7/commands/npx)._\n\n\u003e In a terminal, change to the directory of the package you want to test another package in:\n\u003e\n\u003e ```sh\n\u003e cd ~/Repos/foo\n\u003e ```\n\u003e\n\u003e Then, install the desired local package:\n\u003e\n\u003e ```sh\n\u003e npx install-from ~/Repos/bar\n\u003e ```\n\n## API\n\n### function installFrom\n\nReliably installs a local package into another, for testing.\n\n| Parameter | Type | Description |\n| :-- | :-- | :-- |\n| `pathPackageFrom` | string | Absolute or [CWD](https://en.wikipedia.org/wiki/Working_directory) relative filesystem path to the package to install from. |\n| `pathPackageTo` | string? | Absolute or [CWD](https://en.wikipedia.org/wiki/Working_directory) relative filesystem path to the package to install to, defaulting to `process.cwd()`. |\n\n**Returns:** Promise\\\u003cvoid\u003e — Resolves once installation is complete.\n\n#### Examples\n\n_How to `import`._\n\n\u003e ```js\n\u003e import installFrom from 'install-from';\n\u003e ```\n\n_Installing a local package into another._\n\n\u003e ```js\n\u003e installFrom(\n\u003e   './packages/package-to-install-from',\n\u003e   './packages/package-to-install-to'\n\u003e )\n\u003e   .then(() =\u003e {\n\u003e     // …\n\u003e   })\n\u003e   .catch(() =\u003e {\n\u003e     // …\n\u003e   });\n\u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Finstall-from","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaydenseric%2Finstall-from","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Finstall-from/lists"}