From f9732fc89caa31d4198c77f015af6898cf1b8711 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 7 Dec 2017 12:53:28 -0800 Subject: [PATCH] fix: Change ts-node dependency to peer dependency The DB-Migrate typescript plugin lists ts-node as a sub dependency which causes it to be installed under its own node_modules directory Since node allows multiple versions of the same library to be installed and loaded at the same time, the ts-node installed under the plugin has no access to any dependencies installed in the parent project node_modules directory, even as cwd points to the proper place So compilation fails By moving the dependency to a peer dependency, the ts-node dependency (if not already installed) is installed in the project node_modules directory, and so now has access to all other typescript dependencies Signed-off-by: Daniel --- README.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9273ede..dd56be1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A TypeScript plugin for db-migrate. Usage is very simple. Simply install this plugin via `npm install db-migrate-plugin-typescript` or if using yarn: `yarn add db-migrate-plugin-typescript` +This plugin has a peer dependency on ts-node as well. So you will need to install that as a dependency or dev-dependency as well, `npm install ts-node` or `yarn add ts-node` if using yarn. + The plugin will automatically resolve and compile any `.ts` files in your migrations directory, using your regular `tsconfig.json` diff --git a/package.json b/package.json index c65d33b..af868d8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.1", "description": "A db-migrate plugin to enable TypeScript style migrations.", "main": "index.js", - "dependencies": { + "peerDependencies": { "ts-node": "^3.3.0" }, "devDependencies": {},