Git Product home page Git Product logo

electron-react-typescript-boilerplate's Introduction

electron-react-typescript-boilerplate

Build Status Greenkeeper badge

This is a slight modificiation of the great electron-react-boilerplate by chentsulin. Instead of Babel and flow this version uses TypeScript. Support for Sass has also been added.

electron-react-boilerplate

Live editing development on desktop app

Electron application boilerplate based on React, Redux, React Router, Webpack, React Transform HMR for rapid application development

Screenshot

Electron Boilerplate Demo

Install

  • Note: requires a node version >= 6 and an npm version >= 3.
  • If you have installation or compilation issues with this project, please see our debugging guide

First, clone the repo via git:

git clone https://github.com/iRath96/electron-react-typescript-boilerplate.git your-project-name

And then install dependencies. ProTip: Install with yarn for faster and safer installation

$ cd your-project-name && npm install

πŸ’‘ In order to remove boilerplate sample code, simply run npm run cleanup. After this is run, the initial sample boilerplate code will be removed in order for a clean project for starting custom dev

Run

Run these two commands simultaneously in different console tabs.

$ npm run hot-server
$ npm run start-hot

or run two servers with one command

$ npm run dev

Editor Configuration

Atom

apm install editorconfig es6-javascript atom-ternjs javascript-snippets linter linter-eslint language-babel autocomplete-modules

Sublime

Others

DevTools

Toggle Chrome DevTools

  • OS X: Cmd Alt I or F12
  • Linux: Ctrl Shift I or F12
  • Windows: Ctrl Shift I or F12

See electron-debug for more information.

DevTools extension

This boilerplate is included following DevTools extensions:

You can find the tabs on Chrome DevTools.

If you want to update extensions version, please set UPGRADE_EXTENSIONS env, just run:

$ UPGRADE_EXTENSIONS=1 npm run dev

# For Windows
$ set UPGRADE_EXTENSIONS=1 && npm run dev

CSS Modules

This boilerplate out of the box is configured to use css-modules.

All .css file extensions will use css-modules unless it has .global.css.

If you need global styles, stylesheets with .global.css will not go through the css-modules loader. e.g. app.global.css

If you want to import global css libraries (like bootstrap), you can just write the following code in .global.css:

@import "~bootstrap/dist/css/bootstrap.css";

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

To package apps with options:

$ npm run package -- --[option]

Further commands

To run the application without packaging run

$ npm run build
$ npm start

To run End-to-End Test

$ npm run build
$ npm run test-e2e

Options

See electron-builder CLI Usage

Module Structure

This boilerplate uses a two package.json structure.

  1. If the module is native to a platform or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.
  2. If a module is imported by another module, include it in dependencies in ./package.json. See this ESLint rule.
  3. Otherwise, modules used for building, testing and debugging should be included in devDependencies in ./package.json.

Static Type Checking

This project comes with Flow support out of the box! You can annotate your code with types, get Flow errors as ESLint errors, and get type errors during runtime during development. Types are completely optional.

Native-like UI

If you want to have native-like User Interface (OS X El Capitan and Windows 10), react-desktop may perfect suit for you.

Dispatching redux actions from main process

see discusses in #118 and #108

How to keep the boilerplate updated

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

git remote add upstream https://github.com/chentsulin/electron-react-boilerplate.git

Then, use git to merge some latest commits:

git pull upstream master

Maintainers

License

MIT Β© C. T. Lin

electron-react-typescript-boilerplate's People

Contributors

buehler avatar greenkeeper[bot] avatar greenkeeperio-bot avatar irath96 avatar jfaquinojr avatar kevupton avatar mreilaender avatar treshenry 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

electron-react-typescript-boilerplate's Issues

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected πŸ€–


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Can't call setState on a component that is not yet mounted

I'm just beginning my React learning journey but in previous projects been quite dependent on TypeScript which is what lead me to your project. I've been quite impressed with everything included here, so thank you for the project.

I'm having an issue where if I bind a listener in the constructor I'm getting a warning:

