-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Improved yarn support #289
Improved yarn support #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very much like this! One quibble, though...
lib/tasks/assemble.js
Outdated
@@ -1,7 +1,8 @@ | |||
'use strict'; | |||
|
|||
const chalk = require('chalk'); | |||
const install = require('rsvp').denodeify(require('npmi')); | |||
const pruner = require('rsvp').denodeify(require('electron-packager/prune').pruneModules); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is really a public API, so I'm kinda uncomfortable using it like this. My preference would be to copy the code that we need into this project, but failing that, at the very least list electron-packager
as one of our dependencies, rather than just implicitly relying on electron-forge
to make it available to us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very fair, I felt uncomfortable doing it as well. Wanted to show intent and happy to make any changes.
lib/tasks/assemble.js
Outdated
@@ -1,7 +1,8 @@ | |||
'use strict'; | |||
|
|||
const chalk = require('chalk'); | |||
const install = require('rsvp').denodeify(require('npmi')); | |||
const pruner = require('rsvp').denodeify(require('electron-packager/prune').pruneModules); | |||
const { hasYarn } = require('electron-forge/dist/util/yarn-or-npm'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think maybe here we should just use the yarn-or-npm
package directly, rather than using a private API in electron-forge
. AFAIK electron-forge
only wraps it so it can introduce an environment variable-based override for its automated testing. We don't currently need that, and if we did, I'd rather have our own implementation so we don't break if electron-forge
changes how they do it.
27096e3
to
b8d4dfa
Compare
This should be good to go. |
b8d4dfa
to
af6d8b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me -- @felixrieseberg if you're happy with it, merge away!
Hey! I have one last comment: I want this to work with Yarn as much as possible, but I don't want yarn to be the default runner. Electron is cool (and better than a PWA) because you can use it with native code. Native modules and Yarn still aren't friends (yarnpkg/yarn#756), so until that is the case, I'd like to stick with npm. As it is right now, the |
Remove yarn dependency Convert npm scripts to yarn Remove yarn.lock Add rejection values to workaround RSVP bug
af6d8b6
to
9d7e9b8
Compare
@felixrieseberg Is this what you had in mind? |
Great, bank you! |
New project setup:
ember new ee-test --yarn
cd ee-test/
ember install ember-electron
ember electron:package
Initial workaround:
rm -rf node_modules
yarn upgrade
But I want electron-packager to use yarn!
sed -i '' 's/\"electronPackagerConfig\": {}/\"electronPackagerConfig\": { \"packageManager\": \"yarn\" }/' ember-electron/electron-forge-config.js
ember electron:package
There are a handful of intertwined issues here.