Skip to content

Commit

Permalink
fix: Change ts-node dependency to peer dependency
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
DanielJoyce authored and Daniel Joyce committed Dec 7, 2017
1 parent 715efe7 commit f9732fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down

0 comments on commit f9732fc

Please sign in to comment.