Giter Club home page Giter Club logo

pxt-microbit-electron's Introduction

Interface

PXT micro:bit Electron app

A prototype for an offline (not quite there yet) standalone client of PXT.

This is an electron wrapper around the web app.

Installation

git clone https://github.com/Microsoft/pxt-microbit-electron.git

If you want to link your local repos:

npm link ../pxt
npm link ../pxt-microbit

Finally:

npm install

Please see the Error section below if you get errors during installation.

To remove links to your local repos, uninstall them from node_modules and reinstall them from NPM:

npm uninstall pxt-core
npm uninstall pxt-microbit
npm install

Launching the Electron app

npm start

Please see the Error section below if you get errors while running the app (such as weird DLL errors).

Errors while installing or running

If your Node version differs from Electron's Node version, you will need to rebuild some native modules in the dependencies of the web app.

Requirements

  • Python 2.x (NOT 3.x); make sure python is in your global Path
  • (Windows only) Visual Studio; any of the newer versions will do (Community 2015 works fine)

Rebuilding the native modules

Once you have the above dependencies:

npm run rebuild-native

Still have errors?

If you still can't run the Electron app even after rebuilding the native modules, you can try the following:

npm uninstall electron
npm uninstall electron-rebuild
npm install
npm run rebuild-native

pxt serve errors

Rebuilding the native modules can break pxt serve outside of the Electron app. To fix, uninstall the native modules from your PXT repo, and reinstall them:

npm uninstall serialport
npm uninstall ...
npm install

Packaging the app for release

Run the following:

npm run package

Note on npm link

If you've linked pxt-core and pxt-microbit, packaging won't work (electron-packager seems to support only 1 level of symlink, whereas npm link generates 2 symlinks). You will need to uninstall your linked repos and reinstall them via NPM:

npm uninstall pxt-core
npm uninstall pxt-microbit
npm install

If you need to use a non-released version of pxt-core or pxt-microbit, you can still do it without npm link by installing them from their cloned repo. Make sure their repos are checked out at the branch you wish to package in the Electron app, and then run:

npm install ../pxt
npm install ../pxt-microbit

Remember to run npm run rebuild-native before packaging, and make sure the app is working by running npm start.

Adding a dependency that is or contains a native modules

Whenever you add a dependency to package.json, there is a chance that it (or one of its nested dependencies) has a native component. If that is the case, and the Electron app stops working even after you run npm run rebuild-native, you may need to modify our rebuild-native.js script.

electron-rebuild does not always succeed in cleaning up the native modules that it rebuilds. In our dev_tools/rebuild-native.js script, we maintain a list of known native modules that we manually clean up. You will need to figure out where the module keeps its built native components, and add an entry to the knownNativeModules array in the rebuild-native.js script.

For example, serialport keeps its built components under build/release, so we added the following entry:

let knownNativeModules = [
    {
        packageName: "serialport",
        cleanDir: path.join("build", "release")
    }
];

pxt-microbit-electron's People

Contributors

guillaumejenkins avatar atlascoco avatar

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.