-
Notifications
You must be signed in to change notification settings - Fork 40
WIP: Relates to #81. Update to Electron v3.1.0 #90
Conversation
* Update to Electron v3.1.0 - https://github.com/electron/electron/releases * Update Readme * Update dependencies versions * Add .nvmrc
Otherwise when try to use the package from a remote branch such as ``` "@parity/electron": "https://github.com/paritytech/js-libs.git#luke-81-electron-3", ``` Then it produces error: ``` error Can't add "@parity/electron": invalid package version undefined. ```
When I add this to the fether-electron package.json dependency with: ``` "@parity/electron": "https://github.com/paritytech/js-libs.git#luke-81-electron-3", ``` And then try to run `yarn; yarn build;`, it gives the following error: ``` scon @ ~/code/src/paritytech/fether - [luke-309-electron-3] $ yarn; yarn build yarn install v1.12.3 [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... [3/5] 🚚 Fetching packages... [4/5] 🔗 Linking dependencies... warning " > [email protected]" has unmet peer dependency "eslint@>= 4.12.1". warning " > [email protected]" has unmet peer dependency "prop-types@^15.6.1". warning " > [email protected]" has unmet peer dependency "react@^16.4.0". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > @parity/[email protected]" has incorrect peer dependency "rxjs@~6.2.2". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > @parity/[email protected]" has incorrect peer dependency "rxjs@~6.2.2". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > [email protected]" has unmet peer dependency "prop-types@^15.6.0". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > [email protected]" has unmet peer dependency "prop-types@^15.6.0". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-ui > [email protected]" has unmet peer dependency "react-dom@>=0.14.0 <= 16". warning "workspace-aggregator-cc67e372-3487-4efc-8fcb-a403fb15962c > fether-react > @babel/plugin-proposal-decorators > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0". [5/5] 📃 Building fresh packages... [1/2] ⠄ @parity/electron error /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron: Command failed. Exit code: 1 Command: yarn build Arguments: Directory: /Users/scon/code/src/paritytech/fether/node_modules/@parity/electron Output: yarn run v1.12.3 $ lerna exec yarn build --stream lerna notice cli v3.10.1 lerna info Executing command in 6 packages: "yarn build" @parity/abi: $ rimraf lib @parity/electron: $ rimraf lib @parity/abi: $ tsc @parity/abi: /bin/sh: tsc: command not found @parity/electron: $ tsc @parity/abi: error Command failed with exit code 127. @parity/abi: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. @parity/electron: /bin/sh: tsc: command not found lerna ERR! yarn build exited 1 in '@parity/abi' lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this 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.
Thanks luke! Though I have questions.
Also, you added the help wanted label, do you have some questions?
.nvmrc
Outdated
@@ -0,0 +1 @@ | |||
10.11.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.
Why is this needed actually? Is there a package we use that require at least this version of node? Is it redundant with what you added in package.json?
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.
In the Electron Release Notes for v4.0.0 it says:
Bumped minimum supported macOS version to 10.10.
And on this page they mention no more support for 10.9 in Electron v4 https://electronjs.org/blog/electron-4-0#no-more-macos-109-support
So I've assumed that v3.1.0 would have the same requirement. However the release notes for v4.0.1 or v3.1.0 don't mention a minimum version requirement https://github.com/electron/electron/releases
We could change it to 10.10.0
instead
README.md
Outdated
#### Tests | ||
|
||
``` | ||
export NPM_TOKEN=''; yarn test |
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.
No need for export NPM_TOKEN='';
. Can you confirm @ltfschoen?
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.
Yes confirmed. It is no longer required
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 just created another issue. It looks like this issue came back again
README.md
Outdated
#### Build | ||
|
||
``` | ||
export NPM_TOKEN=''; yarn build |
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.
No need for export NPM_TOKEN='';
README.md
Outdated
5. Run tests, linting, and build | ||
|
||
``` | ||
export NPM_TOKEN=''; yarn test; yarn lint; yarn build |
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.
No need for export NPM_TOKEN='';
@@ -1,6 +1,7 @@ | |||
{ | |||
"name": "js-libs", | |||
"description": "A collection of JavaScript libraries for dapp development.", | |||
"version": "v3.0.26", |
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.
No need to have version on the root package.json, see for example babel
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.
If I pushed my changes in this branch 'luke-81-electron-3' of js-libs repo without a version number in its package.json, then when I tried to test using this remote branch in a branch of Fether 'luke-309-electron-3' on this line of code https://github.com/paritytech/fether/pull/349/files#diff-52ba44750a2113719866b7d98b31af30R42 "@parity/electron": "https://github.com/paritytech/js-libs.git#luke-81-electron-3",
, I found that when I tried to build Fether with yarn; yarn start
it would give me an error that it required a version number in the package.json file
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.
It produced the following:
error Can't add "@parity/electron": invalid package version undefined.
In the details of the commit message I included the full log 8b347e0
@@ -17,11 +17,12 @@ | |||
"scripts": { | |||
"docs": "typedoc", | |||
"prebuild": "rimraf lib", | |||
"build": "tsc", | |||
"build": "yarn && ./node_modules/.bin/tsc", |
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.
On my machine there's no need for this addition. Did you get an error?
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.
Yes, I was getting the following errors:
@parity/abi: /bin/sh: tsc: command not found
@parity/electron: /bin/sh: tsc: command not found
In the details of the commit message I included the full log 73c2042
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.
These errors are in the fether, right? If yes, then see my comment about removing step 7
packages/electron/package.json
Outdated
}, | ||
"devDependencies": { | ||
"@types/async-retry": "^1.2.1", | ||
"@types/checksum": "^0.1.30", | ||
"electron": "^2.0.2" | ||
"electron": "^3.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.
I want this package to be available for all electron versions. The only weak link is electron-dl
, which I am not 100% sure is compatible with Electron 3-4, but let's assume yes until proven wrong (and do some testing on Fether). All other packages are only nodejs.
So replace with "^2.0.2 | ^3.1.0 | ^4.0.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.
If I also update Fether's fether-electron package's package.json with:
"devDependencies": {
...
"electron": "^2.0.2 | ^3.1.0 | ^4.0.1",
Then when I run yarn; yarn start
it prompts me to choose the version, but it shows versions prior as well like 1.x.x
? Please choose a version of "electron" from this list: (Use arrow keys)
❯ 4.0.1
4.0.0
4.0.0-nightly.20181010
...
4.0.0-beta.1
3.1.0
3.1.0-beta.5
...
3.0.4
(Move up and down to reveal more choices)
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.
In js-libs, we put "^2.0.2 | ^3.1.0 | ^4.0.1", which means "this library supports these versions of Electron."
In Fether, we choose one specific version of Electron (4.0.1). So in fether it should only be "^4.0.1"
packages/electron/package.json
Outdated
}, | ||
"peerDependencies": { | ||
"electron": "^2.0.3" | ||
"electron": "^3.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.
"^2.0.2 | ^3.1.0 | ^4.0.1"
README.md
Outdated
3. Check outdated dependencies | ||
|
||
``` | ||
npm outdated |
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.
yarn outdated
README.md
Outdated
npm outdated | ||
``` | ||
|
||
4. Create a branch and update any dependencies that it indicates are out of date. |
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'd prefer that it'd be us who update dependencies. They sometimes make things break. Or even better: implement #28.
|
||
6. Push the branch to your fork of the repo | ||
|
||
7. Integrate the updated library as a dependency. Example: If you are using the 'electron' package in another project, then update the package.json file to temporarily use your branch instead of the public NPM registry version |
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.
@ltfschoen I understand now where your errors come from. I would like to remove this step 7: For @parity/*
packages, I would advise against doing yarn add github:something
into your own project.
The reason is:
- right now we develop in
src/
in js-libs - the CI builds, outputs in
lib/
, and pusheslib/
to npm - when you
yarn add @parity/*
it downloadslib/
from npm into node_modules, and the main file islib/index.js
However, when you yarn add github:something
, it does:
- clone the repo into node_modules
- run yarn build inside the cloned folder
- hopefully, if the build doesn't error, it generates a
lib/
folder
Jaco and I used to try to do this method above, however there's always some troubles here and there in the "hopefully" step. That's why I prefer to remove it. Some alternative solutions:
- (ideal solution) wait for the npm package to be published. If you need to test a package, it's better to add a test directly in this repo, so that the test is self-contained.
- use npm link
- do the copy/paste dance:
# in js-libs/
yarn build
cp -r packages/my-package/lib ../fether/node_modules/@parity/my-package/lib
# in fether
yarn start
@@ -0,0 +1 @@ | |||
10.10.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.
My questions are:
- If your nvm has v11, does it change to v10.10.0? (not necessary)
- Is it enough to only put
"engine"
in package.json?
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.
You're right. I'll remove the .nvmrc file. It's more useless than I thought
If I'm using the wrong Node.js version it warns me when I run yarn
as follows:
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ nvm use 10.6.0
Now using node v10.6.0 (npm v6.1.0)
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ yarn
yarn install v1.12.3
[1/5] 🔍 Validating package.json...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=10.10.0". Got "10.6.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
You're right, there's just as many steps whether we do or don't have the .nvmrc file. The important thing is to have the "engine" specified.
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ node --version
v10.6.0
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ nvm use
No .nvmrc file found
With .nvmrc file:
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ node --version
v10.6.0
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $ nvm use
Found '/Users/scon/code/src/paritytech/js-libs/.nvmrc' with version <10.10.0>
N/A: version "10.10.0 -> N/A" is not yet installed.
You need to run "nvm install 10.10.0" to install it before using it.
scon @ ~/code/src/paritytech/js-libs - [luke-81-electron-4] $
Closing as replaced by PR #91 and comments being incorporated. |
Update to Electron v3.1.0 - https://github.com/electron/electron/releases
Update Readme
Update dependencies versions
Add .nvmrc