-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Ship yarn with hyper #381
Ship yarn with hyper #381
Conversation
That's really sweet. I wonder how much bigger it makes our compressed builds / startup time ? |
Keep this in mind. |
It doesn't mater as you embed npm, and have can fix working version if you need. Spawning a new process simply doesn't work because there's no node installed in electron app.. |
I would love for @othiym23 to re-visit that decision. It's kind of a bummer that we need to ask the user to install node to use |
You can. Just spawn childProcess.execSync(process.execPath, ['npm', 'install'], {env: {ELECTRON_RUN_AS_NODE: true}}); |
I tried to implement it as @sindresorhus proposed, but for some reason electron refuses to exit when running npm with it. Here's how to reproduce: export CWD=$(pwd) && (cd ~/.hyperterm_plugins && ELECTRON_RUN_AS_NODE=1 $CWD/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron $CWD/node_modules/.bin/npm install --verbose) For now it's blocking me, so any help would be appreciated.. |
e16afd8
to
e436b9c
Compare
@sheerun seems like something we should be reporting to the electron team. This is looking very good btw, thanks @sindresorhus |
@sheerun I'd love to merge this. Do you have any news about whether the issue with exiting was fixed? Or any workarounds? |
The issue to fix is here: electron/electron#4944 With newest electron it kinda works, but takes 30 seconds to exit. The best I can do is to rebase, catch. |
6ccb764
to
90b5303
Compare
@leo @rauchg I've replaced npm with yarn and it runs like wonder. It's good to merge. There's issue with CI build as |
@sheerun |
@matheuss Is |
Anyway, I fixed the issue with build. Ready for review and merge.. |
@matheuss This is no longer in-progress. This is done. |
@sheerun thanks for the ping 😄
Nope, you need to move it to the other one 👌 Could you please rebase to fix the merge conflicts? I'll make sure to discuss it with the team 👌 |
This is fantastic! On Sun, Nov 20, 2016 at 5:09 PM Adam Stankiewicz notifications@github.com
|
It is finished! It only needs some testing on Windows/Linux! But I'm struggling with Win10 installation on BootCamp 😞 |
the app/bin/yarn-standalone.js should be built in the but ok for now, i can PR that |
Why? I consider |
Problem with production build on Windows solved (bad Need a test on Linux |
Tested. Ready to be merged |
app/plugins.js
Outdated
|
||
cp.exec(fullcmd, { | ||
cwd: path, | ||
env, |
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.
What happend when isDev === true
since you are forcing env
to be production
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.
This production flag is for yarn
. See https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production
No side effect to Hyper.
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.
ok!
app/plugins.js
Outdated
cwd: path, | ||
env, | ||
shell: true, | ||
timeout: 1000 * 60 * 5, |
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.
add comment for // 5min
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.
ms('5m')
will be better. Thank you to have pointed this
app/plugins.js
Outdated
} | ||
function yarn(args, cb) { | ||
spawnQueue.push(end => { | ||
const fullcmd = [process.execPath, yarnPath].concat(args).join(' '); |
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.
fullcmd
? Simply use cmd
or command
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 will
app/plugins.js
Outdated
@@ -228,46 +223,47 @@ function toDependencies(plugins) { | |||
} | |||
|
|||
function install(fn) { | |||
const {shell: cfgShell, npmRegistry} = exports.getDecoratedConfig(); | |||
const yarnPath = resolve(__dirname, '..', 'bin', 'yarn-standalone.js'); |
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.
yarnPath
is not used elsewhere then inside yarn
function. Better to move it inside function scope.
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 will move it (env
const too)
app/plugins.js
Outdated
timeout: 1000 * 60 * 5, | ||
stdio: ['ignore', 'ignore', 'inherit'] | ||
}, err => { | ||
console.log('Done!'); |
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.
Be more specific. What is Done!
? Plugins installation? Plugins update?
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.
We don't need this log.
const shellEnv = require('shell-env'); | ||
const queue = require('queue'); | ||
|
||
const spawnQueue = queue({concurrency: 1}); |
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.
spawnQueue
or yarnQueue
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.
spawnQueue
is better.
We should test plugins update too. |
Plugins update is ok! |
For me it first errors that it can't load the new plugin, then the plugin "update" kicks in, which then installs the new plugin and then everything is fine. I just think that first error should be something we should avoid. |
@Stanzilla this error is currently shown without my PR. |
FTR: |
This is a step towards #282 and makes sure hyperterm always
installs with the same npm version it shipped with.
It also drops dependency on system's node.