react.development.js:225 Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to this.state directly or define a state = {}; class property with the desired state in the Foo component.

However, if I bind the listener in the onClick of the button, it works just fine. I saw your reply in #34 and noticed in /tsconfig.json that it is already set to es5. So I'm not quite sure where you set the output to es5 or if that change was already added to the source somewhere.

I solved this problem by emitting ES5 code now. Hot loading still works as before and the code you provided should run without problems. Let me know whether this works for you!

Any help you might provide would be very much appreciated. Here is my example:

import * as React from 'react';

export default class Foo extends React.Component {
    public state: any = {};
    constructor(props: any) {
        super(props);
		this.openBar = this.openBar.bind(this);
		this.state = {mail: false, sidebar: false};
	}
	/**
	 * Works just fine with binding set in onClick
	 */
    openFoo() {
		let newState = !this.state.foo;
        this.setState({foo: newState});
	}
	/**
	 * Produces an error/warning:
	 * react.development.js:225 Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the Foo component.
	 */
    openBar() {
		let newState = !this.state.bar;
        this.setState({bar: newState});
    }
    render() {
        return (
            <div>
                <button onClick={this.openBar}>Bar</button>
                <button onClick={this.openFoo.bind(this)}>Foo</button>
            </div>
        );
    }
}

Importing stylesheet normally doesn't work for components

I've noticed that the template uses:

const style = require('./Component.scss');

<div className="style.element"></div>
:local {
  component { font-size: 30px }
}

But how come the normal way of importing stylesheet doesn't work?

import './component.scss';

Global components like p, h1, html works normally, but the scss file doesn't recognize class and id if the stylesheet is imported this way. I wonder if this is an Electron thing or is it a bug?

An in-range update of sinon is breaking the build 🚨

Version 2.3.7 of sinon just got published.

Branch Build failing 🚨
Dependency sinon
Current Version 2.3.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As sinon is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes Fix #1476
  • Fix #1476: spy.withArgs(args...).firstCall is broken
Commits

The new version differs by 13 commits.

  • 9365d49 Update docs/changelog.md and set new release id in docs/_config.yml
  • 7399b99 Add release documentation for v2.3.7
  • 21b4588 2.3.7
  • 169ac9d Update Changelog.txt and AUTHORS for new release
  • 1108117 Merge pull request #1480 from fearphage/lint-staged
  • 9ecd56a moved from dependencies to dev dependencies [ci skip]
  • 0a85f21 improved linting for staged files [ci skip]
  • 079925b Merge pull request #1478 from takasmiley/issues/#1476
  • 40efa6f Cleanup a few test codes
  • 1ff2b9b Add spy.getCall tests with combination of withArgs arguments
  • c280916 Fix #1476: spy.withArgs(args...).firstCall is broken
  • 8ad2ed7 Merge pull request #1477 from mroderick/add-documentation-for-getcalls
  • fea23b0 Add missing documentation for spy.getCalls()

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of electron-builder is breaking the build 🚨

Version 19.11.1 of electron-builder just got published.

Branch Build failing 🚨
Dependency electron-builder
Current Version 19.11.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As electron-builder is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 19.11.1

Historically, afterPack user handler was called after code signing of main Windows executable. Now this behaviour changed to be more consistent and expected β€” Windows executable is signed after user afterPack handler.

Bug Fixes

  • nsis: escape space in command (b370006), closes #1758
  • afterPack callback is not called at the same time for windows & mac (087d90b), closes #1689
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/react is breaking the build 🚨

Version 15.0.32 of @types/react just got published.

Branch Build failing 🚨
Dependency @types/react
Current Version 15.0.31
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/react is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Main as .ts?

This is not relatively an issue but have been wondering about the structure of the project. But would it be possible to redo the file structure to something along the lines of example-project. I would like to have my main process as a Typescript file and also have it bundled correctly.

Currently when this project bundles within itself instead of a distributed lone directory. I am working on making changes to do this but have yet to accomplish it while also keeping the hot loading working for development.

