bitovi / bitovi/engine-dependencies

Specifying the module name for your package doesn't work.

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The issue is that specifying the project name in the post-install script doesn't properly load the package.json for that project.

Not specifying an module name will load the project from the current working directory [see code](https://github.com/bitovi/engine-dependencies/blob/master/bin/install-engine-dependencies#L11) but you never correctly handle the load when the module name is specified.

By the time [this code](https://github.com/bitovi/engine-dependencies/blob/master/engine-dependencies.js#L36) is executed, the findWhere function is trying to call Object.keys on a string, throwing an error. The 'engineDependencies' object is not processed.

My package.json:

```
{
"name": "my-test",
"version": "0.0.0",
"description": "testing dependency needs",
"engineDependencies": {
"node": {
"4.2.x": {
"lodash": "4.0.1"
},
"0.10.x": {
"lodash": "3.10.1"
}
}
},
"dependencies": {
"async": "*"
},
"devDependencies": {
"grunt": "*"
},
"scripts": {
"postinstall": "install-engine-dependencies 'my-test'"
}
```

Executing:

> npm install my-test

doesn't install the correct version of lodash because it errors out.

As mentioned above, doing the following will work

```
"scripts": {
"postinstall": "./node_modules/engine-dependencies/bin/install-engine-dependencies"
}
```

due to [this block](https://github.com/bitovi/engine-dependencies/blob/master/bin/install-engine-dependencies#L11) executing.

EDIT: specify "postinstall" instead of "post-install" in package.json

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.