Code Monkey home page Code Monkey logo

reactron's Introduction

React Boilerplate Electron Version

Reactron is a boilerplate to kick start your electron application with react based on Electron and the famous React Boilerplate.

React Redux Webpack BabelJS React Router Jest ESLint

React Boilerplate Electron Version


Installation

Note: Whether you have native dependencies in your app or not, I assume it's nice to always have node-gyp build tools installed on your machine.

For Windows: npm install --global --production windows-build-tools from CMD or Powershell (With Admin)

For Ubuntu: Follow My Answer On Stackoverflow

Then

First, clone the repository from github:

$ git clone https://github.com/mjangir/reactron.git

And then install dependencies with npm:

$ npm install

Run

Start the app in the dev environment. This starts the renderer process in hot-module-replacement mode and starts a webpack dev server that sends hot updates to the renderer process:

$ npm run dev

Alternatively, you can run the renderer and main processes separately. This way, you can restart one process without waiting for the other. Run these two commands simultaneously in different console tabs:

$ npm run start-renderer-dev
$ npm run start-main-dev

You can also run a webpack compiled main process with the following:

$ npm start

Packaging

To package apps for the local platform:

$ npm run package

To package apps for all platforms:

First, refer to Multi Platform Build for dependencies. Then,

$ npm run package-all

Features Added

The project has some of the common desktop application features integrated:

  1. Auto Update: Publish your electron app on Github or Amazon S3 by updating the credentials in package.json. Then click on the Check For Updates in Help menu. For more information on publishing the app, check this out.
  2. Auto Launch On Start: On settings page, when you check Auto Launch At Start option, the app will be automatically started on windows or osx startup.
  3. Show Tray Icon: On settings page, you can toggle Show Tray Icon option to show the icon in tray. Currently it has only quit option in the tray context menu.
  4. Start Minimized: If you check this option, the application will be started minimized.
  5. Apart from that, window state keeper has been added to retain the last window sizes and dimesion.

How to keep your project updated with the boilerplate

If your application is a fork from this repository, you can add this repo to another git remote:

git remote add upstream https://github.com/mjangir/reactron.git

Then, use git to merge some latest commits:

git pull upstream master

Thanks To

React Boilerplate Electron

Maintainers

Manish Jangir

License

MIT © Manish Jangir

reactron's People

Contributors

mjangir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

reactron's Issues

npm run package has build errors

On macos.

Many errors on

npm run package

pertaining to unfound resources.

Changing all instance of build/ to resources/ in the root package.json fixes them.

Last React Boilerplate version

Thanks for your work!

Can you update this repo to the latest react boilerplate version? Or maybe edit your great wiki for the latest version?

React-uwp component work abnorm in reactron

Hi, Manish:
I'm uing uwp UI in reactron. So I installed the package of react-uwp, when i tried the commandbar component, i found it couldn't render out the object. There is no icons displayed for primaryCommands of the introduce page.
At former i think it may be an UI component issue, but after i tested the pure create-react-app, the UI component is working normal. And then, I tested in basic create-react-app in electron environment, it still working normal.

the code is here:

https://www.react-uwp.com/components/commandbar

After npm install react-uwp, just copy the "Simple Examples" of the linked page. And create a page in app/containers/testUWPPage, you could call the page in in App/index.js, you could see the result.

npm run package failed

Hi, mjangir:
Nice to see you.
I download the reactron and test the pack command "npm run package", it's working for your default project. Then i want to add more features, so i add the package
yarn add semantic-ui-react
yarn add semantic-ui-css
and som of my own code in APP folder. It's working with "npm run dev". But when i want to pack it, there is always fail, the log looks like this

==========================
D:\Users,,,\vscode\js\reactron>npm run package

[email protected] package D:\Users,,,\vscode\js\reactron
npm run release:clean && npm run build && build --publish never

[email protected] release:clean D:\Users,,,\vscode\js\reactron
rimraf ./release

[email protected] prebuild D:\Users,,,\vscode\js\reactron
npm run build:clean

