question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should the project move away from the 2 package.json structure?

See original GitHub issue

I recently asked a question in electron-rebuild (used by this project as well as electron-builder) and was told by an experienced Electron community member that it’s a bad idea to use the 2 package.json structure with electron-rebuild.

https://github.com/electron/electron-rebuild/issues/253#issuecomment-426833695

I was wondering if you’ve considered moving away from the 2 package.json structure? It seems that since version 8, electron-builder is smarter about how it rebuilds native dependencies…

From https://www.electron.build/tutorials/two-package-structure

Since version 8 electron-builder rebuilds only production dependencies, so, you are not forced to use two package.json structure.

I’m not an expert in this area, but happy to help if this sounds like a good idea.

About my project if it helps understand my context:

  • Based on electron-react-boilerplate
  • Uses the 2 package.json structure
  • Needed to modify ElectronRebuild.js to use electron-rebuild’s --which-module because I need to exclude node-sqlite3 from my electron-rebuild command because I need to build node-sqlite3 from source so that I can use SQLCipher encryption for SQLite.
  • My current ElectronRebuild.js. I use electron-rebuild to rebuild all modules except for node-sqlite3. After rebuilding other modules, I compile node-sqlite3 from source with SQLCipher support.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
HyperSpritecommented, Oct 11, 2018

@vikr01 - I just ran tests with and without jest > moduleDirectories in the package.json and it passes either way.

11:25 $ yarn run test
yarn run v1.9.4
$ cross-env NODE_ENV=test BABEL_DISABLE_CACHE=1 node --trace-warnings -r babel-register ./internals/scripts/RunTests.js
 PASS  test/reducers/counter.spec.js
 PASS  test/actions/counter.spec.js
 PASS  test/components/Counter.spec.js
 PASS  test/containers/CounterPage.spec.js

I can’t run the E2E test right now. I’m still using Spectron in my project and not setup for TestCafe on my box yet.

If that’s all good, I could probably do a PR later today.

1reaction
HyperSpritecommented, Oct 6, 2018

Let me start by saying, I love this project, it let me get going on an Electron app really quickly. I truly appreciate all of the work that has gone into ERB.

TL;DR - I’m going to see if I can migrate to Rollup.

@aguynamedben - yep, umzug fails when built but not in dev or test (using an electron test runner). I’m fairly certain it has to do with path working different when built. I now realize I have been battling this issue for five months in one way or another, writing work arounds, etc to get sqlite/sequelize to work the way I need it to (not that Sequelize makes anything any easier). I thought this was an Electron issue this whole time, something I just had to deal with. Thanks for bringing this topic up, I am pretty much at a dead end at this point.

I’ve been poking around at various ideas for the best way to migrate off of webpack all night (I’m based on ERB v0.13 but made too many changes to continue to merge) but I could probably help backport my work once I’m done since my build portion is mostly the same as v0.15 (except for a adding a markdown loader).

Have you looked at Rollup? Rollup has polyfills for require that seem to be more Electron friendly, from what I can tell. I found this Rollup Electron Boilerplate so it’s possible. This boilerplate build process is so much simpler, I am wondering what is missing as far as building goes. It is also using Sass but there is a rollup-plugin-postcss that can handle css modules. I’m only minimally using the app.global.css for my stuff since I am using inline styles in my app.html and switching to JSS as soon as I load my bundle. I’m going to work on this this weekend, I’ll let you know how it goes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

One project with multiple package.json files - Stack Overflow
Yarn seems to support multiple package. json files but we'd like to avoid migrating from npm if possible.
Read more >
Two package.json Structure - electron-builder
Two package.json Structure ... Since version 8 electron-builder rebuilds only production dependencies, so, you are not forced to use two package.json structure.
Read more >
package.json vs package-lock.json: Major Differences
The package for your project. json is the primary format for configuring and describing how to communicate with and execute your application.
Read more >
package.json - npm Docs
This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a...
Read more >
Document Your Project's package.json File - Atomic Spin
The package.json file is the heart of any Node.js project, but it often goes ... We should be able to go back to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found