An in-range update of sinon is breaking the build 🚨

Version 2.3.8 of sinon just got published.

Branch Build failing 🚨
Dependency sinon
Current Version 2.3.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As sinon is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes Fix #1474: stub#usingPromise and stub#onNthCall have unexpected interactions

This release fixes #1474

Commits

The new version differs by 6 commits.

  • 717ebf7 Update docs/changelog.md and set new release id in docs/_config.yml
  • 4f1bcc0 Add release documentation for v2.3.8
  • 083632e 2.3.8
  • 0b5bd48 Update Changelog.txt and AUTHORS for new release
  • 7512258 Merge pull request #1484 from HugoMuller/issue-1474
  • d14d296 propagates promiseLibrary to new stub behaviors

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of sinon is breaking the build 🚨

Version 2.3.6 of sinon just got published.

Branch Build failing 🚨
Dependency sinon
Current Version 2.3.5
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As sinon is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 30 commits.

  • 496f6b0 Update docs/changelog.md and set new release id in docs/_config.yml
  • 60a3284 Add release documentation for v2.3.6
  • 98119bf 2.3.6
  • 4f07053 Update Changelog.txt and AUTHORS for new release
  • 1fc4d59 Experiment over
  • 13e11c8 Experiment: Object.defineProperty(winodw, 'innerHeight'), Safari 10 - part 3
  • 76dd323 Experiment: Object.defineProperty(winodw, 'innerHeight'), Safari 10 - part 2
  • 83e84a9 Experiment: Object.defineProperty(winodw, 'innerHeight'), Safari 10
  • 6adba15 Merge pull request #1473 from fearphage/eslint-yaml
  • e1d188c fixed capitalization
  • d22eda3 Merge pull request #1313 from takasmiley/issues/#1274
  • 1661a0f Add test code of spy.matchingFakes
  • cf3a34e Move #1274 test code to respective test files
  • 833ff2c Replace for loop with Array.prototype.forEach
  • e72fee4 Update matchingFakes, always returns array

There are 30 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/react-router-dom is breaking the build 🚨

Version 4.0.7 of @types/react-router-dom just got published.

Branch Build failing 🚨
Dependency @types/react-router-dom
Current Version 4.0.6
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/react-router-dom is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of typescript is breaking the build 🚨

Version 2.4.1 of typescript just got published.

