-
Notifications
You must be signed in to change notification settings - Fork 154
Conversation
…into windows-support modified: scripts/start.js modified: src/middlewares/task.middleware.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.
Yayy, thanks so much for commandeering this @AWolf81! Hope this is ok @bennygenel, but it's important that we get this merged soon :)
I'll give this a full review soon, but one quick thing I noticed: When running Guppy on a Mac, I get this issue:
Ahhh, the issue is Looks like we'd need to make sure it starts with |
// For Windows Support | ||
// Windows tries to run command as a script rather than on a cmd | ||
// To force it we add *.cmd to the commands | ||
const command = isWin ? 'npx.cmd' : 'npx'; |
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.
Line 147 requires a function call as well. isWin()
. I'll add it.
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.
Changed this to formatCommandForPlatform
.
I've tested the branch with Ubuntu and noticed the following issues:
Working:
Unit tests: Summary: @patcito I saw that you tested Ubuntu before. Could you please checkout the |
0642c0a
to
4f877d5
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.
Great job, everybody. This passes a basic test suite across Windows/Mac/Linux, I think it's ready to ship.
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.
The caching looks good.
There is one more thing: the capitalisation of labels is different on Windows than on MacOS:
- Button Label on Mac
- Button label on windows
It’s a detail and maybe we don’t care, just wanted to point it out
@mathieudutour which button labels are you referring to? |
That was just an example. Every buttons, label and menu item follow this rule |
They all look the same cross-platform to me - View Details, File > Create New Project, File > Import Existing Project, Add To Project... EDIT - What version of Windows are you using? I'm using Windows 10. |
I'm not using windows but this issue is a pretty big deal over at desktop/desktop (one commit for example: desktop/desktop@eb806bd) |
Ahhh, I misunderstood. I'll correct those and add in a couple accelerators. |
src/middlewares/task.middleware.js
Outdated
env: { | ||
...window.process.env, | ||
}, | ||
env: getBaseProjectEnvironment(projectPath), |
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.
@superhawk610 I think it's OK to add the path to ./node_modules/.bin
here but I think that shouldn't be needed. Maybe we can check this later and leave this for now.
It should be enough to have cwd
as it is like cd
to project directory and run yarn
inside that folder. Then yarn will look into ./node_modules/
for the file to execute and if is not finding the file to executable it will look if it's globally available.
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.
Without explicitly providing the .bin
path, I get some form of this error on Windows:
$ react-scripts test --env=jsdom --coverage
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
Task completed
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It may be a Git Bash-specific issue.
package.json
Outdated
@@ -39,6 +39,7 @@ | |||
"electron-store": "2.0.0", | |||
"fix-path": "2.1.0", | |||
"gatsby-cli": "1.1.58", | |||
"ps-tree": "^1.1.0", |
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.
Please remove caret to pin the version.
src/middlewares/task.middleware.js
Outdated
// Child node processes will persist after their parent's death | ||
// if they are not killed first, so we need to use `psTree` to build | ||
// a tree of children and kill them that way. | ||
psTree(processId, (err, children) => { |
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.
@superhawk610 Thanks for re-adding this and for adding the comment. I wasn't aware of this.
Can you please check main.js
process killing and add child killing there as well?
The task killing during app run is working (tested with Win & Ubunutu). But the task killing doesn't work if the app is closed with a running dev server. PID still active - just tested with Ubuntu.
src/services/platform.services.js
Outdated
.replace('%USERPROFILE%\\', '') | ||
.replace(/\s/g, ''); | ||
} | ||
export const windowsHomeDir = isWin ? path.join(os.homedir(), winDocPath) : ''; |
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 great. Thanks.
src/main.js
Outdated
); | ||
|
||
return Promise.all(processKillingPromises).catch(err => { | ||
try { |
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.
@superhawk610 Is this OK? I think the child killing first is needed here for Linux/Mac. Also it looks like there is no Windows version in killProccessId(processId)
.
What do you think should we add killProcess
to platform.service
? I think this would be useful so we can use it on app exit and for task killing on dev server close.
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.
Great catch, I'm new to Electron so I just figured addProcessId
and removeProcessId
were internal Electron calls, I didn't realize we implemented them.
Yeah, we should probably move this to platform.service
to avoid duplicating the implementation in main.js
and task.middleware
. I'll take this.
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.
Moved it into services/kill-process-id.service.js
and avoided ES6 modules syntax so it can be loaded both server- and client-side.
- consolidate import statements in task middleware - pin ps-tree version in package.json
label: 'Import Existing Project', | ||
label: __DARWIN__ | ||
? 'Import Existing Project...' | ||
: '&Import existing project...', | ||
click: showImportExistingProjectPrompt, | ||
accelerator: process.platform === 'darwin' ? 'Cmd+I' : 'Ctrl+I', |
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.
Nit - I think line 40 & 47 should also use the __DARWIN__
constant.
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.
@mathieudutour actually already fixes this in #127, I figured there was no reason to add it here since we can just merge it with that PR.
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.
ah, OK, you're right. I missed that.
- add disclaimer to kill-process-id service (avoid ES6)
- display Electron output in webpack console
React Rally is apparently a priority for people 😁 Seriously good luck with your talk!
- dont exit process on Electron errors
commit f01d78d Author: Mathieu Dutour <mat.dutour@gmail.com> Date: Sat Aug 18 15:49:12 2018 -0500 defaultParentPath is a constant (#134) commit 37ae6c8 Author: Abhijeet Prasad <AbhiPrasad@users.noreply.github.com> Date: Sat Aug 18 07:23:13 2018 -0700 Add tests for projects reducer (#84) * Add tests for projects reducer * Revert whitespace change to projects.reducer.js commit 425c7d4 Author: Mathieu Dutour <mat.dutour@gmail.com> Date: Thu Aug 16 12:01:44 2018 -0500 ESLint config (#128) * add eslint config * add lint script and run eslint on precommit * fix lint errors commit 8bbb281 Author: Aaron Ross <superhawk610@gmail.com> Date: Thu Aug 16 12:59:07 2018 -0400 use correct package script for release build (#133) commit 9f0abef Author: Mathieu Dutour <mat.dutour@gmail.com> Date: Thu Aug 16 11:58:32 2018 -0500 add menu item to report an issue (#127) commit efc6f57 Author: Alexander Wolf <AWolf2904@gmail.com> Date: Thu Aug 16 18:33:52 2018 +0200 Windows support (#125) - `.cmd` formatting for Windows - modify `findAvailablePort` to work on all platforms - use `%HOME%/Documents/guppy-projects` for default Windows projects directory - changed package manager from NPM to yarn - add `cross-env` to allow package scripts to work on all platforms - move app-wide settings into `src/config/app.js` - change spawn process to use promises - stub `electron.remote` for headless testing - add `yarn` as local dependency to allow usage without global installation - forward host environment to Electron process - properly kill all spawned processes on app quit, cross-platform - exit main process when Electron application quits during development commit 566a392 Author: Joshua Comeau <joshwcomeau@gmail.com> Date: Wed Aug 15 15:02:21 2018 -0400 Remove unused components (#132) commit f61802e Author: Mathieu Dutour <mat.dutour@gmail.com> Date: Tue Aug 14 06:30:25 2018 -0600 add react-devtools when developping (#123) * add react-devtools when developping * pin the dependencies * add comment about what is the id * load chrome extension on prod * move dependencies so that they are bundled in the app commit 71435a7 Author: Mathieu Dutour <mat.dutour@gmail.com> Date: Mon Aug 13 07:30:02 2018 -0600 setup proper target for webpack and use import everywhere (#126) * setup proper target for webpack and use import * fix externals config commit cae946e Author: Josh Comeau <joshwcomeau@gmail.com> Date: Sun Aug 12 11:54:22 2018 -0400 Fix CircularOutline gradient on non-Chrome browsers commit 9831349 Author: Melanie Seltzer <melleh11@gmail.com> Date: Fri Aug 3 05:25:38 2018 -0700 Dependencies explanation doc (#116) * Add understanding dependency markdown doc * Move HelpButton to own file for re-use, link out to new dependency info doc * Package.json info doc first pass * Update package.json doc per PR review commit 2c4120b Author: Joshua Comeau <joshwcomeau@gmail.com> Date: Thu Aug 2 08:55:55 2018 -0400 Add 'reason' to PixelShifter (#118)
Related Issue: #27
Related PR: #63
Summary:
Created a new PR based on @bennygenel
windows-support
branch and mynpm-to-yarn
branch. I couldn't change the target of the other pull-request. @bennygenel I hope this is OK that I've created it. Your PR is OK but wasn't at the right base. Also my PR to your fork is not needed anymore - I'll check if I can close it with-out merging.So I created a new branch and merged both branches. Now we're able to merge easily.
Please review & test with Mac and Linux. I could also do the Linux review in a virtual machine if there is no dev. with Linux.
Review infos:
Windows support
branch: Review pretty much covered in the other PR. The following changes were added:cross-env
for env. handling at execution.cmd
formattingfindAvailablePorts
npm-to-yarn
branch: Not reviewed yet.yarn
as project dependency.src/config/app.js
(needs to be discussed - my thoughts see below)Some thoughts:
Application-wide configuration: There is no place where we can add not user changable app configuration. That's why I addeed it here. We could also add Agolia API keys here and move them from
src/constants
. Later we could also enable / disable debug logs with this file.Spawn process method: I need to check if it makes sense to move this method to a service or we could replace it with child-process-promise to have promises for spawn. I think it is OK to keep the method like it is - maybe moving to a service makes sense if spawn process is used at many location.
Issues:
babel-loader
is missing. Babel-loader is not available in the dependencies list but it is in thepackage.json
file. I have to check what happens during eject & why this dependency is missing. But I think that's probably not Windows related and we could fix this later - only if there is no quick fix.