Code Monkey home page Code Monkey logo

examples's Introduction


Electron React Boilerplate uses Electron, React, React Router, Webpack and React Fast Refresh.


Build Status Github Tag Discord

OpenCollective OpenCollective StackOverflow

Install

Clone the repo and install dependencies:

git clone --depth 1 --branch main https://github.com/electron-react-boilerplate/electron-react-boilerplate.git your-project-name
cd your-project-name
npm install

Having issues installing? See our debugging guide

Starting Development

Start the app in the dev environment:

npm start

Packaging for Production

To package apps for the local platform:

npm run package

Docs

See our docs and guides here

Community

Join our Discord: https://discord.gg/Fjy3vfgy5q

Sponsors

Donations

Donations will ensure the following:

  • 🔨 Long term maintenance of the project
  • 🛣 Progress on the roadmap
  • 🐛 Quick responses to bug reports and help requests

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Maintainers

License

MIT © Electron React Boilerplate

examples's People

Contributors

3on avatar amilajack avatar jooohhn avatar renovate-bot avatar tinyadapter avatar vikr01 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  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  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  avatar  avatar  avatar

examples's Issues

Native module "fswin" not working on Windows (typescript boilerplate)

Prerequisites

  • Using yarn
  • Using node 10.x
  • Using an up-to-date master branch
  • Using latest version of devtools. See wiki for howto update
  • Link to stacktrace in a Gist (for bugs)
  • For issue in production release, devtools output of DEBUG_PROD=true yarn build && yarn start
  • Tried solutions mentioned in #400

Expected Behavior

I can add and use the native module fswin when using the typescript boilerplate.

Current Behavior

I just don't get the module fswin to work with the typescript example of ERB; the app does not load and the following error in ELECTRON_ASAR.js:160 is written into the DevTools console:

Uncaught Error: The specified module could not be found.
\\?\D:\development\workspace\test-ts-fswin-error\node_modules\fswin\electron\x64\fswin.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:160:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:722)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:160:31)
    at Module.load (internal/modules/cjs/loader.js:602)
    at tryModuleLoad (internal/modules/cjs/loader.js:541)
    at Function.Module._load (internal/modules/cjs/loader.js:533)
    at Module.require (internal/modules/cjs/loader.js:640)
    at require (internal/modules/cjs/helpers.js:20)
    at Object.<anonymous> (D:\development\workspace\test-ts-fswin-error\node_modules\fswin\index.js:3)
    at Object.<anonymous> (D:\development\workspace\test-ts-fswin-error\node_modules\fswin\index.js:7)

The fswin.node file exist in the folder reported by the error. As I read in various github issues, such an error can occur even if the .node file exists if the native module did not get compiled correctly, due to DLLs not present on the working machine.

But since I can use the module with pure NodeJS, and also with the normal JS version of ERB (tested with ae89980), I am sure that the module got compiled correctly.

It seems to me like the module not getting bundled correctly when using your typescript boilerplate example.

Since I could not figure out the problem, I would be glad if you could help me!

Further notes:

  • I tried both the traditional require and also the ES6 import syntax, without success.
  • The error also occurs when using UPGRADE_EXTENSIONS=1 yarn dev, or yarn package and starting the packaged app.

Steps to Reproduce (for bugs)

  1. git clone https://github.com/electron-react-boilerplate/examples

  2. cd examples/examples/typescript

  3. yarn

  4. yarn add fswin

  5. for testing purposes, add the following lines to index.tsx:

...
import { configureStore, history } from './store/configureStore';
import './app.global.css';

const fswin = require('fswin'); // ADDED
console.log(fswin); // ADDED

const store = configureStore();
...
  1. yarn dev --> Error is shown in the DevTools console, counter app is not loaded

erb-typescript-fswin-error

Context

I am working with the file system on windows and want to know if files are hidden or system-files. Since both node and electron don't expose APIs for that, I have to use a native module, and fswin seems to be a good choice for that.
As you can see with the steps to reproduce, no changes in the boilerplate were made.

Your Environment

  • Node version : 10.15.1
  • Yarn version : 1.13.0
  • Version or Branch used : 90294db
  • Operating System and version : Windows 10 64-bit

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency husky to v7
  • Update dependency lerna to v4
  • Update dependency lint-staged to v11

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.


  • Check this box to trigger a request for Renovate to run again on this repository

sqlite3 example - Unexpected identifier with `import webpack from 'webpack'`