Branch Build failing 🚨
Dependency typescript
Current Version 2.4.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As typescript is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 141 commits.

  • 8b2fe13 Update LKG.
  • 14d95ed Test:Block-scoped definition of Promise works
  • a8846bf Skip block scope check with no error location
  • 44f2336 Merge pull request #16633 from Microsoft/release-2.4_fixIncrementalParsing
  • 4875a27 Add tests
  • 15ef20d Set the structureReused to be safemoudles when dynamic import change
  • 6d33083 Add tests
  • 11b9f6e Wip-fix incremental parsing
  • 2721fd4 In TypeScript code, never bind JSDoc normally, just set parent pointers (#16555) (#16561)
  • 0968ed9 Revert string enum changes (#16569)
  • 096f8cc Update LKG
  • 9241175 Allow running in strict mode (#16557)
  • f49b007 Update LKG
  • f1b0f59 Update version to 2.4.1
  • ed9cde9 Update LKG

There are 141 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Revert file-loader to previous version to fix css/scss imports

The update to file-loader 1.0.0-rc0 in #26 broke css-loader.

Currently, imported fonts will not load because the url() paths in the font-face are replaced by [object Object]. It's a known issue for file-loader webpack-contrib/file-loader#181 and css-loader webpack-contrib/css-loader#585 having something to do with file-loader moving to es6 imports.

Reproduce by cloning the repo, starting the dev server and looking at the demo counter app. The Font Awesome icons show up as squares.

image

Component .scss changes don't hot load

Component level .scss file changes don't hot reload.

The server must be killed and restarted to reflect changes. We haven't touched any project configuration. Is this a bug or by design?

An in-range update of electron-builder-http is breaking the build 🚨

Version 19.14.0 of electron-builder-http just got published.

Branch Build failing 🚨
Dependency electron-builder-http
Current Version 19.12.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As electron-builder-http is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 19.14.0

Faster ASAR file packaging and file copying, including copying of node_modules directory. As always, this version is is prerelease and your feedback on pre-release versions is important to release stable version.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Action helper type guard breaks large reducers

The actionCreatorVoid helper method has a 'test' method that acts as a type guard, allowing typescript to deduce the type is 'IAction'.

Modern versions of typescript use this type information to narrow the remaining type, so you can easily end up with compilation errors in your reducers

// problematicActions.ts
export const stringPayloadAction = actionCreator<string>('STRING_PAYLOAD');
export const noPayloadAction1 = actionCreatorVoid('NO_PAYLOAD_1');
export const noPayloadAction2 = actionCreatorVoid('NO_PAYLOAD_2');


// problematicReducer.ts
export type TState = {
}

export function problematicReducer(state: Tstate = {}, action: IAction): TState {
  if (stringPayloadAction.test(action)) {
    // OK: action deduced as IAction<string>
  } else if (noPayloadAction1.test(action)) {
    // OK: action deduced as IAction
  } else if (noPayloadAction2.test(action)) {
    // Error: Typescript deduces action as 'never' within this check
    // as the previous noPayloadAction1 check covered all IAction cases.
  }

  return state;
}

The solution is to change the test methods in helper.ts to return boolean rather than act as type guards.

Cannot compile app when importing `docker-registry-client`

I cloned the repo repo and installed docker-registry-client, then added this line to App.tsx:

import * as client from "docker-registry-client"
console.log("client", client)

And I get this error when compiling (npm run dev in that project):

ERROR in ./~/asn1.js-rfc3280/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../.. in /Users/abeall/tools/docker-manager/electron/node_modules/asn1.js-rfc3280
 @ ./~/asn1.js-rfc3280/index.js 4:13-34

The error only appears when I try to import docker-registry-client. Any idea?

Compile error on run dev (Hot server error)

Output error on first run (out of the box).

--- From npm-debug.log ---
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\Node\node.exe',
1 verbose cli 'C:\Program Files\Node\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]predev: [email protected]
6 silly lifecycle [email protected]
predev: no script for predev, continuing
7 info lifecycle [email protected]dev: [email protected]
8 verbose lifecycle [email protected]
dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]dev: PATH: C:\Program Files\Node\node_modules\npm\bin\node-gyp-bin;D:\Dev\Node\CPI\etv-cpi\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Node;C:\Program Files\Git\cmd;C:\Users\Artemis\AppData\Local\Microsoft\WindowsApps;C:\Users\Artemis\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin
10 verbose lifecycle [email protected]
dev: CWD: D:\Dev\Node\CPI\etv-cpi
11 silly lifecycle [email protected]dev: Args: [ '/d /s /c', 'npm run hot-server -- --start-hot' ]
12 silly lifecycle [email protected]
dev: Returned: code: 1 signal: null
13 info lifecycle [email protected]~dev: Failed to exec dev script
14 verbose stack Error: [email protected] dev: npm run hot-server -- --start-hot
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\Node\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\Node\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:920:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
15 verbose pkgid [email protected]
16 verbose cwd D:\Dev\Node\CPI\etv-cpi
17 error Windows_NT 10.0.15063
18 error argv "C:\Program Files\Node\node.exe" "C:\Program Files\Node\node_modules\npm\bin\npm-cli.js" "run" "dev"
19 error node v6.11.5
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] dev: npm run hot-server -- --start-hot
22 error Exit status 1
23 error Failed at the [email protected] dev script 'npm run hot-server -- --start-hot'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the electron-react-typescript-boilerplate package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run hot-server -- --start-hot
23 error You can get information on how to open an issue for this project with:
23 error npm bugs electron-react-typescript-boilerplate
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls electron-react-typescript-boilerplate
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

-- From the console (Webstorm) ---
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\Node\node.exe" "C:\Program Files\Node\node_modules\npm\bin\npm-cli.js" "run" "dev"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: npm run hot-server -- --start-hot
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'npm run hot-server -- --start-hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-react-typescript-boilerplate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run hot-server -- --start-hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-react-typescript-boilerplate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-react-typescript-boilerplate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\Dev\Node\CPI\etv-cpi\npm-debug.log

Environment: Websotrm 2017.2.1 on Windows 10

I noticed that the ./package.json file seems to reference files that are not there:

Line 6: "main.js" (I changed this to "main.development.js" that is present, but same failure)
Lines 65-72: The "files" array references files that are not present: "dist/", "main.js", "main.js.map". I'm not too familiar with NPM, but it seems to be this could be contributing to the problem?

Calling `child_process` Cannot read property 'NODE_ENV' of undefined

Sorry, new to electron, so I'm probably doing something dumb... but I'm trying to spawn a child process from one of the redux actions just as a test. However, when I add the code:

import { actionCreatorVoid } from './helpers';
import * as process from 'child_process';
export const increment = actionCreatorVoid('INCREMENT_COUNTER');
export const decrement = actionCreatorVoid('DECREMENT_COUNTER');

export function incrementIfOdd() {
  return (dispatch: Function, getState: Function) => {
    const { counter } = getState();


    if (counter % 2 === 0) {
      return;
    }

    var ls = process.spawn('ls');
    console.log(ls);

    dispatch(increment());
  };
}

export function incrementAsync(delay: number = 1000) {
  return (dispatch: Function) => {
    setTimeout(() => {
      dispatch(increment());
    }, delay);
  };
}

i get the following error:

Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined

I see that NODE_ENV is being set using the define plugin, so IDK if this is a bug or maybe what I'm trying to do isn't possible?

Any Insight would be appreciated! (EG if there is a better way/place to do this).

Debugging support with VS Code

Hi,

thx for doing this great boilerplate project. It helpΒ΄s a lot when starting development with react and electron! Great!
The only thing I am missing is a good debugging support out of my IDE. Is it possible to debug the main/render thread with VS-Code even when using the devserver (npm run dev)? What I have to do to configure the debugger properly?

Compile errors on npm run dev

$ tsc -v
Version 2.4.0
ERROR in D:\CascarrElectron\node_modules\@types\enzyme\index.d.ts
(18,35): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\enzyme\index.d.ts
(26,41): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router-dom\index.d.ts
(33,31): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router-dom\index.d.ts
(40,28): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router-dom\index.d.ts
(46,22): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router-dom\index.d.ts
(55,25): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(40,35): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(46,29): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(56,31): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(74,28): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(79,29): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(87,35): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router\index.d.ts
(92,29): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-router-redux\index.d.ts
(26,45): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-redux\index.d.ts
(179,31): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react-hot-loader\index.d.ts
(18,35): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).