[email protected] build:clean D:\Users,,,\vscode\js\reactron
rimraf ./app/build

[email protected] build D:\Users,,,\vscode\js\reactron
concurrently "npm run build:main" "npm run build:renderer"

[0]
[0] > [email protected] build:main D:\Users,,,\vscode\js\reactron
[0] > cross-env NODE_ENV=production BABEL_ENV=electron node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config internals/webpack/webpack.main.prod.js --colors
[0]
[1]
[1] > [email protected] build:renderer D:\Users,,,\vscode\js\reactron
[1] > cross-env NODE_ENV=production BABEL_ENV=electron node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config internals/webpack/webpack.prod.babel.js --colors
[1]
[0] Hash: ed863b3cc9e38fcbe5d9
[0] Version: webpack 4.12.0
[0] Time: 2412ms
[0] Built at: 12/03/2018 8:56:58 AM
[0] Asset Size Chunks Chunk Names
[0] ./main.prod.js 110 KiB 0 [emitted] main
[0] ./main.prod.js.map 467 KiB 0 [emitted] main
[0] [0] external "path" 42 bytes {0} [built]
[0] [1] external "fs" 42 bytes {0} [built]
[0] [2] external "electron" 42 bytes {0} [built]
[0] [4] external "electron-is-dev" 42 bytes {0} [built]
[0] [8] external "electron-settings" 42 bytes {0} [built]
[0] [17] external "module" 42 bytes {0} [built]
[0] [21] ./app/electron/autoupdater.js 3.85 KiB {0} [built]
[0] [56] external "@sentry/electron" 42 bytes {0} [built]
[0] [57] ./app/utils/electronSentryUtil.js 617 bytes {0} [built]
[0] [58] external "auto-launch" 42 bytes {0} [built]
[0] [59] ./app/electron/startup.js 1.33 KiB {0} [built]
[0] [61] external "electron-updater" 42 bytes {0} [built]
[0] [62] ./app/electron/menu.js 5.39 KiB {0} [built]
[0] [63] external "electron-window-state" 42 bytes {0} [built]
[0] [64] ./app/electron/main.dev.js 8.69 KiB {0} [built]
[0] + 50 hidden modules
[0]
[0] WARNING in ./node_modules/electron-debug/index.js 101:45-58
[0] Critical dependency: the request of a dependency is an expression
[0] @ ./app/electron/main.dev.js
[0]
[0] WARNING in ./node_modules/electron-debug/index.js 102:61-74
[0] Critical dependency: the request of a dependency is an expression
[0] @ ./app/electron/main.dev.js
[0] npm run build:main exited with code 0
[1] Hash: 5ee2b0f1cf7bc5a676d1
[1] Version: webpack 4.12.0
[1] Time: 22775ms
[1] Built at: 12/03/2018 8:57:19 AM
[1] Asset Size Chunks Chunk Names
[1] 1.23da5b9dda291a3d233b.chunk.js 3.65 KiB 1 [emitted]
[1] b87b9ba532ace76ae9f6edfe9f72ded2.ttf 103 KiB [emitted]
[1] 8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot 104 KiB [emitted]
[1] faff92145777a3cbaf8e7367b4807987.woff 49.3 KiB [emitted]
[1] 701ae6abd4719e9c2ada3535a497b341.eot 30.4 KiB [emitted]
[1] c5ebe0b32dc1b5cc449a76c4204d13bb.ttf 96.1 KiB [emitted]
[1] 13db00b7a34fee4d819ab7f9838cc428.eot 96.3 KiB [emitted]
[1] .htaccess.bin 1.8 KiB [emitted]
[1] cd6c777f1945164224dee082abaea03a.woff2 12 KiB [emitted]
[1] a1a749e89f578a49306ec2b055c073da.svg 496 KiB [emitted] [big]
[1] favicon.ico 361 KiB [emitted]
[1] 9c74e172f87984c48ddf5c8108cabe67.png 27.5 KiB [emitted]
[1] ad97afd3337e8cda302d10ff5a4026b8.ttf 30.2 KiB [emitted]
[1] ef60a4f6c25ef7f39f2d25a748dbecfe.woff 14.4 KiB [emitted]
[1] 2f1a976c9c35ffed9b7e23cf2cbf8f19.jpg 201 KiB [emitted]
[1] a046592bac8f2fd96e994733faf3858c.woff 62.2 KiB [emitted]
[1] e8c322de9658cbeb8a774b6624167c2c.woff2 53.2 KiB [emitted]
[1] 82f60bd0b94a1ed68b1e6e309ce2e8c3.svg 105 KiB [emitted]
[1] 962a1bf31c081691065fe333d9fa8105.svg 382 KiB [emitted] [big]
[1] 0.952130e192c0a78fe0fa.chunk.js 863 KiB 0 [emitted] [big]
[1] 0ab54153eeeca0ce03978cc463b257f7.woff2 39.2 KiB [emitted]
[1] 2.6dee619e81ce84541a07.chunk.js 1.02 KiB 2 [emitted]
[1] 3.52d7847d70ce196b591a.chunk.js 23.8 KiB 3 [emitted]
[1] 4.9ea623b39595c318f09d.chunk.js 23.6 KiB 4 [emitted]
[1] runtimemain.9fbd0eaad62b9b92e0fb.js 2.29 KiB 5 [emitted] runtimemain
[1] vendorsmain.2f6cc107b76dd5abcb3d.chunk.js 1.67 MiB 6 [emitted] [big] vendorsmain
[1] main.473f0c6a0c72a2b60df8.chunk.js 278 KiB 7 [emitted] main
[1] index.html 1.26 KiB [emitted]
[1] sw.js 18.9 KiB [emitted]
[1] manifest.d0296b920805b2768fa23f7fadc7374c.json 1.69 KiB [emitted]
[1] icon_512x512.dc20f8a86234c4a7a0b08d5cffff9d4d.png 43.3 KiB [emitted]
[1] icon_384x384.f2d8221e40ea55159668a02741826386.png 40.3 KiB [emitted]
[1] icon_192x192.9aeb7f7081bf5316fa2c57b439bffdbe.png 18.4 KiB [emitted]
[1] icon_180x180.33285f999db78beed5640085c051e7b1.png 17.4 KiB [emitted]
[1] icon_167x167.9085aba6ea24073fba72a94b7ac731a1.png 15.8 KiB [emitted]
[1] icon_152x152.80d43cecdc663299328632b85127117b.png 14.2 KiB [emitted]
[1] icon_144x144.f2f644149d1ca21bccb120d44e79c824.png 13.3 KiB [emitted]
[1] icon_128x128.e76c240129e3d6ee2eb7df8f1e9c7b0f.png 10.7 KiB [emitted]
[1] icon_120x120.2f7752bee9dcd06e998fd44640e47485.png 11 KiB [emitted]
[1] icon_96x96.e26d703c83c9b5844bb4f58c397f4bf2.png 8.46 KiB [emitted]
[1] icon_72x72.0880a778e8031d3cb721b64c1c1059a7.png 6.05 KiB [emitted]
[1] [063ddd4fe3a5ed5f1bb8] ./app/containers/NotFoundPage/Loadable.js 612 bytes {7} [built]
[1] [0785de3f40b134973d35] ./app/i18n.js 1.59 KiB {7} [built]
[1] [1283171292070762fea8] ./app/configureStore.js 2.19 KiB {7} [built]
[1] [491cc2e27aa2b4221847] ./app/reducers.js 2.29 KiB {7} [built]
[1] [bfa93fc63e81b5f72415] ./app/containers/MaxtouchPage/desk/index.js 4.29 KiB {7} [built]
[1] [0] multi ./app/app.js 28 bytes {7} [built]
[1] [4ce54d943eb1f3decabb] ./node_modules/file-loader/dist/cjs.js?name=[name].[ext]!./app/.htaccess 59 bytes {7} [built]
[1] [6c925591d78ad1124781] ./app/containers/App/index.js 2.71 KiB {7} [built]
[1] [6cbaae35658a59059130] ./app/containers/LanguageProvider/index.js 1.52 KiB {7} [built]
[1] [74431d47afb6248fcb69] ./node_modules/redux-saga/es/index.js + 15 modules 60.9 KiB {6} [built]
[1] | 16 modules
[1] [7dd68a64079d1d4cd439] ./app/translations/en.json 3.28 KiB {7} [built]
[1] [7fa3d1d0596e1f2a0f74] ./app/global-styles.js 571 bytes {7} [built]
[1] [8b703812aa8ae3c41814] ./app/app.js 3.63 KiB {7} [built]
[1] [9c6be9f00377ac8be3d8] ./node_modules/file-loader/dist/cjs.js?name=[name].[ext]!./app/images/favicon.ico 57 bytes {7} [built]
[1] [ab039aecd4a1d4fedc0e] ./node_modules/react-intl/lib/index.es.js + 14 modules 124 KiB {6} [built]
[1] | 15 modules
[1] + 714 hidden modules
[1]
[1] WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
[1] This can impact web performance.
[1] Assets:
[1] a1a749e89f578a49306ec2b055c073da.svg (496 KiB)
[1] 962a1bf31c081691065fe333d9fa8105.svg (382 KiB)
[1] 0.952130e192c0a78fe0fa.chunk.js (863 KiB)
[1] vendorsmain.2f6cc107b76dd5abcb3d.chunk.js (1.67 MiB)
[1]
[1] WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
[1] Entrypoints:
[1] main (1.67 MiB)
[1] runtime
main.9fbd0eaad62b9b92e0fb.js
[1] vendors~main.2f6cc107b76dd5abcb3d.chunk.js
[1]
[1] Child __offline_serviceworker:
[1] 1 asset
[1] 3 modules
[1] Child html-webpack-plugin for "index.html":
[1] 1 asset
[1] [798c46fd90a016ad8d48] ./node_modules/html-webpack-plugin/lib/loader.js!./app/index.html 1.77 KiB {0} [built]
[1] npm run build:renderer exited with code 0
• electron-builder version=20.38.2
• loaded configuration file=package.json ("build" field)
At least electron-updater 4.0.0 is recommended by current electron-builder version. Please set electron-updater version to "^4.0.0"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] package: npm run release:clean && npm run build && build --publish never
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] package script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users,,,\AppData\Roaming\npm-cache_logs\2018-12-03T00_57_20_974Z-debug.log

New install yarn dev loads blank white frame

Just forked, pulled down and yarn install.
A ton of warnings.

yarn dev

I get a blank white window.
In console I see:

Not allowed to load local resource: file:///Users/tim/src/lab/reactron/app/build/index.html

Simple google search seems to be something with webpack. Digging further now.

Install node-ffi

Hi, Manish:
Nice to meet you.
Do you have suggest to install node-ffi module?
I use the npm install ffi, it installed into "reactron\node_modules\ffi“, but when i want to import this from js file, it show the ffi file linked to "C:\Users\xxx\AppData\Local\Microsoft\TypeScript\3.0\node_modules@types\ffi"


const ref = require('ref');
const ffi = require('ffi');

BTW, i saw there are two
reactron\node_modules
reactron\app\node_modules

what's the different of them?

thanks

Electron version

Hi, Manish:
When i use npm install to get down the electron package, at package.json, we will find electron version is 2.0.17, but when i install the electron by --global parameter, the electron version will be 4.04, do you know why it not use the newest electron version in reactron?

Thanks.

package.json

"electron": "^2.0.17",
"electron-builder": "^20.25.0",
"electron-devtools-installer": "^2.2.4",
"electron-rebuild": "^1.8.4",

=============

electron -v
v4.0.4

Starting electron App in prod mode.

I was referring to this link for converting my react-app based on react-boilerplate with latest updates (3.7) version.

I was able to successfully convert my react web app to electron app in dev mode. However I am stuck with step 6 of wiki link.
When I execute the start prod command. It just launches the app but with no window. I am new to electron, need help to debug the exact problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.