I am new with ElectronJs & React, but more familiar with the standard NodeJS.

I wish to get more familiar with electron-react-boliderplate, not finding much docs, I go to the examples. See below for steps taken.

TL;DR SQLite3 example does not install deps

Steps Taken

Clone examples repo
https://github.com/electron-react-boilerplate/examples

Installing dependencies with
yarn install

Please note I have python2.7 installed

Output

"C:\Program Files\nodejs\node.exe" "C:\Program Files (x86)\Yarn\bin\yarn.js" install
yarn install v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/11] ⢀ waiting...
[2/11] ⠠ sqlite3
[-/11] ⠠ waiting...
[-/11] ⠠ waiting...
error C:\Users\s2134\WebstormProjects\examples\node_modules\erb-typescript-example: Command failed.
Exit code: 1
Command: electron-builder install-app-deps package.json && yarn build-dll && opencollective-postinstall
Arguments:
Directory: C:\Users\s2134\WebstormProjects\examples\node_modules\erb-typescript-example
Output:
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.40.2
  • loaded configuration file=package.json ("build" field)
  • no native production dependencies
yarn run v1.17.3
$ cross-env NODE_ENV=development webpack --config ./configs/webpack.config.renderer.dev.dll.babel.js --colors
C:\Users\s2134\WebstormProjects\examples\examples\typescript\configs\webpack.config.renderer.dev.dll.babel.js:7
import webpack from 'webpack';
       ^^^^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:80:7)
    at NativeCompileCache._moduleCompile (C:\Users\s2134\WebstormProjects\examples\node_modules\v8-compile-cache\v8-compile-cache.js:240:18)
    at Module._compile (C:\Users\s2134\WebstormProjects\examples\node_modules\v8-compile-cache\v8-compile-cache.js:186:36)
    at Module._compile (C:\Users\s2134\WebstormProjects\examples\node_modules\pirates\lib\index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Object.newLoader [as .js] (C:\Users\s2134\WebstormProjects\examples\node_modules\pirates\lib\index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (C:\Users\s2134\WebstormProjects\examples\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\utils\convert-argv.js:115:13)
    at requireConfig (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\utils\convert-argv.js:117:6)
    at C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\utils\convert-argv.js:124:17
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\utils\convert-argv.js:122:15)
    at yargs.parse (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\cli.js:71:45)
    at Object.parse (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\node_modules\yargs\yargs.js:567:18)
    at C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\cli.js:49:8
    at Object.<anonymous> (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack-cli\bin\cli.js:375:3)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\s2134\WebstormProjects\examples\node_modules\webpack\bin\webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:701:30)

Did I miss something or do something wrong?

Upgrade typescript?

To get rid of this error

/Users/shirshak/Developer/test/node_modules/typescript/lib/tsc.js:71026
                throw e;
                ^

Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isJsonSourceFile'.

RFC: Structure of Examples

There's a number of ways that we can organize these examples. The current planned method is to structure the examples as a monorepo using lerna. After thinking through this more I think using git submodules might be a better solution. I expect that most users would only want to install the dependencies for the example they want to run. So if they use lerna and bootstrap all the lerna packages they'd be installing a lot of modules they don't need. Git submodules removes this issue by letting the user cd into the example they want to run and then installing the dependencies for that project.

Thoughts on this?

Boilerplate not compatible with latest electron-builder version Typescript

macOs = Catalina

yarn package script not working

Error: Exit code: 2. Command failed: /usr/bin/perl /private/var/folders/84/j4hrkh6j6b58syhshty5sqp00000gn/T/t-a7wzvD/1-dmgProperties.pl Can't locate Mac/Memory.pm in @inc (you may need to install the Mac::Memory module) (@inc contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /private/var/folders/84/j4hrkh6j6b58syhshty5sqp00000gn/T/t-a7wzvD/1-dmgProperties.pl line 4.
BEGIN failed--compilation aborted at /private/var/folders/84/j4hrkh6j6b58syhshty5sqp00000gn/T/t-a7wzvD/1-dmgProperties.pl line 4.

As per the link electron-userland/electron-builder#3990
The issue will be resolved if I use the latest electron-builder package, but as soon as I update to the latest version it breaks the application, because of "yarn postinstall or npm postinstall" failed.

From the internet, i found out electron-userland/electron-builder#3751
that electron-builder install-app-deps has been deprecated.

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.