ERROR in D:\CascarrElectron\node_modules\@types\react\index.d.ts
(165,11): error TS2559: Type 'Component<P, S>' has no properties in common with type 'ComponentLifecycle<P, S>'.

ERROR in D:\CascarrElectron\test\containers\CounterPage.spec.tsx
(14,6): error TS2604: JSX element type 'Provider' does not have any construct or call signatures.

ERROR in ./app/containers/Root.tsx
(16,6): error TS2604: JSX element type 'Provider' does not have any construct or call signatures.

ERROR in ./app/containers/Root.tsx
(17,8): error TS2604: JSX element type 'ConnectedRouter' does not have any construct or call signatures.

ERROR in ./app/components/Home.tsx
(12,12): error TS2604: JSX element type 'Link' does not have any construct or call signatures.

ERROR in ./app/components/Counter.tsx
(21,12): error TS2604: JSX element type 'Link' does not have any construct or call signatures.

ERROR in ./app/routes.tsx
(9,6): error TS2604: JSX element type 'Switch' does not have any construct or call signatures.

ERROR in ./app/routes.tsx
(10,8): error TS2604: JSX element type 'Route' does not have any construct or call signatures.

ERROR in ./app/routes.tsx
(11,8): error TS2604: JSX element type 'Route' does not have any construct or call signatures.

ERROR in ./app/index.tsx
(11,4): error TS2604: JSX element type 'AppContainer' does not have any construct or call signatures.

ERROR in ./app/index.tsx
(21,8): error TS2604: JSX element type 'AppContainer' does not have any construct or call signatures.

Hot loading not working

When making changes to the Home app\components\Home.tsx component (change text from Home to Home1234), the UI doesn't get updated.
Note, the same thing (hot loading) works in the standard React repo (using plain javascript).

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepoundefined

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v16.5.1

16.5.1 (September 13, 2018)

React

  • Improve the warning when React.forwardRef receives an unexpected number of arguments. (@andresroberto in #13636)

React DOM

  • Fix a regression in unstable exports used by React Native Web. (@aweary in #13598)
  • Fix a crash when component defines a method called isReactComponent. (@gaearon in #13608)
  • Fix a crash in development mode in IE9 when printing a warning. (@link-alex in #13620)
  • Provide a better error message when running react-dom/profiling with schedule/tracking. (@bvaughn in #13605)
  • If a ForwardRef component defines a displayName, use it in warnings. (@probablyup in #13615)

Schedule (Experimental)

  • Add a separate profiling entry point at schedule/tracking-profiling. (@bvaughn in #13605)
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

VSCode Issue

Hello and thank you for the useful boilerplate,

I'm just getting started with the project, but I noticed something when I open it in Visual Studio Code: the editor shows e2e.spec.ts as red (meaning it has errors), and when I open the file, the first line is underlined, complaining something about an async callback in jest (I have attached a screenshot)

image

Of course, I can run the test and it works fine, but I was wondering if there's a way to fix this issue in Visual Studio Code.

Thank you

How to ship resource files with it?

Hey there

I've been using your boilerplate and I gotta say, it rocks! As a react and electron rookie, it's cool because it just works. Now just one thing:
How can I ship (or use) resource files?

I've got a folder within the app folder, that is called assets. In there, there are 2 xml files which I like to ship with electron. It all works in develop, but when I build the whole thing, those files are kinda missing and I get a blank screen in the application :-(

So I tried to use an xml-loader for webpack and everytime I get "failed to load resource".

Is there any method to ship resource assets with electron, or isn't that possible?

Cheers
Chris

react-hot-loader causes weird behavior when binding in the component constructor

I ran across this problem earlier today and it seems to be related to this issue in react-hot-loader 313. The following snippet should highlight the issue:

import * as React from 'react';

class Foo extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      bar: {
        s1: '',
        s2: ''
      }
    };
    
    // Good practice bind in the constructor
    this.function1 = this.function1.bind(this);
  }

  function1(event) {
    let bar = this.state.bar;
    bar.s1 = event.target.value;
    this.setState({bar: bar});
    // Input will not update and a warning will show in the log
  }

  function2(event) {
    let bar = this.state.bar;
    bar.s2 = event.target.value;
    this.setState({bar: bar});
    // Expected behavior
  }

  render() {
    <div>
      <input type='text' onChange={this.function1} value={this.state.bar.s1} />
      <input type='text' onChange={this.function2.bind(this)} value={this.state.bar.s2} /> // Bad bind here
    </div>
  }
}

The expected behavior of the above code should be that the two inputs should update as expected on change. However what is happening is that the second input (with this bound in the render function) behaves as you would expect with the input updating when you type. The first input (with this bound in the constructor) causes the following warning to be thrown whenever a character is typed into it. The characters do not update as the state cannot be updated.

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the WHATEVER component.

A quick fix I have found for this case is to just update the webpack.config.base.js by removing the react-hot-loader/webpack loader.

An in-range update of @types/node is breaking the build 🚨

Version 8.0.4 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ

Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

icons doesnt show

Hi,
first thx for your work,
i want to figure out how does it work to enable the resources. Any help would be nice

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.