Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folders that are not NPM modules but have package.json files are unintentionally pruned #845

Closed
inukshuk opened this issue May 16, 2018 · 3 comments
Labels

Comments

@inukshuk
Copy link
Contributor

inukshuk commented May 16, 2018

As discussed in #844 I've noticed at least one case where a folder (containing a package.json file and nothing else) in a dependency is filtered when packaging an app with the prune option.

Here is a minimal test case:

$ mkdir tmp
$ cd tmp
$ npm init
$ npm i electron electron-packager --save-dev
$ npm i redux-saga
$ $(npm bin)/electron-packager . test --platform=linux

And then:

$ ls -l node_modules/redux-saga/effects/package.json
$ ls -l test-linux-x64/resources/app/node_modules/redux-saga/

And note that the effects folder is missing.

EDIT:

I should add that this does not happen in 11.x.

@welcome
Copy link

welcome bot commented May 16, 2018

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@malept
Copy link
Member

malept commented May 16, 2018

It's because of this line:

https://github.com/electron-userland/electron-packager/blob/b3c610cd13de72b9b0f22b72c99fb73aa5b53bdb/prune.js#L61

That line needs to be changed so that the check basename(dirname(pathToCheck)) == 'node_modules' is added, along with a regression test.

@malept malept changed the title Losing parttial dependency while pruning in 12.x Folders that are not NPM modules but have package.json files are unintentionally pruned May 16, 2018
malept added a commit that referenced this issue May 18, 2018
@malept
Copy link
Member

malept commented May 18, 2018

Fix in #847.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants